hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.05.13. 23:45



Jelenlévő felhasználók

Jelenleg 742 felhasználó van jelen :: 1 regisztrált, 0 rejtett és 741 vendég

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-kor tartózkodott itt.

Regisztrált felhasználók: Bing [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  [ 6 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: zp soti egyik fajta
HozzászólásElküldve: 2013.07.04. 15:05 
Offline
Tud valamit

Csatlakozott: 2013.02.02. 10:59
Hozzászólások: 104
Megköszönt másnak: 7 alkalommal
Megköszönték neki: 1 alkalommal
ebbe mi lehet a gond átirom h 17000 be kerüljön de még is 30 ba kerül it csináljak vele?
SMA Forráskód: [ Mindet kijelol ]
  1. /*================================================================================
  2.  
  3. [ZP] Extra Item: Sawn-Off Shotgun
  4. Copyright (C) 2009 by meTaLiCroSS
  5. Request maded by Clear
  6.  
  7. This program is free software: you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation, either version 3 of the License, or
  10. (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program. If not, see <http://www.gnu.org/licenses/>.
  19.  
  20. In addition, as a special exception, the author gives permission to
  21. link the code of this program with the Half-Life Game Engine ("HL
  22. Engine") and Modified Game Libraries ("MODs") developed by Valve,
  23. L.L.C ("Valve"). You must obey the GNU General Public License in all
  24. respects for all of the code used other than the HL Engine and MODs
  25. from Valve. If you modify this file, you may extend this exception
  26. to your version of the file, but you are not obligated to do so. If
  27. you do not wish to do so, delete this exception statement from your
  28. version.
  29.  
  30. =================================================================================*/
  31.  
  32. #include <amxmodx>
  33. #include <fakemeta>
  34. #include <engine>
  35. #include <hamsandwich>
  36. #include <xs>
  37. #include <zombieplague>
  38.  
  39. /*================================================================================
  40.  [Customization]
  41. =================================================================================*/
  42.  
  43. // Item Cost
  44. new const g_SawnOff_Cost = 15000
  45.  
  46. // Models
  47. new const sawnoff_model_v[] = "models/v_sawn_off_shotgun.mdl"
  48. new const sawnoff_model_p[] = "models/p_sawn_off_shotgun.mdl"
  49. new const sawnoff_model_w[] = "models/w_sawn_off_shotgun.mdl"
  50.  
  51. // ---------------------------------------------------------------
  52. // ------------------ Customization ends here!! ------------------
  53. // ---------------------------------------------------------------
  54.  
  55. // Offsets
  56. #if cellbits == 32
  57. const OFFSET_CLIPAMMO = 51
  58. #else
  59. const OFFSET_CLIPAMMO = 65
  60. #endif
  61. const OFFSET_LINUX = 5
  62. const OFFSET_LINUX_WEAPONS = 4
  63. const OFFSET_LASTPRIMARYITEM = 368
  64.  
  65. // Version
  66. #define VERSION "0.4.5"
  67.  
  68. // Arrays
  69. new g_sawnoff_shotgun[33], g_currentweapon[33]
  70.  
  71. // Variables
  72. new g_SawnOff, g_MaxPlayers
  73.  
  74. // Cvar Pointers
  75. new cvar_enable, cvar_oneround, cvar_knockback, cvar_knockbackpower, cvar_uclip, cvar_damage
  76.  
  77. /*================================================================================
  78.  [Init and Precache]
  79. =================================================================================*/
  80.  
  81. public plugin_init()
  82. {
  83. // Plugin Info
  84. register_plugin("[ZP] Extra Item: Reszelt vegu Shotgun", VERSION, "meTaLiCroSS")
  85.  
  86. // Ham Forwards
  87. RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
  88. RegisterHam(Ham_TraceAttack, "player", "fw_TraceAttack")
  89. RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
  90.  
  91. // Fakemeta Forwards
  92. register_forward(FM_SetModel, "fw_SetModel")
  93.  
  94. // Event: Round Start
  95. register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
  96.  
  97. // Message: Cur Weapon
  98. register_message(get_user_msgid("CurWeapon"), "message_cur_weapon")
  99.  
  100. // CVARS
  101. register_cvar("zp_extra_sawnoff", VERSION, FCVAR_SERVER|FCVAR_SPONLY)
  102. cvar_enable = register_cvar("zp_sawnoff_enable", "1")
  103. cvar_uclip = register_cvar("zp_sawnoff_unlimited_clip", "1")
  104. cvar_damage = register_cvar("zp_sawnoff_damage_mult", "4.0")
  105. cvar_oneround = register_cvar("zp_sawnoff_oneround", "0")
  106. cvar_knockback = register_cvar("zp_sawnoff_knockback", "1")
  107. cvar_knockbackpower = register_cvar("zp_sawnoff_kbackpower", "10.0")
  108.  
  109. // Variables
  110. g_MaxPlayers = get_maxplayers()
  111. g_SawnOff = zp_register_extra_item("Sawn-Off Shotgun", g_SawnOff_Cost, ZP_TEAM_HUMAN)
  112.  
  113. }
  114.  
  115. public plugin_precache()
  116. {
  117. // Precaching models
  118. precache_model(sawnoff_model_v)
  119. precache_model(sawnoff_model_p)
  120. precache_model(sawnoff_model_w)
  121. }
  122.  
  123. /*================================================================================
  124.  [Main Functions]
  125. =================================================================================*/
  126.  
  127. // Round Start Event
  128. public event_round_start()
  129. {
  130. // Get all the players
  131. for(new id = 1; id <= g_MaxPlayers; id++)
  132. {
  133. // Check
  134. if(get_pcvar_num(cvar_oneround) || !get_pcvar_num(cvar_enable))
  135. {
  136. // Striping Sawn Off
  137. if(g_sawnoff_shotgun[id])
  138. {
  139. g_sawnoff_shotgun[id] = false;
  140. ham_strip_weapon(id, "weapon_m3")
  141. }
  142. }
  143. }
  144. }
  145.  
  146. // Message Current Weapon
  147. public message_cur_weapon(msg_id, msg_dest, id)
  148. {
  149. // Doesn't have a Sawn Off
  150. if (!g_sawnoff_shotgun[id])
  151. return PLUGIN_CONTINUE
  152.  
  153. // Isn't alive / not active weapon
  154. if (!is_user_alive(id) || get_msg_arg_int(1) != 1)
  155. return PLUGIN_CONTINUE
  156.  
  157. // Get Weapon Clip
  158. new clip = get_msg_arg_int(3)
  159.  
  160. // Update Weapon Array
  161. g_currentweapon[id] = get_msg_arg_int(2) // get weapon ID
  162.  
  163. // Weapon isn't M3
  164. if(g_currentweapon[id] != CSW_M3)
  165. return PLUGIN_CONTINUE;
  166.  
  167. // Replace Models
  168. entity_set_string(id, EV_SZ_viewmodel, sawnoff_model_v)
  169. entity_set_string(id, EV_SZ_weaponmodel, sawnoff_model_p)
  170.  
  171. // Check cvar
  172. if(get_pcvar_num(cvar_uclip))
  173. {
  174. // Set Ammo HUD in 8
  175. set_msg_arg_int(3, get_msg_argtype(3), 8)
  176.  
  177. // Check clip if more than 2
  178. if (clip < 2)
  179. {
  180. // Update weapon ammo
  181. fm_set_weapon_ammo(find_ent_by_owner(-1, "weapon_m3", id), 8)
  182. }
  183. }
  184.  
  185. return PLUGIN_CONTINUE;
  186. }
  187.  
  188. // Touch fix (when user drop the Sawn off, already has the Sawn off.
  189. public touch_fix(id)
  190. {
  191. if(g_sawnoff_shotgun[id])
  192. g_sawnoff_shotgun[id] = false;
  193. }
  194.  
  195. /*================================================================================
  196.  [Main Forwards]
  197. =================================================================================*/
  198.  
  199. public fw_PlayerKilled(victim, attacker, shouldgib)
  200. {
  201. // Victim has a Sawn off
  202. if(g_sawnoff_shotgun[victim])
  203. g_sawnoff_shotgun[victim] = false;
  204. }
  205.  
  206. public fw_SetModel(entity, model[])
  207. {
  208. // Entity is not valid
  209. if(!is_valid_ent(entity))
  210. return FMRES_IGNORED;
  211.  
  212. // Entity model is not a M3
  213. if(!equali(model, "models/w_m3.mdl"))
  214. return FMRES_IGNORED;
  215.  
  216. // Get owner and entity classname
  217. new owner = entity_get_edict(entity, EV_ENT_owner)
  218. new classname[33]
  219. entity_get_string(entity, EV_SZ_classname, classname, charsmax(classname))
  220.  
  221. // Entity classname is a weaponbox
  222. if(equal(classname, "weaponbox"))
  223. {
  224. // The weapon owner has a Sawn Off
  225. if(g_sawnoff_shotgun[owner])
  226. {
  227. // Striping Sawn off and set New Model
  228. g_sawnoff_shotgun[owner] = false;
  229. entity_set_model(entity, sawnoff_model_w)
  230. set_task(0.1, "touch_fix", owner)
  231.  
  232. return FMRES_SUPERCEDE
  233. }
  234. }
  235.  
  236. return FMRES_IGNORED
  237.  
  238. }
  239.  
  240. public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
  241. {
  242. // Attacker isn't a Player (1 in 32)
  243. if(!(1 <= attacker <= g_MaxPlayers))
  244. return HAM_IGNORED;
  245.  
  246. // Attacker's weapon isn't a M3
  247. if(g_currentweapon[attacker] != CSW_M3)
  248. return HAM_IGNORED;
  249.  
  250. // User doesn't have a Sawn Off
  251. if(!g_sawnoff_shotgun[attacker])
  252. return HAM_IGNORED;
  253.  
  254. SetHamParamFloat(4, damage * get_pcvar_float(cvar_damage) )
  255.  
  256. return HAM_IGNORED;
  257. }
  258.  
  259. public fw_TraceAttack(victim, attacker, Float:damage, Float:direction[3], tracehandle, damage_type)
  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. // Make Knockback...
  270. new Float:velocity[3]; pev(victim, pev_velocity, velocity)
  271. xs_vec_mul_scalar(direction, get_pcvar_float(cvar_knockbackpower), direction)
  272. xs_vec_add(velocity, direction, direction)
  273. entity_set_vector(victim, EV_VEC_velocity, direction)
  274.  
  275. return HAM_IGNORED;
  276.  
  277. }
  278.  
  279. public pfn_touch(entity, toucher)
  280. {
  281. new model[33], toucherclass[33], entityclass[33]
  282.  
  283. // Get toucher Classname
  284. if((toucher > 0) && is_valid_ent(toucher)) entity_get_string(toucher, EV_SZ_classname, toucherclass, charsmax(toucherclass))
  285.  
  286. // Get entity Classname
  287. if((entity > 0) && is_valid_ent(entity)) entity_get_string(entity, EV_SZ_classname, entityclass, charsmax(entityclass))
  288.  
  289. // Now check if is a Weapon and is a Player
  290. if(equali(toucherclass, "player") && equali(entityclass, "weaponbox"))
  291. {
  292. // Get Model
  293. entity_get_string(entity, EV_SZ_model, model, charsmax(model))
  294.  
  295. // Check Model
  296. if(equali(model, sawnoff_model_w))
  297. if(allowed_touch(toucher)) // Player is allowed to pickup the weapon
  298. g_sawnoff_shotgun[toucher] = true // Set Weapon
  299. }
  300. }
  301.  
  302. /*================================================================================
  303.  [Internal Functions]
  304. =================================================================================*/
  305.  
  306. allowed_knockback(victim, attacker)
  307. {
  308. // Obviously, doesn't is allowed to be Knockbacked (WTF)
  309. if(!g_sawnoff_shotgun[attacker] || !get_pcvar_num(cvar_knockback) || g_currentweapon[attacker] != CSW_M3 || !zp_get_user_zombie(victim))
  310. return false;
  311.  
  312. return true;
  313. }
  314.  
  315. allowed_touch(toucher)
  316. {
  317. // Can't touch the Weapon
  318. if(zp_get_user_survivor(toucher) || zp_get_user_zombie(toucher) || fm_get_user_lastprimaryitem(toucher) || g_sawnoff_shotgun[toucher])
  319. return false;
  320.  
  321. return true;
  322. }
  323.  
  324. /*================================================================================
  325.  [Zombie Plague Forwards]
  326. =================================================================================*/
  327.  
  328. public zp_extra_item_selected(id, itemid)
  329. {
  330. // Item is the Sawn-Off
  331. if(itemid == g_SawnOff)
  332. {
  333. if(!get_pcvar_num(cvar_enable))
  334. {
  335. zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + g_SawnOff_Cost)
  336. client_print(id, print_chat, "[ZP] The Sawn-Off Shotgun is Disabled")
  337.  
  338. return;
  339. }
  340.  
  341. // Already has an M3
  342. if(g_sawnoff_shotgun[id] && user_has_weapon(id, CSW_M3))
  343. {
  344. zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + g_SawnOff_Cost)
  345. client_print(id, print_chat, "[ZP] You already have a Sawn-Off Shotgun")
  346.  
  347. return;
  348. }
  349.  
  350. // Array
  351. g_sawnoff_shotgun[id] = true
  352.  
  353. // Weapon
  354. ham_give_weapon(id, "weapon_m3")
  355.  
  356. // Message
  357. client_print(id, print_chat, "[ZP] You now have a Sawn-Off Shotgun")
  358.  
  359. }
  360. }
  361.  
  362. public zp_user_infected_post(infected, infector)
  363. {
  364. // Infected has a M3
  365. if(g_sawnoff_shotgun[infected])
  366. g_sawnoff_shotgun[infected] = false;
  367. }
  368.  
  369. public zp_user_humanized_post(player)
  370. {
  371. // Is Survivor
  372. if(zp_get_user_survivor(player) && g_sawnoff_shotgun[player])
  373. g_sawnoff_shotgun[player] = false;
  374. }
  375.  
  376. /*================================================================================
  377.  [Stocks]
  378. =================================================================================*/
  379.  
  380. stock ham_give_weapon(id, weapon[])
  381. {
  382. if(!equal(weapon,"weapon_",7))
  383. return 0
  384.  
  385. new wEnt = create_entity(weapon)
  386.  
  387. if(!is_valid_ent(wEnt))
  388. return 0
  389.  
  390. entity_set_int(wEnt, EV_INT_spawnflags, SF_NORESPAWN)
  391. DispatchSpawn(wEnt)
  392.  
  393. if(!ExecuteHamB(Ham_AddPlayerItem,id,wEnt))
  394. {
  395. if(is_valid_ent(wEnt)) entity_set_int(wEnt, EV_INT_flags, entity_get_int(wEnt, EV_INT_flags) | FL_KILLME)
  396. return 0
  397. }
  398.  
  399. ExecuteHamB(Ham_Item_AttachToPlayer,wEnt,id)
  400. return 1
  401. }
  402.  
  403. stock ham_strip_weapon(id, weapon[])
  404. {
  405. if(!equal(weapon,"weapon_",7))
  406. return 0
  407.  
  408. new wId = get_weaponid(weapon)
  409.  
  410. if(!wId) return 0
  411.  
  412. new wEnt
  413.  
  414. while((wEnt = find_ent_by_class(wEnt, weapon)) && entity_get_edict(wEnt, EV_ENT_owner) != id) {}
  415.  
  416. if(!wEnt) return 0
  417.  
  418. if(get_user_weapon(id) == wId)
  419. ExecuteHamB(Ham_Weapon_RetireWeapon,wEnt);
  420.  
  421. if(!ExecuteHamB(Ham_RemovePlayerItem,id,wEnt))
  422. return 0
  423.  
  424. ExecuteHamB(Ham_Item_Kill, wEnt)
  425.  
  426. entity_set_int(id, EV_INT_weapons, entity_get_int(id, EV_INT_weapons) & ~(1<<wId))
  427.  
  428. return 1
  429. }
  430.  
  431. stock fm_set_weapon_ammo(entity, amount)
  432. {
  433. set_pdata_int(entity, OFFSET_CLIPAMMO, amount, OFFSET_LINUX_WEAPONS);
  434. }
  435.  
  436. stock fm_get_user_lastprimaryitem(id) // Thanks to joaquimandrade
  437. {
  438. if(get_pdata_cbase(id, OFFSET_LASTPRIMARYITEM) != -1)
  439. return 1;
  440.  
  441. return 0;
  442. }
  443.  

