hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2025.06.17. 15:26



Jelenlévő felhasználók

Jelenleg 343 felhasználó van jelen :: 2 regisztrált, 0 rejtett és 341 vendég

A legtöbb felhasználó (2761 fő) 2025.01.09. 20:06-kor tartózkodott itt.

Regisztrált felhasználók: Bing [Bot], Google [Bot]az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása Hozzászólás a témához  [7 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Mi a hiba bene?
HozzászólásElküldve:2012.05.27. 19:27 
Offline
Minden6ó
Avatar

Csatlakozott:2011.01.19. 12:14
Hozzászólások:4294
Megköszönt másnak: 219 alkalommal
Megköszönték neki: 289 alkalommal
Valaki meg tudná csinálni? :) előre is THX!

[spoiler]
Kód:
  1. #include <amxmodx>

  2. #include <fakemeta>

  3. #include <engine>

  4. #include <hamsandwich>

  5. #include <xs>

  6. #include <zombieplague>

  7.  

  8. /*================================================================================

  9.  [Customization]

  10. =================================================================================*/

  11.  

  12. // Item Cost

  13. new const g_SawnOff_Cost = 30

  14.  

  15. // Models

  16. new const sawnoff_model_v[] = "models/v_sawn_off_shotgun.mdl"

  17. new const sawnoff_model_p[] = "models/p_sawn_off_shotgun.mdl"

  18. new const sawnoff_model_w[] = "models/w_sawn_off_shotgun.mdl"

  19.  

  20. // ---------------------------------------------------------------

  21. // ------------------ Customization ends here!! ------------------

  22. // ---------------------------------------------------------------

  23.  

  24. // Offsets

  25. #if cellbits == 32

  26. const OFFSET_CLIPAMMO = 51

  27. #else

  28. const OFFSET_CLIPAMMO = 65

  29. #endif

  30. const OFFSET_LINUX = 5

  31. const OFFSET_LINUX_WEAPONS = 4

  32. const OFFSET_LASTPRIMARYITEM = 368

  33.  

  34. // Version

  35. #define VERSION "0.4.5"

  36.  

  37. // Arrays

  38. new g_sawnoff_shotgun[33], g_currentweapon[33]

  39.  

  40. // Variables

  41. new g_SawnOff, g_MaxPlayers

  42.  

  43. // Cvar Pointers

  44. new cvar_enable, cvar_oneround, cvar_knockback, cvar_knockbackpower, cvar_uclip, cvar_damage

  45.  

  46. /*================================================================================

  47.  [Init and Precache]

  48. =================================================================================*/

  49.  

  50. public plugin_init()

  51. {

  52.         // Plugin Info

  53.         register_plugin("[ZP] Extra Item: Sawn-Off Shotgun", VERSION, "meTaLiCroSS")

  54.        

  55.         // Ham Forwards

  56.         RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")

  57.         RegisterHam(Ham_TraceAttack, "player", "fw_TraceAttack")

  58.         RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")

  59.        

  60.         // Fakemeta Forwards

  61.         register_forward(FM_SetModel, "fw_SetModel")

  62.        

  63.         // Event: Round Start

  64.         register_event("HLTV", "event_round_start", "a", "1=0", "2=0")

  65.        

  66.         // Message: Cur Weapon

  67.         register_message(get_user_msgid("CurWeapon"), "message_cur_weapon")

  68.        

  69.         // CVARS

  70.         register_cvar("zp_extra_sawnoff", VERSION, FCVAR_SERVER|FCVAR_SPONLY)

  71.         cvar_enable = register_cvar("zp_sawnoff_enable", "1")

  72.         cvar_uclip = register_cvar("zp_sawnoff_unlimited_clip", "1")

  73.         cvar_damage = register_cvar("zp_sawnoff_damage_mult", "4.0")

  74.         cvar_oneround = register_cvar("zp_sawnoff_oneround", "0")

  75.         cvar_knockback = register_cvar("zp_sawnoff_knockback", "1")

  76.         cvar_knockbackpower = register_cvar("zp_sawnoff_kbackpower", "10.0")

  77.        

  78.         // Variables

  79.         g_MaxPlayers = get_maxplayers()

  80.         g_SawnOff = zp_register_extra_item("Sawn-Off Shotgun", g_SawnOff_Cost, ZP_TEAM_HUMAN)

  81.        

  82. }

  83.  

  84. public plugin_precache()

  85. {

  86.         // Precaching models

  87.         precache_model(sawnoff_model_v)

  88.         precache_model(sawnoff_model_p)

  89.         precache_model(sawnoff_model_w)

  90. }

  91.  

  92. /*================================================================================

  93.  [Main Functions]

  94. =================================================================================*/

  95.  

  96. // Round Start Event

  97. public event_round_start()

  98. {

  99.         // Get all the players

  100.         for(new id = 1; id <= g_MaxPlayers; id++)

  101.         {

  102.                 // Check

  103.                 if(get_pcvar_num(cvar_oneround) || !get_pcvar_num(cvar_enable))

  104.                 {

  105.                         // Striping Sawn Off

  106.                         if(g_sawnoff_shotgun[id])

  107.                         {

  108.                                 g_sawnoff_shotgun[id] = false;

  109.                                 ham_strip_weapon(id, "weapon_m3")

  110.                         }

  111.                 }

  112.         }

  113. }

  114.  

  115. // Message Current Weapon

  116. public message_cur_weapon(msg_id, msg_dest, id)

  117. {

  118.         // Doesn't have a Sawn Off

  119.         if (!g_sawnoff_shotgun[id])

  120.                 return PLUGIN_CONTINUE

  121.        

  122.         // Isn't alive / not active weapon

  123.         if (!is_user_alive(id) || get_msg_arg_int(1) != 1)

  124.                 return PLUGIN_CONTINUE

  125.                

  126.         // Get Weapon Clip

  127.         new clip = get_msg_arg_int(3)

  128.        

  129.         // Update Weapon Array

  130.         g_currentweapon[id] = get_msg_arg_int(2) // get weapon ID

  131.        

  132.         // Weapon isn't M3

  133.         if(g_currentweapon[id] != CSW_M3)

  134.                 return PLUGIN_CONTINUE;

  135.                

  136.         // Replace Models

  137.         entity_set_string(id, EV_SZ_viewmodel, sawnoff_model_v)

  138.         entity_set_string(id, EV_SZ_weaponmodel, sawnoff_model_p)

  139.        

  140.         // Check cvar

  141.         if(get_pcvar_num(cvar_uclip))

  142.         {      

  143.                 // Set Ammo HUD in 8

  144.                 set_msg_arg_int(3, get_msg_argtype(3), 8)

  145.                        

  146.                 // Check clip if more than 2

  147.                 if (clip < 2)

  148.                 {

  149.                         // Update weapon ammo

  150.                         fm_set_weapon_ammo(find_ent_by_owner(-1, "weapon_m3", id), 8)

  151.                 }

  152.         }

  153.        

  154.         return PLUGIN_CONTINUE;

  155. }

  156.  

  157. // Touch fix (when user drop the Sawn off, already has the Sawn off.

  158. public touch_fix(id)

  159. {

  160.         if(g_sawnoff_shotgun[id])

  161.                 g_sawnoff_shotgun[id] = false;

  162. }

  163.  

  164. /*================================================================================

  165.  [Main Forwards]

  166. =================================================================================*/

  167.  

  168. public fw_PlayerKilled(victim, attacker, shouldgib)

  169. {

  170.         // Victim has a Sawn off

  171.         if(g_sawnoff_shotgun[victim])

  172.                 g_sawnoff_shotgun[victim] = false;

  173. }

  174.  

  175. public fw_SetModel(entity, model[])

  176. {

  177.         // Entity is not valid

  178.         if(!is_valid_ent(entity))

  179.                 return FMRES_IGNORED;

  180.                

  181.         // Entity model is not a M3

  182.         if(!equali(model, "models/w_m3.mdl"))

  183.                 return FMRES_IGNORED;

  184.                

  185.         // Get owner and entity classname

  186.         new owner = entity_get_edict(entity, EV_ENT_owner)

  187.         new classname[33]

  188.         entity_get_string(entity, EV_SZ_classname, classname, charsmax(classname))

  189.        

  190.         // Entity classname is a weaponbox

  191.         if(equal(classname, "weaponbox"))

  192.         {

  193.                 // The weapon owner has a Sawn Off

  194.                 if(g_sawnoff_shotgun[owner])

  195.                 {

  196.                         // Striping Sawn off and set New Model

  197.                         g_sawnoff_shotgun[owner] = false;

  198.                         entity_set_model(entity, sawnoff_model_w)

  199.                         set_task(0.1, "touch_fix", owner)

  200.                        

  201.                         return FMRES_SUPERCEDE

  202.                 }

  203.         }

  204.        

  205.         return FMRES_IGNORED

  206.  

  207. }

  208.  

  209. public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)

  210. {

  211.         // Attacker isn't a Player (1 in 32)

  212.         if(!(1 <= attacker <= g_MaxPlayers))

  213.                 return HAM_IGNORED;

  214.                

  215.         // Attacker's weapon isn't a M3

  216.         if(g_currentweapon[attacker] != CSW_M3)

  217.                 return HAM_IGNORED;

  218.                

  219.         // User doesn't have a Sawn Off

  220.         if(!g_sawnoff_shotgun[attacker])

  221.                 return HAM_IGNORED;

  222.                

  223.         SetHamParamFloat(4, damage * get_pcvar_float(cvar_damage) )

  224.        

  225.         return HAM_IGNORED;

  226. }

  227.  

  228. public fw_TraceAttack(victim, attacker, Float:damage, Float:direction[3], tracehandle, damage_type)

  229. {

  230.         // Player is allowed to make a Knockback

  231.         if(!allowed_knockback(victim, attacker))

  232.                 return HAM_IGNORED;

  233.                

  234.         // Check damage type

  235.         if(!(damage_type & DMG_BULLET))

  236.                 return HAM_IGNORED;

  237.                

  238.         // Make Knockback...

  239.         new Float:velocity[3]; pev(victim, pev_velocity, velocity)

  240.         xs_vec_mul_scalar(direction, get_pcvar_float(cvar_knockbackpower), direction)

  241.         xs_vec_add(velocity, direction, direction)

  242.         entity_set_vector(victim, EV_VEC_velocity, direction)

  243.                  

  244.         return HAM_IGNORED;

  245.  

  246. }

  247.  

  248. public pfn_touch(entity, toucher)

  249. {

  250.         new model[33], toucherclass[33], entityclass[33]

  251.        

  252.         // Get toucher Classname

  253.         if((toucher > 0) && is_valid_ent(toucher)) entity_get_string(toucher, EV_SZ_classname, toucherclass, charsmax(toucherclass))

  254.        

  255.         // Get entity Classname

  256.         if((entity > 0) && is_valid_ent(entity)) entity_get_string(entity, EV_SZ_classname, entityclass, charsmax(entityclass))

  257.        

  258.         // Now check if is a Weapon and is a Player

  259.         if(equali(toucherclass, "player") && equali(entityclass, "weaponbox"))

  260.         {

  261.                 // Get Model

  262.                 entity_get_string(entity, EV_SZ_model, model, charsmax(model))

  263.                

  264.                 // Check Model

  265.                 if(equali(model, sawnoff_model_w))

  266.                         if(allowed_touch(toucher)) // Player is allowed to pickup the weapon

  267.                                 g_sawnoff_shotgun[toucher] = true // Set Weapon

  268.         }

  269. }

  270.  

  271. /*================================================================================

  272.  [Internal Functions]

  273. =================================================================================*/

  274.  

  275. allowed_knockback(victim, attacker)

  276. {

  277.         // Obviously, doesn't is allowed to be Knockbacked (WTF)

  278.         if(!g_sawnoff_shotgun[attacker] || !get_pcvar_num(cvar_knockback) || g_currentweapon[attacker] != CSW_M3 || !zp_get_user_zombie(victim))

  279.                 return false;

  280.        

  281.         return true;

  282. }

  283.  

  284. allowed_touch(toucher)

  285. {

  286.         // Can't touch the Weapon

  287.         if(zp_get_user_survivor(toucher) || zp_get_user_zombie(toucher) || fm_get_user_lastprimaryitem(toucher) || g_sawnoff_shotgun[toucher])

  288.                 return false;

  289.                

  290.         return true;

  291. }

  292.  

  293. /*================================================================================

  294.  [Zombie Plague Forwards]

  295. =================================================================================*/

  296.  

  297. public zp_extra_item_selected(id, itemid)

  298. {

  299.         // Item is the Sawn-Off

  300.         if(itemid == g_SawnOff)

  301.         {

  302.                 if(!get_pcvar_num(cvar_enable))

  303.                 {

  304.                         zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + g_SawnOff_Cost)

  305.                         client_print(id, print_chat, "[ZP] The Sawn-Off Shotgun is Disabled")

  306.                        

  307.                         return;

  308.                 }

  309.                

  310.                 // Already has an M3

  311.                 if(g_sawnoff_shotgun[id] && user_has_weapon(id, CSW_M3))

  312.                 {

  313.                         zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + g_SawnOff_Cost)

  314.                         client_print(id, print_chat, "[ZP] You already have a Sawn-Off Shotgun")

  315.                        

  316.                         return;

  317.                 }

  318.                

  319.                 // Array

  320.                 g_sawnoff_shotgun[id] = true

  321.                

  322.                 // Weapon

  323.                 ham_give_weapon(id, "weapon_m3")

  324.                

  325.                 // Message

  326.                 client_print(id, print_chat, "[ZP] You now have a Sawn-Off Shotgun")

  327.                

  328.         }

  329. }

  330.  

  331. public zp_user_infected_post(infected, infector)

  332. {

  333.         // Infected has a M3

  334.         if(g_sawnoff_shotgun[infected])

  335.                 g_sawnoff_shotgun[infected] = false;

  336. }

  337.  

  338. public zp_user_humanized_post(player)

  339. {

  340.         // Is Survivor

  341.         if(zp_get_user_survivor(player) && g_sawnoff_shotgun[player])

  342.                 g_sawnoff_shotgun[player] = false;

  343. }

  344.  

  345. /*================================================================================

  346.  [Stocks]

  347. =================================================================================*/

  348.  

  349. stock ham_give_weapon(id, weapon[])

  350. {

  351.         if(!equal(weapon,"weapon_",7))

  352.                 return 0

  353.  

  354.         new wEnt = create_entity(weapon)

  355.        

  356.         if(!is_valid_ent(wEnt))

  357.                 return 0

  358.  

  359.         entity_set_int(wEnt, EV_INT_spawnflags, SF_NORESPAWN)

  360.         DispatchSpawn(wEnt)

  361.  

  362.         if(!ExecuteHamB(Ham_AddPlayerItem,id,wEnt))

  363.         {

  364.                 if(is_valid_ent(wEnt)) entity_set_int(wEnt, EV_INT_flags, entity_get_int(wEnt, EV_INT_flags) | FL_KILLME)

  365.                 return 0

  366.         }

  367.  

  368.         ExecuteHamB(Ham_Item_AttachToPlayer,wEnt,id)

  369.         return 1

  370. }

  371.  

  372. stock ham_strip_weapon(id, weapon[])

  373. {

  374.         if(!equal(weapon,"weapon_",7))

  375.                 return 0

  376.        

  377.         new wId = get_weaponid(weapon)

  378.        

  379.         if(!wId) return 0

  380.        

  381.         new wEnt

  382.        

  383.         while((wEnt = find_ent_by_class(wEnt, weapon)) && entity_get_edict(wEnt, EV_ENT_owner) != id) {}

  384.        

  385.         if(!wEnt) return 0

  386.        

  387.         if(get_user_weapon(id) == wId)

  388.                 ExecuteHamB(Ham_Weapon_RetireWeapon,wEnt);

  389.        

  390.         if(!ExecuteHamB(Ham_RemovePlayerItem,id,wEnt))

  391.                 return 0

  392.                

  393.         ExecuteHamB(Ham_Item_Kill, wEnt)

  394.        

  395.         entity_set_int(id, EV_INT_weapons, entity_get_int(id, EV_INT_weapons) & ~(1<<wId))

  396.  

  397.         return 1

  398. }  

  399.  

  400. stock fm_set_weapon_ammo(entity, amount)

  401. {

  402.         set_pdata_int(entity, OFFSET_CLIPAMMO, amount, OFFSET_LINUX_WEAPONS);

  403. }

  404.  

  405. stock fm_get_user_lastprimaryitem(id) // Thanks to joaquimandrade

  406. {

  407.         if(get_pdata_cbase(id, OFFSET_LASTPRIMARYITEM) != -1)

  408.                 return 1;

  409.                

  410.         return 0;

  411. }
