hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.05.24. 17:03



Jelenlévő felhasználók

Jelenleg 321 felhasználó van jelen :: 2 regisztrált, 0 rejtett és 319 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], 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: Gitár fegyver
HozzászólásElküldve: 2013.02.23. 16:33 
Helló!

Valaki javítaná, mert a tárnál 0-át jelez?
Megköszönném a segítséget

SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <engine>
  3. #include <fakemeta>
  4. #include <fun>
  5. #include <hamsandwich>
  6. #include <xs>
  7. #include <cstrike>
  8. enum
  9. {
  10. anim_idle,
  11. anim_reload,
  12. anim_draw,
  13. anim_shoot1,
  14. anim_shoot2,
  15. anim_shoot3
  16. }
  17.  
  18. #define ENG_NULLENT -1
  19. #define EV_INT_WEAPONKEY EV_INT_impulse
  20. #define guitar_WEAPONKEY 901
  21. #define MAX_PLAYERS 32
  22. #define IsValidUser(%1) (1 <= %1 <= g_MaxPlayers)
  23.  
  24. const USE_STOPPED = 0
  25. const OFFSET_ACTIVE_ITEM = 373
  26. const OFFSET_WEAPONOWNER = 41
  27. const OFFSET_LINUX = 5
  28. const OFFSET_LINUX_WEAPONS = 4
  29.  
  30. #define WEAP_LINUX_XTRA_OFF 4
  31. #define m_fKnown 44
  32. #define m_flNextPrimaryAttack 46
  33. #define m_flTimeWeaponIdle 48
  34. #define m_iClip 51
  35. #define m_fInReload 54
  36. #define PLAYER_LINUX_XTRA_OFF 5
  37. #define m_flNextAttack 83
  38.  
  39. #define guitar_RELOAD_TIME 2.5
  40.  
  41. new gmsgWeaponList
  42.  
  43. const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)
  44. new const WEAPONENTNAMES[][] = { "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10",
  45. "weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550",
  46. "weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249",
  47. "weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552",
  48. "weapon_ak47", "weapon_knife", "weapon_p90" }
  49. new const Fire_Sounds[][] = { "weapons/gt-1.wav" }
  50. new const Sound_Zoom[] = { "weapons/zoom.wav" }
  51. new const GUNSHOT_DECALS[] = { 41, 42, 43, 44, 45 }
  52. new guitar_V_MODEL[64] = "models/cs16t3am_models/v_gitar_uj.mdl"
  53. new guitar_P_MODEL[64] = "models/cs16t3am_models/p_gitar_uj.mdl"
  54. new guitar_W_MODEL[64] = "models/cs16t3am_models/w_gitar_uj.mdl"
  55. new cvar_dmg_guitar, cvar_recoil_guitar, g_itemid_guitar, cvar_clip_guitar, cvar_guitar_ammo
  56. new g_has_guitar[33]
  57. new g_MaxPlayers, g_orig_event_guitar, g_clip_ammo[33]
  58. new Float:cl_pushangle[MAX_PLAYERS + 1][3], m_iBlood[2]
  59. new g_guitar_TmpClip[33], oldweap[33]
  60. new bool:MsgSayText,msg[128]
  61.  
  62. public plugin_init()
  63. {
  64. register_plugin("Guitar", "1.0", "Crock / =)")
  65. register_message(get_user_msgid("DeathMsg"), "message_DeathMsg")
  66. register_event("CurWeapon","CurrentWeapon","be","1=1")
  67. RegisterHam(Ham_Item_AddToPlayer, "weapon_galil", "fw_guitar_AddToPlayer")
  68. RegisterHam(Ham_Use, "func_tank", "fw_UseStationary_Post", 1)
  69. RegisterHam(Ham_Use, "func_tankmortar", "fw_UseStationary_Post", 1)
  70. RegisterHam(Ham_Use, "func_tankrocket", "fw_UseStationary_Post", 1)
  71. RegisterHam(Ham_Use, "func_tanklaser", "fw_UseStationary_Post", 1)
  72. for (new i = 1; i < sizeof WEAPONENTNAMES; i++)
  73. if (WEAPONENTNAMES[i][0]) RegisterHam(Ham_Item_Deploy, WEAPONENTNAMES[i], "fw_Item_Deploy_Post", 1)
  74. RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_galil", "fw_guitar_PrimaryAttack")
  75. RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_galil", "fw_guitar_PrimaryAttack_Post", 1)
  76. RegisterHam(Ham_Item_PostFrame, "weapon_galil", "guitar__ItemPostFrame");
  77. RegisterHam(Ham_Weapon_Reload, "weapon_galil", "guitar__Reload");
  78. RegisterHam(Ham_Weapon_Reload, "weapon_galil", "guitar__Reload_Post", 1);
  79. RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
  80. register_forward(FM_SetModel, "fw_SetModel")
  81. register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1)
  82. register_forward(FM_PlaybackEvent, "fwPlaybackEvent")
  83.  
  84. cvar_dmg_guitar = register_cvar("zp_guitar_dmg", "1.5")
  85. cvar_recoil_guitar = register_cvar("zp_guitar_recoil", "0.4")
  86. cvar_clip_guitar = register_cvar("zp_guitar_clip", "45")
  87. cvar_guitar_ammo = register_cvar("zp_guitar_ammo", "150")
  88.  
  89. register_clcmd("say /gitar", "gitar")
  90. register_clcmd("weapon_gitar", "weapon_hook")
  91. g_MaxPlayers = get_maxplayers()
  92. gmsgWeaponList = get_user_msgid("WeaponList")
  93. }
  94.  
  95. public plugin_precache()
  96. {
  97. precache_model(guitar_V_MODEL)
  98. precache_model(guitar_P_MODEL)
  99. precache_model(guitar_W_MODEL)
  100. precache_sound(Sound_Zoom)
  101. precache_sound(Fire_Sounds[0])
  102. precache_sound("weapons/gt_clipin.wav")
  103. precache_sound("weapons/gt_clipon.wav")
  104. precache_sound("weapons/gt_clipout.wav")
  105. precache_sound("weapons/gt_draw.wav")
  106. m_iBlood[0] = precache_model("sprites/blood.spr")
  107. m_iBlood[1] = precache_model("sprites/bloodspray.spr")
  108. precache_model("sprites/640hud5.spr")
  109. register_forward(FM_PrecacheEvent, "fwPrecacheEvent_Post", 1)
  110. precache_generic( "sprites/weapon_gitar.txt")
  111. precache_generic( "sprites/w_gitar.spr")
  112.  
  113. }
  114.  
  115. public weapon_hook(id)
  116. {
  117. engclient_cmd(id, "weapon_galil")
  118. return PLUGIN_HANDLED;
  119. }
  120. public plugin_natives ()
  121. {
  122. register_native("give_weapon_gui", "native_give_weapon_add", 1)
  123. }
  124. public native_give_weapon_add(id)
  125. {
  126. give_guitar(id)
  127. }
  128.  
  129. public fwPrecacheEvent_Post(type, const name[])
  130. {
  131. if (equal("events/galil.sc", name))
  132. {
  133. g_orig_event_guitar = get_orig_retval()
  134. return FMRES_HANDLED
  135. }
  136.  
  137. return FMRES_IGNORED
  138. }
  139.  
  140. public client_connect(id)
  141. {
  142. g_has_guitar[id] = false
  143. }
  144.  
  145. public client_disconnect(id)
  146. {
  147. g_has_guitar[id] = false
  148. }
  149.  
  150. public fw_SetModel(entity, model[])
  151. {
  152. if(!is_valid_ent(entity))
  153. return FMRES_IGNORED;
  154.  
  155. static szClassName[33]
  156. entity_get_string(entity, EV_SZ_classname, szClassName, charsmax(szClassName))
  157.  
  158. if(!equal(szClassName, "weaponbox"))
  159. return FMRES_IGNORED;
  160.  
  161. static iOwner
  162.  
  163. iOwner = entity_get_edict(entity, EV_ENT_owner)
  164.  
  165. if(equal(model, "models/w_galil.mdl"))
  166. {
  167. static iStoredSVDID
  168.  
  169. iStoredSVDID = find_ent_by_owner(ENG_NULLENT, "weapon_galil", entity)
  170.  
  171. if(!is_valid_ent(iStoredSVDID))
  172. return FMRES_IGNORED;
  173.  
  174. if(g_has_guitar[iOwner])
  175. {
  176. entity_set_int(iStoredSVDID, EV_INT_WEAPONKEY, guitar_WEAPONKEY)
  177. g_has_guitar[iOwner] = false
  178.  
  179. entity_set_model(entity, guitar_W_MODEL)
  180.  
  181. return FMRES_SUPERCEDE;
  182. }
  183. }
  184.  
  185.  
  186. return FMRES_IGNORED;
  187. }
  188.  
  189. public give_guitar(id)
  190. {
  191. drop_weapons(id, 1);
  192. new iWep2 = give_item(id,"weapon_galil")
  193. if( iWep2 > 0 )
  194. {
  195. cs_set_weapon_ammo(iWep2, get_pcvar_num(cvar_clip_guitar))
  196. cs_set_user_bpammo(id, CSW_GALIL, get_pcvar_num(cvar_guitar_ammo))
  197.  
  198. message_begin(MSG_ONE, gmsgWeaponList, _, id)
  199. write_string("weapon_gitar")
  200. write_byte(1)
  201. write_byte(30)
  202. write_byte(-1)
  203. write_byte(-1)
  204. write_byte(0)
  205. write_byte(2)
  206. write_byte(CSW_GALIL)
  207. message_end()
  208. }
  209. g_has_guitar[id] = true;
  210. }
  211.  
  212. public gitar(id, itemid)
  213. {
  214. if ((!(get_user_flags(id) & ADMIN_LEVEL_H)))
  215. {
  216. client_print(id, print_center, "Ezt a fegyvert csak VIP hasznalhatja")
  217. message_begin(MSG_ONE,MsgSayText,{0,0,0},id)
  218. write_byte(id)
  219. write_string(msg)
  220. message_end()
  221. return PLUGIN_HANDLED
  222. }
  223. if(itemid == g_itemid_guitar)
  224. {
  225. give_guitar(id)
  226. }
  227. }
  228.  
  229. public fw_guitar_AddToPlayer(guitar, id)
  230. {
  231. if(!is_valid_ent(guitar) || !is_user_connected(id))
  232. return HAM_IGNORED;
  233.  
  234. if(entity_get_int(guitar, EV_INT_WEAPONKEY) == guitar_WEAPONKEY)
  235. {
  236. g_has_guitar[id] = true
  237. entity_set_int(guitar, EV_INT_WEAPONKEY, 0)
  238.  
  239. message_begin(MSG_ONE, gmsgWeaponList, {0,0,0}, id)
  240. write_string("weapon_gitar")
  241. write_byte(1)
  242. write_byte(30)
  243. write_byte(-1)
  244. write_byte(-1)
  245. write_byte(0)
  246. write_byte(2)
  247. write_byte(CSW_GALIL)
  248. message_end()
  249.  
  250. return HAM_HANDLED;
  251. }
  252. else
  253. {
  254. message_begin(MSG_ONE, gmsgWeaponList, {0,0,0}, id)
  255. write_string("weapon_galil")
  256. write_byte(1)
  257. write_byte(30)
  258. write_byte(-1)
  259. write_byte(-1)
  260. write_byte(0)
  261. write_byte(2)
  262. write_byte(CSW_GALIL)
  263. message_end()
  264. }
  265. return HAM_IGNORED;
  266. }
  267.  
  268. public fw_UseStationary_Post(entity, caller, activator, use_type)
  269. {
  270. if (use_type == USE_STOPPED && is_user_connected(caller))
  271. replace_weapon_models(caller, get_user_weapon(caller))
  272. }
  273.  
  274. public fw_Item_Deploy_Post(weapon_ent)
  275. {
  276. static owner
  277. owner = fm_cs_get_weapon_ent_owner(weapon_ent)
  278.  
  279. static weaponid
  280. weaponid = cs_get_weapon_id(weapon_ent)
  281.  
  282. replace_weapon_models(owner, weaponid)
  283. }
  284.  
  285. public CurrentWeapon(id)
  286. {
  287. replace_weapon_models(id, read_data(2))
  288. if((g_has_guitar[id]) && (get_user_weapon(id) == CSW_GALIL)){
  289. if(!(get_user_flags(id) & ADMIN_LEVEL_H))
  290. {
  291. client_print(id, print_center, "Ezt a fegyvert csak VIP hasznalhatja")
  292. client_cmd(id, "drop")
  293. }
  294. }
  295. }
  296.  
  297. replace_weapon_models(id, weaponid)
  298. {
  299. switch (weaponid)
  300. {
  301. case CSW_GALIL:
  302. {
  303. new CsTeams:userTeam = cs_get_user_team(id)
  304. if (userTeam == CS_TEAM_CT & CS_TEAM_T & CS_TEAM_SPECTATOR)
  305. return
  306.  
  307. if(g_has_guitar[id])
  308. {
  309. set_pev(id, pev_viewmodel2, guitar_V_MODEL)
  310. set_pev(id, pev_weaponmodel2, guitar_P_MODEL)
  311. if(oldweap[id] != CSW_GALIL)
  312. {
  313. message_begin(MSG_ONE, gmsgWeaponList, _, id)
  314.  
  315.  
  316. }
  317. }
  318. }
  319. }
  320. oldweap[id] = weaponid
  321. }
  322.  
  323. public fw_UpdateClientData_Post(Player, SendWeapons, CD_Handle)
  324. {
  325. if(!is_user_alive(Player) || (get_user_weapon(Player) != CSW_GALIL) || !g_has_guitar[Player])
  326. return FMRES_IGNORED
  327.  
  328. set_cd(CD_Handle, CD_flNextAttack, halflife_time () + 0.001)
  329. return FMRES_HANDLED
  330. }
  331.  
  332. public fw_guitar_PrimaryAttack(Weapon)
  333. {
  334. new Player = get_pdata_cbase(Weapon, 41, 4)
  335.  
  336. if (!g_has_guitar[Player])
  337. return;
  338.  
  339. pev(Player,pev_punchangle,cl_pushangle[Player])
  340.  
  341. g_clip_ammo[Player] = cs_get_weapon_ammo(Weapon)
  342. }
  343.  
  344. public fwPlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2)
  345. {
  346. if ((eventid != g_orig_event_guitar))
  347. return FMRES_IGNORED
  348. if (!(1 <= invoker <= g_MaxPlayers))
  349. return FMRES_IGNORED
  350.  
  351. playback_event(flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2)
  352. return FMRES_SUPERCEDE
  353. }
  354.  
  355. public fw_guitar_PrimaryAttack_Post(Weapon)
  356. {
  357. new Player = get_pdata_cbase(Weapon, 41, 4)
  358.  
  359. new szClip, szAmmo
  360. get_user_weapon(Player, szClip, szAmmo)
  361. if(Player > 0 && Player < 33)
  362. {
  363. if(!g_has_guitar[Player])
  364. {
  365. if(szClip > 0) emit_sound(Player, CHAN_WEAPON, "weapons/galil-1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  366. }
  367. if(g_has_guitar[Player])
  368. {
  369. new Float:push[3]
  370. pev(Player,pev_punchangle,push)
  371. xs_vec_sub(push,cl_pushangle[Player],push)
  372.  
  373. xs_vec_mul_scalar(push,get_pcvar_float(cvar_recoil_guitar),push)
  374. xs_vec_add(push,cl_pushangle[Player],push)
  375. set_pev(Player,pev_punchangle,push)
  376.  
  377. if (!g_clip_ammo[Player])
  378. return
  379.  
  380. emit_sound(Player, CHAN_WEAPON, Fire_Sounds[0], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  381. UTIL_PlayWeaponAnimation(Player, anim_shoot1)
  382.  
  383. make_blood_and_bulletholes(Player)
  384. }
  385. }
  386. }
  387.  
  388. public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
  389. {
  390. if (victim != attacker && is_user_connected(attacker))
  391. {
  392. if(get_user_weapon(attacker) == CSW_GALIL)
  393. {
  394. if(g_has_guitar[attacker])
  395. SetHamParamFloat(4, damage * get_pcvar_float(cvar_dmg_guitar))
  396. }
  397. }
  398. }
  399.  
  400. public message_DeathMsg(msg_id, msg_dest, id)
  401. {
  402. static szTruncatedWeapon[33], iAttacker, iVictim
  403.  
  404. get_msg_arg_string(4, szTruncatedWeapon, charsmax(szTruncatedWeapon))
  405.  
  406. iAttacker = get_msg_arg_int(1)
  407. iVictim = get_msg_arg_int(2)
  408.  
  409. if(!is_user_connected(iAttacker) || iAttacker == iVictim)
  410. return PLUGIN_CONTINUE
  411.  
  412. if(equal(szTruncatedWeapon, "galil") && get_user_weapon(iAttacker) == CSW_GALIL)
  413. {
  414. if(g_has_guitar[iAttacker])
  415. set_msg_arg_string(4, "gitar")
  416. }
  417.  
  418. return PLUGIN_CONTINUE
  419. }
  420.  
  421. stock fm_cs_get_current_weapon_ent(id)
  422. {
  423. return get_pdata_cbase(id, OFFSET_ACTIVE_ITEM, OFFSET_LINUX);
  424. }
  425.  
  426. stock fm_cs_get_weapon_ent_owner(ent)
  427. {
  428. return get_pdata_cbase(ent, OFFSET_WEAPONOWNER, OFFSET_LINUX_WEAPONS);
  429. }
  430.  
  431. stock UTIL_PlayWeaponAnimation(const Player, const Sequence)
  432. {
  433. set_pev(Player, pev_weaponanim, Sequence)
  434.  
  435. message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, .player = Player)
  436. write_byte(Sequence)
  437. write_byte(pev(Player, pev_body))
  438. message_end()
  439. }
  440.  
  441. stock make_blood_and_bulletholes(id)
  442. {
  443. new aimOrigin[3], target, body
  444. get_user_origin(id, aimOrigin, 3)
  445. get_user_aiming(id, target, body)
  446.  
  447. if(target > 0 && target <= g_MaxPlayers && cs_get_user_team(target))
  448. {
  449. new Float:fStart[3], Float:fEnd[3], Float:fRes[3], Float:fVel[3]
  450. pev(id, pev_origin, fStart)
  451.  
  452. velocity_by_aim(id, 64, fVel)
  453.  
  454. fStart[0] = float(aimOrigin[0])
  455. fStart[1] = float(aimOrigin[1])
  456. fStart[2] = float(aimOrigin[2])
  457. fEnd[0] = fStart[0]+fVel[0]
  458. fEnd[1] = fStart[1]+fVel[1]
  459. fEnd[2] = fStart[2]+fVel[2]
  460.  
  461. new res
  462. engfunc(EngFunc_TraceLine, fStart, fEnd, 0, target, res)
  463. get_tr2(res, TR_vecEndPos, fRes)
  464.  
  465. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  466. write_byte(TE_BLOODSPRITE)
  467. write_coord(floatround(fStart[0]))
  468. write_coord(floatround(fStart[1]))
  469. write_coord(floatround(fStart[2]))
  470. write_short( m_iBlood [ 1 ])
  471. write_short( m_iBlood [ 0 ] )
  472. write_byte(70)
  473. write_byte(random_num(1,2))
  474. message_end()
  475.  
  476.  
  477. }
  478. else if(!is_user_connected(target))
  479. {
  480. if(target)
  481. {
  482. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  483. write_byte(TE_DECAL)
  484. write_coord(aimOrigin[0])
  485. write_coord(aimOrigin[1])
  486. write_coord(aimOrigin[2])
  487. write_byte(GUNSHOT_DECALS[random_num ( 0, sizeof GUNSHOT_DECALS -1 ) ] )
  488. write_short(target)
  489. message_end()
  490. }
  491. else
  492. {
  493. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  494. write_byte(TE_WORLDDECAL)
  495. write_coord(aimOrigin[0])
  496. write_coord(aimOrigin[1])
  497. write_coord(aimOrigin[2])
  498. write_byte(GUNSHOT_DECALS[random_num ( 0, sizeof GUNSHOT_DECALS -1 ) ] )
  499. message_end()
  500. }
  501.  
  502. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  503. write_byte(TE_GUNSHOTDECAL)
  504. write_coord(aimOrigin[0])
  505. write_coord(aimOrigin[1])
  506. write_coord(aimOrigin[2])
  507. write_short(id)
  508. write_byte(GUNSHOT_DECALS[random_num ( 0, sizeof GUNSHOT_DECALS -1 ) ] )
  509. message_end()
  510. }
  511. }
  512.  
  513. public guitar__ItemPostFrame(weapon_entity) {
  514. new id = pev(weapon_entity, pev_owner)
  515. if (!is_user_connected(id))
  516. return HAM_IGNORED;
  517.  
  518. if (!g_has_guitar[id])
  519. return HAM_IGNORED;
  520.  
  521. new Float:flNextAttack = get_pdata_float(id, m_flNextAttack, PLAYER_LINUX_XTRA_OFF)
  522.  
  523. new iBpAmmo = cs_get_user_bpammo(id, CSW_GALIL);
  524. new iClip = get_pdata_int(weapon_entity, m_iClip, WEAP_LINUX_XTRA_OFF)
  525.  
  526. new fInReload = get_pdata_int(weapon_entity, m_fInReload, WEAP_LINUX_XTRA_OFF)
  527.  
  528. if( fInReload && flNextAttack <= 0.0 )
  529. {
  530. new j = min(get_pcvar_num(cvar_clip_guitar) - iClip, iBpAmmo)
  531.  
  532. set_pdata_int(weapon_entity, m_iClip, iClip + j, WEAP_LINUX_XTRA_OFF)
  533. cs_set_user_bpammo(id, CSW_GALIL, iBpAmmo-j);
  534.  
  535. set_pdata_int(weapon_entity, m_fInReload, 0, WEAP_LINUX_XTRA_OFF)
  536. fInReload = 0
  537. }
  538.  
  539. return HAM_IGNORED;
  540. }
  541.  
  542. public guitar__Reload(weapon_entity) {
  543. new id = pev(weapon_entity, pev_owner)
  544. if (!is_user_connected(id))
  545. return HAM_IGNORED;
  546.  
  547. if (!g_has_guitar[id])
  548. return HAM_IGNORED;
  549.  
  550. g_guitar_TmpClip[id] = -1;
  551.  
  552. new iBpAmmo = cs_get_user_bpammo(id, CSW_GALIL);
  553. new iClip = get_pdata_int(weapon_entity, m_iClip, WEAP_LINUX_XTRA_OFF)
  554.  
  555. if (iBpAmmo <= 0)
  556. return HAM_SUPERCEDE;
  557.  
  558. if (iClip >= get_pcvar_num(cvar_clip_guitar))
  559. return HAM_SUPERCEDE;
  560.  
  561.  
  562. g_guitar_TmpClip[id] = iClip;
  563.  
  564. return HAM_IGNORED;
  565. }
  566.  
  567. public guitar__Reload_Post(weapon_entity) {
  568. new id = pev(weapon_entity, pev_owner)
  569. if (!is_user_connected(id))
  570. return HAM_IGNORED;
  571.  
  572. if (!g_has_guitar[id])
  573. return HAM_IGNORED;
  574.  
  575. if (g_guitar_TmpClip[id] == -1)
  576. return HAM_IGNORED;
  577.  
  578. set_pdata_int(weapon_entity, m_iClip, g_guitar_TmpClip[id], WEAP_LINUX_XTRA_OFF)
  579.  
  580. set_pdata_float(weapon_entity, m_flTimeWeaponIdle, guitar_RELOAD_TIME, WEAP_LINUX_XTRA_OFF)
  581.  
  582. set_pdata_float(id, m_flNextAttack, guitar_RELOAD_TIME, PLAYER_LINUX_XTRA_OFF)
  583.  
  584. set_pdata_int(weapon_entity, m_fInReload, 1, WEAP_LINUX_XTRA_OFF)
  585.  
  586. // relaod animation
  587. UTIL_PlayWeaponAnimation(id, 1)
  588.  
  589. return HAM_IGNORED;
  590. }
  591.  
  592. stock drop_weapons(id, dropwhat)
  593. {
  594. static weapons[32], num, i, weaponid
  595. num = 0
  596. get_user_weapons(id, weapons, num)
  597.  
  598. for (i = 0; i < num; i++)
  599. {
  600. weaponid = weapons[i]
  601.  
  602. if (dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM))
  603. {
  604. static wname[32]
  605. get_weaponname(weaponid, wname, sizeof wname - 1)
  606. engclient_cmd(id, "drop", wname)
  607. }
  608. }
  609. }


MEGOLDVA

SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <engine>
  3. #include <fakemeta>
  4. #include <fun>
  5. #include <hamsandwich>
  6. #include <xs>
  7. #include <cstrike>
  8. enum
  9. {
  10. anim_idle,
  11. anim_reload,
  12. anim_draw,
  13. anim_shoot1,
  14. anim_shoot2,
  15. anim_shoot3
  16. }
  17.  
  18. #define ENG_NULLENT -1
  19. #define EV_INT_WEAPONKEY EV_INT_impulse
  20. #define guitar_WEAPONKEY 901
  21. #define MAX_PLAYERS 32
  22. #define IsValidUser(%1) (1 <= %1 <= g_MaxPlayers)
  23.  
  24. const USE_STOPPED = 0
  25. const OFFSET_ACTIVE_ITEM = 373
  26. const OFFSET_WEAPONOWNER = 41
  27. const OFFSET_LINUX = 5
  28. const OFFSET_LINUX_WEAPONS = 4
  29.  
  30. #define WEAP_LINUX_XTRA_OFF 4
  31. #define m_fKnown 44
  32. #define m_flNextPrimaryAttack 46
  33. #define m_flTimeWeaponIdle 48
  34. #define m_iClip 51
  35. #define m_fInReload 54
  36. #define PLAYER_LINUX_XTRA_OFF 5
  37. #define m_flNextAttack 83
  38.  
  39. #define guitar_RELOAD_TIME 2.5
  40.  
  41. new gmsgWeaponList
  42.  
  43. const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)
  44. new const WEAPONENTNAMES[][] = { "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10",
  45. "weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550",
  46. "weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249",
  47. "weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552",
  48. "weapon_ak47", "weapon_knife", "weapon_p90" }
  49. new const Fire_Sounds[][] = { "weapons/gt-1.wav" }
  50. new const Sound_Zoom[] = { "weapons/zoom.wav" }
  51. new const GUNSHOT_DECALS[] = { 41, 42, 43, 44, 45 }
  52. new guitar_V_MODEL[64] = "models/cs16t3am_models/v_gitar_uj.mdl"
  53. new guitar_P_MODEL[64] = "models/cs16t3am_models/p_gitar_uj.mdl"
  54. new guitar_W_MODEL[64] = "models/cs16t3am_models/w_gitar_uj.mdl"
  55. new cvar_dmg_guitar, cvar_recoil_guitar, g_itemid_guitar, cvar_clip_guitar, cvar_guitar_ammo
  56. new g_has_guitar[33]
  57. new g_MaxPlayers, g_orig_event_guitar, g_clip_ammo[33]
  58. new Float:cl_pushangle[MAX_PLAYERS + 1][3], m_iBlood[2]
  59. new g_guitar_TmpClip[33], oldweap[33]
  60. new bool:MsgSayText,msg[128]
  61.  
  62. public plugin_init()
  63. {
  64. register_plugin("Guitar", "1.0", "Crock / =)")
  65. register_message(get_user_msgid("DeathMsg"), "message_DeathMsg")
  66. register_event("CurWeapon","CurrentWeapon","be","1=1")
  67. RegisterHam(Ham_Item_AddToPlayer, "weapon_galil", "fw_guitar_AddToPlayer")
  68. RegisterHam(Ham_Use, "func_tank", "fw_UseStationary_Post", 1)
  69. RegisterHam(Ham_Use, "func_tankmortar", "fw_UseStationary_Post", 1)
  70. RegisterHam(Ham_Use, "func_tankrocket", "fw_UseStationary_Post", 1)
  71. RegisterHam(Ham_Use, "func_tanklaser", "fw_UseStationary_Post", 1)
  72. for (new i = 1; i < sizeof WEAPONENTNAMES; i++)
  73. if (WEAPONENTNAMES[i][0]) RegisterHam(Ham_Item_Deploy, WEAPONENTNAMES[i], "fw_Item_Deploy_Post", 1)
  74. RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_galil", "fw_guitar_PrimaryAttack")
  75. RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_galil", "fw_guitar_PrimaryAttack_Post", 1)
  76. RegisterHam(Ham_Item_PostFrame, "weapon_galil", "guitar__ItemPostFrame");
  77. RegisterHam(Ham_Weapon_Reload, "weapon_galil", "guitar__Reload");
  78. RegisterHam(Ham_Weapon_Reload, "weapon_galil", "guitar__Reload_Post", 1);
  79. RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
  80. register_forward(FM_SetModel, "fw_SetModel")
  81. register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1)
  82. register_forward(FM_PlaybackEvent, "fwPlaybackEvent")
  83.  
  84. cvar_dmg_guitar = register_cvar("zp_guitar_dmg", "1.5")
  85. cvar_recoil_guitar = register_cvar("zp_guitar_recoil", "0.4")
  86. cvar_clip_guitar = register_cvar("zp_guitar_clip", "35")
  87. cvar_guitar_ammo = register_cvar("zp_guitar_ammo", "150")
  88.  
  89. register_clcmd("say /gitar", "gitar")
  90. register_clcmd("weapon_gitar", "weapon_hook")
  91. g_MaxPlayers = get_maxplayers()
  92. gmsgWeaponList = get_user_msgid("WeaponList")
  93. }
  94.  
  95. public plugin_precache()
  96. {
  97. precache_model(guitar_V_MODEL)
  98. precache_model(guitar_P_MODEL)
  99. precache_model(guitar_W_MODEL)
  100. precache_sound(Sound_Zoom)
  101. precache_sound(Fire_Sounds[0])
  102. precache_sound("weapons/gt_clipin.wav")
  103. precache_sound("weapons/gt_clipon.wav")
  104. precache_sound("weapons/gt_clipout.wav")
  105. precache_sound("weapons/gt_draw.wav")
  106. m_iBlood[0] = precache_model("sprites/blood.spr")
  107. m_iBlood[1] = precache_model("sprites/bloodspray.spr")
  108. precache_model("sprites/640hud5.spr")
  109. register_forward(FM_PrecacheEvent, "fwPrecacheEvent_Post", 1)
  110. precache_generic( "sprites/weapon_gitar.txt")
  111. precache_generic( "sprites/w_gitar.spr")
  112.  
  113. }
  114.  
  115. public weapon_hook(id)
  116. {
  117. engclient_cmd(id, "weapon_galil")
  118. return PLUGIN_HANDLED;
  119. }
  120. public plugin_natives ()
  121. {
  122. register_native("give_weapon_gui", "native_give_weapon_add", 1)
  123. }
  124. public native_give_weapon_add(id)
  125. {
  126. give_guitar(id)
  127. }
  128.  
  129. public fwPrecacheEvent_Post(type, const name[])
  130. {
  131. if (equal("events/galil.sc", name))
  132. {
  133. g_orig_event_guitar = get_orig_retval()
  134. return FMRES_HANDLED
  135. }
  136.  
  137. return FMRES_IGNORED
  138. }
  139.  
  140. public client_connect(id)
  141. {
  142. g_has_guitar[id] = false
  143. }
  144.  
  145. public client_disconnect(id)
  146. {
  147. g_has_guitar[id] = false
  148. }
  149.  
  150. public fw_SetModel(entity, model[])
  151. {
  152. if(!is_valid_ent(entity))
  153. return FMRES_IGNORED;
  154.  
  155. static szClassName[33]
  156. entity_get_string(entity, EV_SZ_classname, szClassName, charsmax(szClassName))
  157.  
  158. if(!equal(szClassName, "weaponbox"))
  159. return FMRES_IGNORED;
  160.  
  161. static iOwner
  162.  
  163. iOwner = entity_get_edict(entity, EV_ENT_owner)
  164.  
  165. if(equal(model, "models/w_galil.mdl"))
  166. {
  167. static iStoredSVDID
  168.  
  169. iStoredSVDID = find_ent_by_owner(ENG_NULLENT, "weapon_galil", entity)
  170.  
  171. if(!is_valid_ent(iStoredSVDID))
  172. return FMRES_IGNORED;
  173.  
  174. if(g_has_guitar[iOwner])
  175. {
  176. entity_set_int(iStoredSVDID, EV_INT_WEAPONKEY, guitar_WEAPONKEY)
  177. g_has_guitar[iOwner] = false
  178.  
  179. entity_set_model(entity, guitar_W_MODEL)
  180.  
  181. return FMRES_SUPERCEDE;
  182. }
  183. }
  184.  
  185.  
  186. return FMRES_IGNORED;
  187. }
  188.  
  189. public give_guitar(id)
  190. {
  191. drop_weapons(id, 1);
  192. new iWep2 = give_item(id,"weapon_galil")
  193. if( iWep2 > 0 )
  194. {
  195. cs_set_weapon_ammo(iWep2, get_pcvar_num(cvar_clip_guitar))
  196. cs_set_user_bpammo (id, CSW_GALIL, get_pcvar_num(cvar_guitar_ammo))
  197. set_pdata_float(id, m_flNextAttack, 1.0, PLAYER_LINUX_XTRA_OFF)
  198.  
  199. message_begin(MSG_ONE, gmsgWeaponList, _, id)
  200. write_string("weapon_gitar")
  201. write_byte(4)
  202. write_byte(90)
  203. write_byte(-1)
  204. write_byte(-1)
  205. write_byte(0)
  206. write_byte(6)
  207. write_byte(CSW_GALIL)
  208. message_end()
  209. }
  210. g_has_guitar[id] = true;
  211. }
  212.  
  213. public gitar(id, itemid)
  214. {
  215. if ((!(get_user_flags(id) & ADMIN_LEVEL_H)))
  216. {
  217. client_print(id, print_center, "Ezt a fegyvert csak VIP hasznalhatja")
  218. message_begin(MSG_ONE,MsgSayText,{0,0,0},id)
  219. write_byte(id)
  220. write_string(msg)
  221. message_end()
  222. return PLUGIN_HANDLED
  223. }
  224. if(itemid == g_itemid_guitar)
  225. {
  226. give_guitar(id)
  227. }
  228. }
  229.  
  230. public fw_guitar_AddToPlayer(guitar, id)
  231. {
  232. if(!is_valid_ent(guitar) || !is_user_connected(id))
  233. return HAM_IGNORED;
  234.  
  235. if(entity_get_int(guitar, EV_INT_WEAPONKEY) == guitar_WEAPONKEY)
  236. {
  237. g_has_guitar[id] = true
  238. entity_set_int(guitar, EV_INT_WEAPONKEY, 0)
  239.  
  240. message_begin(MSG_ONE, gmsgWeaponList, {0,0,0}, id)
  241. write_string("weapon_gitar")
  242. write_byte(4)
  243. write_byte(90)
  244. write_byte(-1)
  245. write_byte(-1)
  246. write_byte(0)
  247. write_byte(6)
  248. write_byte(CSW_GALIL)
  249. message_end()
  250.  
  251. return HAM_HANDLED;
  252. }
  253. else
  254. {
  255. message_begin(MSG_ONE, gmsgWeaponList, {0,0,0}, id)
  256. write_string("weapon_galil")
  257. write_byte(4)
  258. write_byte(90)
  259. write_byte(-1)
  260. write_byte(-1)
  261. write_byte(0)
  262. write_byte(6)
  263. write_byte(CSW_GALIL)
  264. message_end()
  265. }
  266. return HAM_IGNORED;
  267. }
  268.  
  269. public fw_UseStationary_Post(entity, caller, activator, use_type)
  270. {
  271. if (use_type == USE_STOPPED && is_user_connected(caller))
  272. replace_weapon_models(caller, get_user_weapon(caller))
  273. }
  274.  
  275. public fw_Item_Deploy_Post(weapon_ent)
  276. {
  277. static owner
  278. owner = fm_cs_get_weapon_ent_owner(weapon_ent)
  279.  
  280. static weaponid
  281. weaponid = cs_get_weapon_id(weapon_ent)
  282.  
  283. replace_weapon_models(owner, weaponid)
  284. }
  285.  
  286. public CurrentWeapon(id)
  287. {
  288. replace_weapon_models(id, read_data(2))
  289. if((g_has_guitar[id]) && (get_user_weapon(id) == CSW_GALIL)){
  290. if(!(get_user_flags(id) & ADMIN_LEVEL_H))
  291. {
  292. client_print(id, print_center, "Ezt a fegyvert csak VIP hasznalhatja")
  293. client_cmd(id, "drop")
  294. }
  295. }
  296. }
  297.  
  298. replace_weapon_models(id, weaponid)
  299. {
  300. switch (weaponid)
  301. {
  302. case CSW_GALIL:
  303. {
  304. new CsTeams:userTeam = cs_get_user_team(id)
  305. if (userTeam == CS_TEAM_CT & CS_TEAM_T & CS_TEAM_SPECTATOR)
  306. return
  307.  
  308. if(g_has_guitar[id])
  309. {
  310. set_pev(id, pev_viewmodel2, guitar_V_MODEL)
  311. set_pev(id, pev_weaponmodel2, guitar_P_MODEL)
  312. if(oldweap[id] != CSW_GALIL)
  313. {
  314. set_pdata_float(id, m_flNextAttack, 1.0, PLAYER_LINUX_XTRA_OFF)
  315.  
  316. message_begin(MSG_ONE, gmsgWeaponList, _, id)
  317. write_string("weapon_gitar")
  318. write_byte(4)
  319. write_byte(90)
  320. write_byte(-1)
  321. write_byte(-1)
  322. write_byte(0)
  323. write_byte(6)
  324. write_byte(CSW_GALIL)
  325. message_end()
  326. }
  327. }
  328. }
  329. }
  330. oldweap[id] = weaponid
  331. }
  332.  
  333. public fw_UpdateClientData_Post(Player, SendWeapons, CD_Handle)
  334. {
  335. if(!is_user_alive(Player) || (get_user_weapon(Player) != CSW_GALIL) || !g_has_guitar[Player])
  336. return FMRES_IGNORED
  337.  
  338. set_cd(CD_Handle, CD_flNextAttack, halflife_time () + 0.001)
  339. return FMRES_HANDLED
  340. }
  341.  
  342. public fw_guitar_PrimaryAttack(Weapon)
  343. {
  344. new Player = get_pdata_cbase(Weapon, 41, 4)
  345.  
  346. if (!g_has_guitar[Player])
  347. return;
  348.  
  349. pev(Player,pev_punchangle,cl_pushangle[Player])
  350.  
  351. g_clip_ammo[Player] = cs_get_weapon_ammo(Weapon)
  352. }
  353.  
  354. public fwPlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2)
  355. {
  356. if ((eventid != g_orig_event_guitar))
  357. return FMRES_IGNORED
  358. if (!(1 <= invoker <= g_MaxPlayers))
  359. return FMRES_IGNORED
  360.  
  361. playback_event(flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2)
  362. return FMRES_SUPERCEDE
  363. }
  364.  
  365. public fw_guitar_PrimaryAttack_Post(Weapon)
  366. {
  367. new Player = get_pdata_cbase(Weapon, 41, 4)
  368.  
  369. new szClip, szAmmo
  370. get_user_weapon(Player, szClip, szAmmo)
  371. if(Player > 0 && Player < 33)
  372. {
  373. if(!g_has_guitar[Player])
  374. {
  375. if(szClip > 0) emit_sound(Player, CHAN_WEAPON, "weapons/galil-1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  376. }
  377. if(g_has_guitar[Player])
  378. {
  379. new Float:push[3]
  380. pev(Player,pev_punchangle,push)
  381. xs_vec_sub(push,cl_pushangle[Player],push)
  382.  
  383. xs_vec_mul_scalar(push,get_pcvar_float(cvar_recoil_guitar),push)
  384. xs_vec_add(push,cl_pushangle[Player],push)
  385. set_pev(Player,pev_punchangle,push)
  386.  
  387. if (!g_clip_ammo[Player])
  388. return
  389.  
  390. emit_sound(Player, CHAN_WEAPON, Fire_Sounds[0], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  391. UTIL_PlayWeaponAnimation(Player, anim_shoot1)
  392.  
  393. make_blood_and_bulletholes(Player)
  394. }
  395. }
  396. }
  397.  
  398. public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
  399. {
  400. if (victim != attacker && is_user_connected(attacker))
  401. {
  402. if(get_user_weapon(attacker) == CSW_GALIL)
  403. {
  404. if(g_has_guitar[attacker])
  405. SetHamParamFloat(4, damage * get_pcvar_float(cvar_dmg_guitar))
  406. }
  407. }
  408. }
  409.  
  410. public message_DeathMsg(msg_id, msg_dest, id)
  411. {
  412. static szTruncatedWeapon[33], iAttacker, iVictim
  413.  
  414. get_msg_arg_string(4, szTruncatedWeapon, charsmax(szTruncatedWeapon))
  415.  
  416. iAttacker = get_msg_arg_int(1)
  417. iVictim = get_msg_arg_int(2)
  418.  
  419. if(!is_user_connected(iAttacker) || iAttacker == iVictim)
  420. return PLUGIN_CONTINUE
  421.  
  422. if(equal(szTruncatedWeapon, "galil") && get_user_weapon(iAttacker) == CSW_GALIL)
  423. {
  424. if(g_has_guitar[iAttacker])
  425. set_msg_arg_string(4, "gitar")
  426. }
  427.  
  428. return PLUGIN_CONTINUE
  429. }
  430.  
  431. stock fm_cs_get_current_weapon_ent(id)
  432. {
  433. return get_pdata_cbase(id, OFFSET_ACTIVE_ITEM, OFFSET_LINUX);
  434. }
  435.  
  436. stock fm_cs_get_weapon_ent_owner(ent)
  437. {
  438. return get_pdata_cbase(ent, OFFSET_WEAPONOWNER, OFFSET_LINUX_WEAPONS);
  439. }
  440.  
  441. stock UTIL_PlayWeaponAnimation(const Player, const Sequence)
  442. {
  443. set_pev(Player, pev_weaponanim, Sequence)
  444.  
  445. message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, .player = Player)
  446. write_byte(Sequence)
  447. write_byte(pev(Player, pev_body))
  448. message_end()
  449. }
  450.  
  451. stock make_blood_and_bulletholes(id)
  452. {
  453. new aimOrigin[3], target, body
  454. get_user_origin(id, aimOrigin, 3)
  455. get_user_aiming(id, target, body)
  456.  
  457. if(target > 0 && target <= g_MaxPlayers && cs_get_user_team(target))
  458. {
  459. new Float:fStart[3], Float:fEnd[3], Float:fRes[3], Float:fVel[3]
  460. pev(id, pev_origin, fStart)
  461.  
  462. velocity_by_aim(id, 64, fVel)
  463.  
  464. fStart[0] = float(aimOrigin[0])
  465. fStart[1] = float(aimOrigin[1])
  466. fStart[2] = float(aimOrigin[2])
  467. fEnd[0] = fStart[0]+fVel[0]
  468. fEnd[1] = fStart[1]+fVel[1]
  469. fEnd[2] = fStart[2]+fVel[2]
  470.  
  471. new res
  472. engfunc(EngFunc_TraceLine, fStart, fEnd, 0, target, res)
  473. get_tr2(res, TR_vecEndPos, fRes)
  474.  
  475. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  476. write_byte(TE_BLOODSPRITE)
  477. write_coord(floatround(fStart[0]))
  478. write_coord(floatround(fStart[1]))
  479. write_coord(floatround(fStart[2]))
  480. write_short( m_iBlood [ 1 ])
  481. write_short( m_iBlood [ 0 ] )
  482. write_byte(70)
  483. write_byte(random_num(1,2))
  484. message_end()
  485.  
  486.  
  487. }
  488. else if(!is_user_connected(target))
  489. {
  490. if(target)
  491. {
  492. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  493. write_byte(TE_DECAL)
  494. write_coord(aimOrigin[0])
  495. write_coord(aimOrigin[1])
  496. write_coord(aimOrigin[2])
  497. write_byte(GUNSHOT_DECALS[random_num ( 0, sizeof GUNSHOT_DECALS -1 ) ] )
  498. write_short(target)
  499. message_end()
  500. }
  501. else
  502. {
  503. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  504. write_byte(TE_WORLDDECAL)
  505. write_coord(aimOrigin[0])
  506. write_coord(aimOrigin[1])
  507. write_coord(aimOrigin[2])
  508. write_byte(GUNSHOT_DECALS[random_num ( 0, sizeof GUNSHOT_DECALS -1 ) ] )
  509. message_end()
  510. }
  511.  
  512. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  513. write_byte(TE_GUNSHOTDECAL)
  514. write_coord(aimOrigin[0])
  515. write_coord(aimOrigin[1])
  516. write_coord(aimOrigin[2])
  517. write_short(id)
  518. write_byte(GUNSHOT_DECALS[random_num ( 0, sizeof GUNSHOT_DECALS -1 ) ] )
  519. message_end()
  520. }
  521. }
  522.  
  523. public guitar__ItemPostFrame(weapon_entity) {
  524. new id = pev(weapon_entity, pev_owner)
  525. if (!is_user_connected(id))
  526. return HAM_IGNORED;
  527.  
  528. if (!g_has_guitar[id])
  529. return HAM_IGNORED;
  530.  
  531. new Float:flNextAttack = get_pdata_float(id, m_flNextAttack, PLAYER_LINUX_XTRA_OFF)
  532.  
  533. new iBpAmmo = cs_get_user_bpammo(id, CSW_GALIL);
  534. new iClip = get_pdata_int(weapon_entity, m_iClip, WEAP_LINUX_XTRA_OFF)
  535.  
  536. new fInReload = get_pdata_int(weapon_entity, m_fInReload, WEAP_LINUX_XTRA_OFF)
  537.  
  538. if( fInReload && flNextAttack <= 0.0 )
  539. {
  540. new j = min(get_pcvar_num(cvar_clip_guitar) - iClip, iBpAmmo)
  541.  
  542. set_pdata_int(weapon_entity, m_iClip, iClip + j, WEAP_LINUX_XTRA_OFF)
  543. cs_set_user_bpammo(id, CSW_GALIL, iBpAmmo-j);
  544.  
  545. set_pdata_int(weapon_entity, m_fInReload, 0, WEAP_LINUX_XTRA_OFF)
  546. fInReload = 0
  547. }
  548.  
  549. return HAM_IGNORED;
  550. }
  551.  
  552. public guitar__Reload(weapon_entity) {
  553. new id = pev(weapon_entity, pev_owner)
  554. if (!is_user_connected(id))
  555. return HAM_IGNORED;
  556.  
  557. if (!g_has_guitar[id])
  558. return HAM_IGNORED;
  559.  
  560. g_guitar_TmpClip[id] = -1;
  561.  
  562. new iBpAmmo = cs_get_user_bpammo(id, CSW_GALIL);
  563. new iClip = get_pdata_int(weapon_entity, m_iClip, WEAP_LINUX_XTRA_OFF)
  564.  
  565. if (iBpAmmo <= 0)
  566. return HAM_SUPERCEDE;
  567.  
  568. if (iClip >= get_pcvar_num(cvar_clip_guitar))
  569. return HAM_SUPERCEDE;
  570.  
  571.  
  572. g_guitar_TmpClip[id] = iClip;
  573.  
  574. return HAM_IGNORED;
  575. }
  576.  
  577. public guitar__Reload_Post(weapon_entity) {
  578. new id = pev(weapon_entity, pev_owner)
  579. if (!is_user_connected(id))
  580. return HAM_IGNORED;
  581.  
  582. if (!g_has_guitar[id])
  583. return HAM_IGNORED;
  584.  
  585. if (g_guitar_TmpClip[id] == -1)
  586. return HAM_IGNORED;
  587.  
  588. set_pdata_int(weapon_entity, m_iClip, g_guitar_TmpClip[id], WEAP_LINUX_XTRA_OFF)
  589.  
  590. set_pdata_float(weapon_entity, m_flTimeWeaponIdle, guitar_RELOAD_TIME, WEAP_LINUX_XTRA_OFF)
  591.  
  592. set_pdata_float(id, m_flNextAttack, guitar_RELOAD_TIME, PLAYER_LINUX_XTRA_OFF)
  593.  
  594. set_pdata_int(weapon_entity, m_fInReload, 1, WEAP_LINUX_XTRA_OFF)
  595.  
  596. // relaod animation
  597. UTIL_PlayWeaponAnimation(id, 1)
  598.  
  599. return HAM_IGNORED;
  600. }
  601.  
  602. stock drop_weapons(id, dropwhat)
  603. {
  604. static weapons[32], num, i, weaponid
  605. num = 0
  606. get_user_weapons(id, weapons, num)
  607.  
  608. for (i = 0; i < num; i++)
  609. {
  610. weaponid = weapons[i]
  611.  
  612. if (dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM))
  613. {
  614. static wname[32]
  615. get_weaponname(weaponid, wname, sizeof wname - 1)
  616. engclient_cmd(id, "drop", wname)
  617. }
  618. }
  619. }


A hozzászólást 1 alkalommal szerkesztették, utoljára csaba1998 2013.02.24. 08:50-kor.

Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Gitár fegyver
HozzászólásElküldve: 2013.02.23. 19:21 
Offline
Developer
Avatar

Csatlakozott: 2011.06.01. 21:11
Hozzászólások: 7965
Megköszönt másnak: 295 alkalommal
Megköszönték neki: 537 alkalommal
0át jelez, és 0a is van benne?

_________________
http://www.easyrankup.eu


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Gitár fegyver
HozzászólásElküldve: 2013.02.23. 19:38 
Offline
Félisten
Avatar

Csatlakozott: 2010.09.16. 20:57
Hozzászólások: 950
Megköszönt másnak: 9 alkalommal
Megköszönték neki: 101 alkalommal
Szerintem bpammora ra gondol, hogy akkor is 0-t mutat ha több van, én is ma találkoztam a hibával, általam írt fegyóban, ha valaki tud megoldást annak én is nyomok egy köszönömöt.

_________________
Weboldalam: nandee.smmg.hu
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Gitár fegyver
HozzászólásElküldve: 2013.02.23. 20:18 
Igen bpammora gondoltam, az jelez ki vmiért 0át


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Gitár fegyver
HozzászólásElküldve: 2013.02.25. 12:22 
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
Mennyit a bp ammo?Azaz mennyi van beállítva?

_________________
Kép
Kép
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Gitár fegyver
HozzászólásElküldve: 2013.02.25. 12:40 
Már meg van oldva


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Gitár fegyver
HozzászólásElküldve: 2013.02.25. 15:10 
Offline
Félisten
Avatar

Csatlakozott: 2010.09.16. 20:57
Hozzászólások: 950
Megköszönt másnak: 9 alkalommal
Megköszönték neki: 101 alkalommal
Erre kíváncsi vagyok belenézek

_________________
Weboldalam: nandee.smmg.hu
Kép


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 15 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