_________________
Megköszöni valamit sose szégyen!!!


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: zp soti egyik fajta
HozzászólásElküldve: 2013.07.04. 15:09 
Offline
Őskövület
Avatar

Csatlakozott: 2012.03.22. 18:22
Hozzászólások: 2978
Megköszönt másnak: 115 alkalommal
Megköszönték neki: 368 alkalommal
nem értek nagyon zp-hez de nem ezt kell átírni?:

Kód:
new const g_SawnOff_Cost = 15000

_________________
Blasenkampfwagen

https://discord.gg/uBYnNnZP
GTA:PURSUIT MTA


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: zp soti egyik fajta
HozzászólásElküldve: 2013.07.04. 15:21 
Offline
Tud valamit

Csatlakozott: 2013.02.02. 10:59
Hozzászólások: 104
Megköszönt másnak: 7 alkalommal
Megköszönték neki: 1 alkalommal
ultraibolya írta:
nem értek nagyon zp-hez de nem ezt kell átírni?:

Kód:
new const g_SawnOff_Cost = 15000

azt atalitotam akk is 30 ba kerul..:)

_________________
Megköszöni valamit sose szégyen!!!


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: zp soti egyik fajta
HozzászólásElküldve: 2013.07.04. 15:22 
Offline
Félisten

Csatlakozott: 2012.06.19. 15:12
Hozzászólások: 926
Megköszönt másnak: 109 alkalommal
Megköszönték neki: 31 alkalommal
Scremo írta:
ultraibolya írta:
nem értek nagyon zp-hez de nem ezt kell átírni?:

Kód:
new const g_SawnOff_Cost = 15000

azt atalitotam akk is 30 ba kerul..:)


Állitsd át az ini-fájlba

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: zp soti egyik fajta
HozzászólásElküldve: 2013.07.04. 15:51 
Offline
Tud valamit

Csatlakozott: 2013.02.02. 10:59
Hozzászólások: 104
Megköszönt másnak: 7 alkalommal
Megköszönték neki: 1 alkalommal
Tomos írta:
Scremo írta:
ultraibolya írta:
nem értek nagyon zp-hez de nem ezt kell átírni?:

Kód:
new const g_SawnOff_Cost = 15000

azt atalitotam akk is 30 ba kerul..:)


Állitsd át az ini-fájlba


nincs is hozzá ini file :: ) xD

_________________
Megköszöni valamit sose szégyen!!!


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: zp soti egyik fajta
HozzászólásElküldve: 2013.07.04. 16:10 
Offline
Jómunkásember
Avatar

Csatlakozott: 2012.08.24. 19:42
Hozzászólások: 320
Megköszönt másnak: 11 alkalommal
Megköszönték neki: 30 alkalommal
zp_extraitems.ini


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  [ 6 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 3 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