[/spoiler]

_________________
<<eb@>>Team Website - Közösség
17Buddies - Általam készített pályák.
GameBanana - Általam készített pályák/vágott hangok.

Kép
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Mi a hiba bene?
HozzászólásElküldve:2012.05.27. 20:44 
Offline
Veterán
Avatar

Csatlakozott:2011.06.07. 15:29
Hozzászólások:1728
Megköszönt másnak: 1 alkalommal
Megköszönték neki: 63 alkalommal
És mit kell ezen csinálni?


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Mi a hiba bene?
HozzászólásElküldve:2012.05.27. 21:25 
Offline
Nagyúr
Avatar

Csatlakozott:2011.09.07. 18:41
Hozzászólások:642
Megköszönt másnak: 15 alkalommal
Megköszönték neki: 6 alkalommal
Ezen nincs mit javítani tökéletesen fordítható amxx-é.

_________________
Kép
Kép
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Mi a hiba bene?
HozzászólásElküldve:2012.05.28. 08:19 
Offline
Őskövület
Avatar

Csatlakozott:2011.09.17. 17:54
Hozzászólások:2350
Megköszönt másnak: 40 alkalommal
Megköszönték neki: 57 alkalommal
Igen,csak invalid pluginnak jelzi :D
_____________________________

Try this:

Kód:
  1. #include <amxmodx>

  2. #include <fakemeta_util>

  3. #include <hamsandwich>

  4. #include <zombieplague>

  5.  

  6. /*================================================================================

  7.  [Customization]

  8. =================================================================================*/

  9.  

  10. // Item Cost

  11. new const g_SawnOff_Cost = 40

  12.  

  13. // Models

  14. new const sawnoff_model_v[] = "models/v_sawn_off_shotgun.mdl"

  15. new const sawnoff_model_p[] = "models/p_sawn_off_shotgun.mdl"

  16. new const sawnoff_model_w[] = "models/w_sawn_off_shotgun.mdl"

  17.  

  18. // ---------------------------------------------------------------

  19. // ------------------ Customization ends here!! ------------------

  20. // ---------------------------------------------------------------

  21.  

  22. // Offsets

  23. #if cellbits == 32

  24. const OFFSET_CLIPAMMO = 51

  25. #else

  26. const OFFSET_CLIPAMMO = 65

  27. #endif

  28. const OFFSET_LINUX = 5

  29. const OFFSET_LINUX_WEAPONS = 4

  30. const OFFSET_LASTPRIMARYITEM = 368

  31.  

  32. // Version

  33. #define VERSION "0.3"

  34.  

  35. // Arrays

  36. new g_sawnoff_shotgun[33], g_currentweapon[33]

  37.  

  38. // Variables

  39. new g_SawnOff, g_MaxPlayers

  40.  

  41. // Cvar Pointers

  42. new cvar_enable, cvar_oneround, cvar_knockback, cvar_knockbackpower, cvar_uclip, cvar_damage

  43.  

  44. /*================================================================================

  45.  [Init and Precache]

  46. =================================================================================*/

  47.  

  48. public plugin_init()

  49. {

  50.         // Plugin Info

  51.         register_plugin("[ZP] Extra Item: Sawn-Off Shotgun", VERSION, "meTaLiCroSS")

  52.        

  53.         // Ham Forwards

  54.         RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")

  55.         RegisterHam(Ham_TraceAttack, "player", "fw_TraceAttack")

  56.         RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")

  57.        

  58.         // Fakemeta Forwards

  59.         register_forward(FM_SetModel, "fw_SetModel")

  60.         register_forward(FM_Touch, "fw_Touch")

  61.        

  62.         // Event: Round Start

  63.         register_event("HLTV", "event_round_start", "a", "1=0", "2=0")

  64.        

  65.         // Message: Cur Weapon

  66.         register_message(get_user_msgid("CurWeapon"), "message_cur_weapon")

  67.        

  68.         // CVARS

  69.         register_cvar("zp_extra_sawnoff", VERSION, FCVAR_SERVER|FCVAR_SPONLY)

  70.         cvar_enable = register_cvar("zp_sawnoff_enable", "1")

  71.         cvar_uclip = register_cvar("zp_sawnoff_unlimited_clip", "1")

  72.         cvar_damage = register_cvar("zp_sawnoff_damage_mult", "4.0")

  73.         cvar_oneround = register_cvar("zp_sawnoff_oneround", "1")

  74.         cvar_knockback = register_cvar("zp_sawnoff_knockback", "1")

  75.         cvar_knockbackpower = register_cvar("zp_sawnoff_kbackpower", "10.0")

  76.        

  77.         // Variables

  78.         g_MaxPlayers = get_maxplayers()

  79.         g_SawnOff = zp_register_extra_item("Sawn-Off Shotgun", g_SawnOff_Cost, ZP_TEAM_HUMAN)

  80.        

  81. }

  82.  

  83. public plugin_precache()

  84. {

  85.         // Precaching models

  86.         engfunc(EngFunc_PrecacheModel, sawnoff_model_v)

  87.         engfunc(EngFunc_PrecacheModel, sawnoff_model_p)

  88.         engfunc(EngFunc_PrecacheModel, sawnoff_model_w)

  89. }

  90.  

  91. /*================================================================================

  92.  [Main Functions]

  93. =================================================================================*/

  94.  

  95. // Round Start Event

  96. public event_round_start()

  97. {

  98.         // Get all the players

  99.         for(new id = 1; id <= g_MaxPlayers; id++)

  100.         {

  101.                 // Check

  102.                 if(get_pcvar_num(cvar_oneround) || !get_pcvar_num(cvar_enable))

  103.                 {

  104.                         // Striping Sawn Off

  105.                         if(g_sawnoff_shotgun[id])

  106.                         {

  107.                                 g_sawnoff_shotgun[id] = false;

  108.                                 fm_strip_user_gun(id, CSW_M3)

  109.                         }

  110.                 }

  111.         }

  112. }

  113.  

  114. // Message Current Weapon

  115. public message_cur_weapon(msg_id, msg_dest, id)

  116. {

  117.         // Doesn't have a Sawn Off

  118.         if (!g_sawnoff_shotgun[id])

  119.                 return PLUGIN_CONTINUE

  120.        

  121.         // Isn't alive / not active weapon

  122.         if (!is_user_alive(id) || get_msg_arg_int(1) != 1)

  123.                 return PLUGIN_CONTINUE

  124.                

  125.         // Get Weapon Clip

  126.         new  clip = get_msg_arg_int(3)

  127.        

  128.         // Update Weapon Array

  129.         g_currentweapon[id] = get_msg_arg_int(2) // get weapon ID

  130.        

  131.         // Weapon isn't M3

  132.         if(g_currentweapon[id] != CSW_M3)

  133.                 return PLUGIN_CONTINUE;

  134.                

  135.         // Replace Models

  136.         sawnoff_models(id)

  137.        

  138.         // Check cvar

  139.         if(get_pcvar_num(cvar_uclip))

  140.         {      

  141.                 // Set Ammo HUD in 8

  142.                 set_msg_arg_int(3, get_msg_argtype(3), 8)

  143.                        

  144.                 // Check clip if more than 2

  145.                 if (clip < 2)

  146.                 {

  147.                         // Update weapon ammo

  148.                         new weapon_ent = fm_find_ent_by_owner(-1, "weapon_m3", id)

  149.        

  150.                         fm_set_weapon_ammo(weapon_ent, 8)

  151.                 }

  152.         }

  153.        

  154.         return PLUGIN_CONTINUE;

  155. }

  156.  

  157. // Touch fix (when user drop the Sawn off, already has the Sawn off.

  158. public touch_fix(id)

  159. {

  160.         if(g_sawnoff_shotgun[id])

  161.                 g_sawnoff_shotgun[id] = false;

  162. }

  163.  

  164. /*================================================================================

  165.  [Main Forwards]

  166. =================================================================================*/

  167.  

  168. public fw_PlayerKilled(victim, attacker, shouldgib)

  169. {

  170.         // Victim has a Sawn off

  171.         if(g_sawnoff_shotgun[victim])

  172.         {

  173.                 g_sawnoff_shotgun[victim] = false;

  174.         }

  175. }

  176.  

  177. public fw_SetModel(entity, model[])

  178. {

  179.         // Entity is not valid

  180.         if(!pev_valid(entity))

  181.                 return FMRES_IGNORED;

  182.                

  183.         // Entity model is not a M3

  184.         if(!equali(model, "models/w_m3.mdl"))

  185.                 return FMRES_IGNORED;

  186.                

  187.         // Get owner and entity classname

  188.         new owner = pev(entity, pev_owner)

  189.         new classname[33]; pev(entity, pev_classname, classname, charsmax(classname))

  190.        

  191.         // Entity classname is a weaponbox

  192.         if(equal(classname, "weaponbox"))

  193.         {

  194.                 // The weapon owner has a Sawn Off

  195.                 if(g_sawnoff_shotgun[owner])

  196.                 {

  197.                         // Striping Sawn off and set New Model

  198.                         g_sawnoff_shotgun[owner] = false;

  199.                         engfunc(EngFunc_SetModel, entity, sawnoff_model_w)

  200.                        

  201.                         // client_print(0, print_chat, "model test")

  202.                        

  203.                         set_task(0.1, "touch_fix", owner)

  204.                        

  205.                         return FMRES_SUPERCEDE

  206.                 }

  207.         }

  208.        

  209.         return FMRES_IGNORED

  210.  

  211. }

  212.  

  213. public fw_Touch(entity, toucher)

  214. {

  215.         // Entity is not valid

  216.         if(!pev_valid(entity) || !pev_valid(toucher))

  217.                 return FMRES_IGNORED;

  218.                

  219.         // Get model, toucher classname, and entity classname

  220.         new model[33], toucherclass[33], entityclass[33]

  221.         pev(entity, pev_model, model, charsmax(model))

  222.         pev(entity, pev_classname, entityclass, charsmax(entityclass))

  223.         pev(toucher, pev_classname, toucherclass, charsmax(toucherclass))

  224.        

  225.         // Toucher isn't a Player // Entity isn't a Weapon

  226.         if(!equali(toucherclass, "player") || !equali(entityclass, "weaponbox"))

  227.                 return FMRES_IGNORED;

  228.                

  229.         // Check Model

  230.         if(equali(model, sawnoff_model_w))

  231.         {

  232.                 // Player is allowed to pickup the weapon

  233.                 if(allowed_touch(toucher))

  234.                 {

  235.                         // Set Weapon

  236.                         g_sawnoff_shotgun[toucher] = true;

  237.                         // client_print(0, print_chat, "touch test")

  238.                 }

  239.         }

  240.        

  241.         return FMRES_IGNORED;

  242. }

  243.  

  244. public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)

  245. {

  246.         // Doesn't have a Sawn Off / Attacker's weapon isn't a M3 // Victim is Human

  247.         if( ! ( 1<= victim <= get_maxplayers() ) || ! ( 1<= attacker <= get_maxplayers() )) return HAM_IGNORED;

  248.         if(!g_sawnoff_shotgun[attacker] || g_currentweapon[attacker] != CSW_M3 || !zp_get_user_zombie(victim) || !(1 <= attacker <= g_MaxPlayers))

  249.                 return HAM_IGNORED;

  250.                

  251.         SetHamParamFloat(4, (damage *= get_pcvar_float(cvar_damage)) )

  252.        

  253.         return HAM_IGNORED;

  254. }

  255.  

  256. public fw_TraceAttack(victim, attacker, Float:damage, Float:direction[3], tracehandle, damage_type)

  257. {

  258.         if (!(1 <= attacker <= g_MaxPlayers))

  259.                 return HAM_IGNORED;

  260.  

  261.         // Player is allowed to make a Knockback

  262.         if(!allowed_knockback(victim, attacker))

  263.                 return HAM_IGNORED;

  264.                

  265.         // Check damage type

  266.         if(!(damage_type & DMG_BULLET))

  267.                 return HAM_IGNORED;

  268.                

  269.         new Float:velocity[3]; pev(victim, pev_velocity, velocity)

  270.          

  271.         xs_vec_mul_scalar(direction, get_pcvar_float(cvar_knockbackpower), direction)

  272.          

  273.         xs_vec_add(velocity, direction, direction)

  274.                  

  275.         set_pev(victim, pev_velocity, direction)

  276.                  

  277.         return HAM_IGNORED;

  278.  

  279. }

  280.  

  281. /*================================================================================

  282.  [Internal Functions]

  283. =================================================================================*/

  284.  

  285. sawnoff_models(id)

  286. {

  287.         // Weapon isn't M3 / Alive... / Doesn't have a Sawn Off

  288.         if(g_currentweapon[id] != CSW_M3 || !is_user_alive(id) || !g_sawnoff_shotgun[id])

  289.                 return PLUGIN_CONTINUE;

  290.                

  291.         // Set Models

  292.         set_pev(id, pev_viewmodel2, sawnoff_model_v)

  293.         set_pev(id, pev_weaponmodel2, sawnoff_model_p)

  294.        

  295.         return PLUGIN_CONTINUE;

  296. }

  297.  

  298. allowed_knockback(victim, attacker)

  299. {

  300.         if(!g_sawnoff_shotgun[attacker] || !get_pcvar_num(cvar_knockback) || g_currentweapon[attacker] != CSW_M3 || !zp_get_user_zombie(victim))

  301.                 return false;

  302.        

  303.         return true;

  304. }

  305.  

  306. allowed_touch(toucher)

  307. {

  308.         if(zp_get_user_survivor(toucher) || zp_get_user_zombie(toucher) || fm_get_user_lastprimaryitem(toucher) || g_sawnoff_shotgun[toucher])

  309.                 return false;

  310.                

  311.         return true;

  312. }

  313.  

  314. /*================================================================================

  315.  [Zombie Plague Forwards]

  316. =================================================================================*/

  317.  

  318. public zp_extra_item_selected(id, itemid)

  319. {

  320.         if(itemid == g_SawnOff)

  321.         {

  322.                 if(!get_pcvar_num(cvar_enable))

  323.                 {

  324.                         zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + g_SawnOff_Cost)

  325.                         client_print(id, print_chat, "[ZP] A Fureszelt Shotgun nincs engedelyezve.")

  326.                        

  327.                         return;

  328.                 }

  329.                

  330.                 if(g_sawnoff_shotgun[id] && user_has_weapon(id, CSW_M3))

  331.                 {

  332.                         zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + g_SawnOff_Cost)

  333.                         client_print(id, print_chat, "[ZP] Neked mar van egy Fureszelt Shotgunod !")

  334.                        

  335.                         return;

  336.                 }

  337.                

  338.                 g_sawnoff_shotgun[id] = true

  339.                

  340.                 fm_give_item(id, "weapon_m3")

  341.                

  342.                 for(new i = 0; i <= 5; i++)

  343.                         fm_give_item(id, "ammo_buckshot")

  344.  

  345.                 client_print(id, print_chat, "[ZP] You Sikeresen vettel egy Fureszelt Shotgunt !")

  346.                

  347.         }

  348. }

  349.  

  350. public zp_user_infected_post(infected, infector)

  351. {

  352.         if(g_sawnoff_shotgun[infected])

  353.                 g_sawnoff_shotgun[infected] = false;

  354. }

  355.  

  356. public zp_user_humanized_post(player)

  357. {

  358.         if(zp_get_user_survivor(player) && g_sawnoff_shotgun[player])

  359.                 g_sawnoff_shotgun[player] = false;

  360. }

  361.  

  362. /*================================================================================

  363.  [Stocks]

  364. =================================================================================*/

  365.  

  366. stock fm_set_weapon_ammo(entity, amount)

  367. {

  368.         set_pdata_int(entity, OFFSET_CLIPAMMO, amount, OFFSET_LINUX_WEAPONS);

  369. }

  370.  

  371. stock fm_get_user_lastprimaryitem(id) // Thanks to joaquimandrade

  372. {

  373.         if(get_pdata_cbase(id, OFFSET_LASTPRIMARYITEM) != -1)

  374.                 return true;

  375.                

  376.         return false;

  377. }


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Mi a hiba bene?
HozzászólásElküldve:2012.05.28. 10:46 
Offline
Nagyúr
Avatar

Csatlakozott:2011.09.07. 18:41
Hozzászólások:642
Megköszönt másnak: 15 alkalommal
Megköszönték neki: 6 alkalommal
Nekem fűrészelt soti életemben nem futott le a szerveremen most jut eszembe. XD

_________________
Kép
Kép
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Mi a hiba bene?
HozzászólásElküldve:2012.05.29. 12:44 
Offline
Imperátor
Avatar

Csatlakozott:2009.04.21. 09:33
Hozzászólások:3991
Megköszönt másnak: 5 alkalommal
Megköszönték neki: 135 alkalommal
Fordítsd le a linkelt kódot, és a kész amxxet pakold fel a szerverre, ne pedig azt, amit az sma mellé csatoltak.
Ha nem jó, küld el az error logot, s pls írd le, hogy a feltöltött file mennyit foglal.

_________________
Kód:
I'm back

Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Mi a hiba bene?
HozzászólásElküldve:2012.05.29. 16:18 
Offline
Őskövület
Avatar

Csatlakozott:2011.09.17. 17:54
Hozzászólások:2350
Megköszönt másnak: 40 alkalommal
Megköszönték neki: 57 alkalommal
Metal írta:
Fordítsd le a linkelt kódot, és a kész amxxet pakold fel a szerverre, ne pedig azt, amit az sma mellé csatoltak.
Ha nem jó, küld el az error logot, s pls írd le, hogy a feltöltött file mennyit foglal.

Amit küldtem az már jó (:


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése: Rendezés 
Új téma nyitása Hozzászólás a témához  [7 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 19 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole