Dabar yra 2018 Lap 20 17:22




 Puslapis 11 [ 5 pranešimai(ų) ] 
Autorius Žinutė
 Pranešimo tema: pagalbos zp_extra_items
Žinutės numeris: #1  StandartinėParašytas: 2018 Sau 20 21:30 
Jau po truputį tampa savu

Užsiregistravo: 2015 Gru 24 14:55
Pranešimai: 159
Karma: 7

Miestas: Kaunas
Iskilo toke problema kai pataiko ideze plante ji sprogsta ir nezinau kiap tai sutvarkyt, gal kas padesit

  1. #include <amxmodx>
  2. #include <engine>
  3. #include <fakemeta>
  4. #include <fakemeta_util>
  5. #include <hamsandwich>
  6. #include <cstrike>
  7. #include <fun>
  8. #include <zombieplague>
  9.  
  10. #define PLUGIN "Tactical Knife"
  11. #define VERSION "1.0"
  12. #define AUTHOR "m4m3ts"
  13.  
  14. #define CSW_TACT CSW_P228
  15. #define weapon_tact "weapon_p228"
  16. #define old_event "events/p228.sc"
  17. #define old_w_model "models/w_p228.mdl"
  18. #define WEAPON_SECRETCODE 4234234
  19.  
  20.  
  21. #define RELOAD_TIME 0.435
  22. #define STAB_TIME 1.1
  23. #define ATTACK_TIME 1.0
  24. #define SYSTEM_CLASSNAME "tact_knife"
  25. #define SYSTEM_CLASSNAME2 "tact_knife2"
  26. #define WEAPON_ANIMEXT "grenade"
  27.  
  28. const PDATA_SAFE = 2
  29. const OFFSET_LINUX_WEAPONS = 4
  30. const OFFSET_WEAPONOWNER = 41
  31. const m_flNextAttack = 83
  32. const m_szAnimExtention = 492
  33.  
  34. new const v_model[] = "models/v_tknifeex2.mdl"
  35. new const p_model[] = "models/p_tknifeex2.mdl"
  36. new const w_model[] = "models/w_tknifeex2.mdl"
  37. new const ARROW_MODEL[] = "models/tknifeb.mdl"
  38. new const tact_wall[][] = {"weapons/tknife_stone1.wav", "weapons/tknife_stone2.wav"}
  39. new const weapon_sound[4][] =
  40. {
  41.     "weapons/tknife_shoot1.wav",
  42.     "weapons/tknifeex2_shoot1.wav",
  43.     "weapons/tknifeex2_draw.wav",
  44.     "weapons/tact_hit.wav"
  45. }
  46.  
  47.  
  48. new const WeaponResource[4][] =
  49. {
  50.     "sprites/weapon_tknifeex2.txt",
  51.     "sprites/640hud12.spr",
  52.     "sprites/640hud96.spr",
  53.     "sprites/640hud97.spr"
  54. }
  55.  
  56. enum
  57. {
  58.     ANIM_IDLE = 0,
  59.     ANIM_SHOOT,
  60.     ANIM_DRAW,
  61.     ANIM_SHOOT2
  62. }
  63.  
  64. new g_MsgDeathMsg, g_endround
  65.  
  66. new g_had_tact[33], g_tact_ammo[33], g_Shoot_Count[33]
  67. new g_old_weapon[33], m_iBlood[2]
  68. new sTrail, item_tact, cvar_dmg_slash_tact, cvar_dmg_stab_tact, cvar_ammo_tactical
  69.  
  70. const SECONDARY_WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE)
  71.  
  72. public plugin_init()
  73. {
  74.     register_plugin(PLUGIN, VERSION, AUTHOR)
  75.     register_cvar("tact_version", "m4m3ts", FCVAR_SERVER|FCVAR_SPONLY)
  76.     register_forward(FM_CmdStart, "fw_CmdStart")
  77.     register_forward(FM_SetModel, "fw_SetModel")
  78.     register_think(SYSTEM_CLASSNAME, "fw_Think")
  79.     register_think(SYSTEM_CLASSNAME2, "fw_Think")
  80.     register_touch(SYSTEM_CLASSNAME, "*", "fw_touch")
  81.     register_touch(SYSTEM_CLASSNAME2, "*", "fw_touch2")
  82.     register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
  83.     register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1)   
  84.     RegisterHam(Ham_Spawn, "player", "Player_Spawn", 1)
  85.     RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
  86.     RegisterHam(Ham_Item_AddToPlayer, weapon_tact, "fw_AddToPlayer_Post", 1)
  87.     register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")
  88.    
  89.     register_clcmd("weapon_tknifeex2", "hook_weapon")
  90.    
  91.     cvar_dmg_slash_tact = register_cvar("zp_tactical_dmg_slash", "61.0")
  92.     cvar_dmg_stab_tact = register_cvar("zp_tactical_dmg_stab", "140.0")
  93.     cvar_ammo_tactical = register_cvar("zp_tactical_ammo", "30")
  94.    
  95.     item_tact = zp_register_extra_item("Triple Tactical Knife", 14, ZP_TEAM_HUMAN)
  96.    
  97.     g_MsgDeathMsg = get_user_msgid("DeathMsg")
  98.    
  99.     g_endround = 1
  100. }
  101.  
  102.  
  103. public plugin_precache()
  104. {
  105.     precache_model(v_model)
  106.     precache_model(p_model)
  107.     precache_model(w_model)
  108.     precache_model(ARROW_MODEL)
  109.    
  110.     for(new i = 0; i < sizeof(weapon_sound); i++)
  111.         precache_sound(weapon_sound[i])
  112.    
  113.     for(new i = 0; i < sizeof(tact_wall); i++)
  114.         precache_sound(tact_wall[i])
  115.    
  116.     precache_generic(WeaponResource[0])
  117.     for(new i = 1; i < sizeof(WeaponResource); i++)
  118.         precache_model(WeaponResource[i])
  119.    
  120.     m_iBlood[0] = precache_model("sprites/blood.spr")
  121.     m_iBlood[1] = precache_model("sprites/bloodspray.spr")
  122.     sTrail = precache_model("sprites/laserbeam.spr")
  123. }
  124.  
  125. public zp_user_infected_post(id)
  126. {
  127.     remove_tact(id)
  128. }
  129.  
  130. public zp_round_started() g_endround = 0
  131. public zp_round_ended() g_endround = 1
  132.  
  133. public Player_Spawn(id)
  134. {
  135.     remove_tact(id)
  136. }
  137.  
  138. public fw_PlayerKilled(id)
  139. {
  140.     remove_tact(id)
  141. }
  142.  
  143. public hook_weapon(id)
  144. {
  145.     engclient_cmd(id, weapon_tact)
  146.     return
  147. }
  148.  
  149. public zp_extra_item_selected(id, itemid)
  150. {
  151.     if(itemid == item_tact) get_tact(id)
  152. }
  153.  
  154. public get_tact(id)
  155. {
  156.     if(!is_user_alive(id))
  157.         return
  158.     drop_weapons(id, 1)
  159.     g_had_tact[id] = 1
  160.     g_tact_ammo[id] = get_pcvar_num(cvar_ammo_tactical)
  161.    
  162.     give_item(id, weapon_tact)
  163.    
  164.     static weapon_ent; weapon_ent = fm_find_ent_by_owner(-1, weapon_tact, id)
  165.     if(pev_valid(weapon_ent)) cs_set_weapon_ammo(weapon_ent, 1)
  166. }
  167.  
  168. public remove_tact(id)
  169. {
  170.     g_had_tact[id] = 0
  171.     g_tact_ammo[id] = 0
  172. }
  173.  
  174. public refill_tact(id)
  175. {
  176.     g_tact_ammo[id] = get_pcvar_num(cvar_ammo_tactical)
  177.     update_ammo(id)
  178. }
  179.    
  180. public fw_UpdateClientData_Post(id, sendweapons, cd_handle)
  181. {
  182.     if(!is_user_alive(id) || !is_user_connected(id))
  183.         return FMRES_IGNORED   
  184.     if(get_user_weapon(id) == CSW_TACT && g_had_tact[id])
  185.         set_cd(cd_handle, CD_flNextAttack, get_gametime() + 0.001)
  186.    
  187.     return FMRES_HANDLED
  188. }
  189.  
  190. public Event_CurWeapon(id)
  191. {
  192.     if(!is_user_alive(id))
  193.         return
  194.        
  195.     if(get_user_weapon(id) == CSW_TACT && g_had_tact[id])
  196.     {
  197.         set_pev(id, pev_viewmodel2, v_model)
  198.         set_pev(id, pev_weaponmodel2, p_model)
  199.         set_pdata_string(id, m_szAnimExtention * 4, WEAPON_ANIMEXT, -1 , 20)
  200.         set_weapon_anim(id, ANIM_DRAW)
  201.         update_ammo(id)
  202.     }
  203.    
  204.     g_old_weapon[id] = get_user_weapon(id)
  205. }
  206.  
  207. public fw_CmdStart(id, uc_handle, seed)
  208. {
  209.     if(!is_user_alive(id) || !is_user_connected(id))
  210.         return
  211.     if(get_user_weapon(id) != CSW_TACT || !g_had_tact[id])
  212.         return
  213.    
  214.     static ent; ent = fm_get_user_weapon_entity(id, CSW_TACT)
  215.     if(!pev_valid(ent))
  216.         return
  217.     if(get_pdata_float(ent, 46, OFFSET_LINUX_WEAPONS) > 0.0 || get_pdata_float(ent, 47, OFFSET_LINUX_WEAPONS) > 0.0)
  218.         return
  219.    
  220.     static CurButton
  221.     CurButton = get_uc(uc_handle, UC_Buttons)
  222.    
  223.     if(CurButton & IN_ATTACK)
  224.     {
  225.         CurButton &= ~IN_ATTACK
  226.         set_uc(uc_handle, UC_Buttons, CurButton)
  227.        
  228.         if(g_tact_ammo[id] == 0)
  229.             return
  230.         if(get_pdata_float(id, 83, 5) <= 0.0)
  231.         {
  232.             g_tact_ammo[id]--
  233.             g_Shoot_Count[id] = 0
  234.             update_ammo(id)
  235.             set_task(0.2, "throw_knife", id)
  236.             set_weapon_anim(id, ANIM_SHOOT)
  237.             set_weapons_timeidle(id, CSW_TACT, ATTACK_TIME)
  238.             set_player_nextattackx(id, ATTACK_TIME)
  239.         }
  240.     }
  241.     else if(CurButton & IN_ATTACK2)
  242.     {
  243.         if(get_pdata_float(id, 83, 5) <= 0.0)
  244.         {
  245.             set_weapon_anim(id, ANIM_SHOOT2)
  246.             FireArrow_Charge(id)
  247.             emit_sound(id, CHAN_VOICE, weapon_sound[1], 1.0, ATTN_NORM, 0, PITCH_NORM)
  248.             set_weapons_timeidle(id, CSW_TACT, STAB_TIME)
  249.             set_player_nextattackx(id, STAB_TIME)
  250.         }
  251.     }
  252. }
  253.  
  254. public throw_knife(id)
  255. {
  256.     FireArrow1(id)
  257.     FireArrow2(id)
  258.     FireArrow3(id)
  259. }
  260.  
  261. public FireArrow1(id)
  262. {
  263.     static Float:StartOrigin[3], Float:TargetOrigin[3], Float:angles[3], Float:anglestrue[3]
  264.     get_position(id, 2.0, 4.0, -3.0, StartOrigin)
  265.  
  266.     pev(id,pev_v_angle,angles)
  267.     static Ent; Ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
  268.     if(!pev_valid(Ent)) return
  269.     anglestrue[0] = 180.0 - angles[0]
  270.     anglestrue[1] = angles[1]
  271.     anglestrue[2] = angles[2]
  272.    
  273.     // Set info for ent
  274.     set_pev(Ent, pev_movetype, MOVETYPE_TOSS)
  275.     set_pev(Ent, pev_owner, id) // Better than pev_owner
  276.     set_pev(Ent, pev_fuser1, get_gametime() + 4.0)
  277.     set_pev(Ent, pev_nextthink, halflife_time() + 0.1)
  278.    
  279.     entity_set_string(Ent, EV_SZ_classname, SYSTEM_CLASSNAME)
  280.     engfunc(EngFunc_SetModel, Ent, ARROW_MODEL)
  281.     set_pev(Ent, pev_mins, Float:{-0.1, -0.1, -0.1})
  282.     set_pev(Ent, pev_maxs, Float:{0.1, 0.1, 0.1})
  283.     set_pev(Ent, pev_origin, StartOrigin)
  284.     set_pev(Ent, pev_angles, anglestrue)
  285.     set_pev(Ent, pev_gravity, 0.5)
  286.     set_pev(Ent, pev_solid, SOLID_BBOX)
  287.     set_pev(Ent, pev_frame, 0.0)
  288.    
  289.     static Float:Velocity[3]
  290.     get_position(id, 1024.0, 12.0, -12.0, TargetOrigin)
  291.     get_speed_vector(StartOrigin, TargetOrigin, 2300.0, Velocity)
  292.     set_pev(Ent, pev_velocity, Velocity)
  293.  
  294.    
  295.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  296.     write_byte(TE_BEAMFOLLOW) // Temporary entity ID
  297.     write_short(Ent) // Entity
  298.     write_short(sTrail) // Sprite index
  299.     write_byte(7) // Life
  300.     write_byte(1) // Line width
  301.     write_byte(255) // Red
  302.     write_byte(255) // Green
  303.     write_byte(255) // Blue
  304.     write_byte(65) // Alpha
  305.     message_end()
  306. }
  307.  
  308. public FireArrow2(id)
  309. {
  310.     static Float:StartOrigin[3], Float:TargetOrigin[3], Float:angles[3], Float:anglestrue[3]
  311.     get_position(id, 2.0, -4.0, -2.0, StartOrigin)
  312.  
  313.     pev(id,pev_v_angle,angles)
  314.     static Ent; Ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
  315.     if(!pev_valid(Ent)) return
  316.     anglestrue[0] = 180.0 - angles[0]
  317.     anglestrue[1] = angles[1]
  318.     anglestrue[2] = angles[2]
  319.    
  320.     // Set info for ent
  321.     set_pev(Ent, pev_movetype, MOVETYPE_TOSS)
  322.     set_pev(Ent, pev_owner, id) // Better than pev_owner
  323.     set_pev(Ent, pev_fuser1, get_gametime() + 4.0)
  324.     set_pev(Ent, pev_nextthink, halflife_time() + 0.1)
  325.    
  326.     entity_set_string(Ent, EV_SZ_classname, SYSTEM_CLASSNAME)
  327.     engfunc(EngFunc_SetModel, Ent, ARROW_MODEL)
  328.     set_pev(Ent, pev_mins, Float:{-0.1, -0.1, -0.1})
  329.     set_pev(Ent, pev_maxs, Float:{0.1, 0.1, 0.1})
  330.     set_pev(Ent, pev_origin, StartOrigin)
  331.     set_pev(Ent, pev_angles, anglestrue)
  332.     set_pev(Ent, pev_gravity, 0.5)
  333.     set_pev(Ent, pev_solid, SOLID_BBOX)
  334.     set_pev(Ent, pev_frame, 0.0)
  335.    
  336.     static Float:Velocity[3]
  337.     get_position(id, 1024.0, -12.0, -12.0, TargetOrigin)
  338.     get_speed_vector(StartOrigin, TargetOrigin, 2300.0, Velocity)
  339.     set_pev(Ent, pev_velocity, Velocity)
  340.  
  341.    
  342.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  343.     write_byte(TE_BEAMFOLLOW) // Temporary entity ID
  344.     write_short(Ent) // Entity
  345.     write_short(sTrail) // Sprite index
  346.     write_byte(7) // Life
  347.     write_byte(1) // Line width
  348.     write_byte(255) // Red
  349.     write_byte(255) // Green
  350.     write_byte(255) // Blue
  351.     write_byte(65) // Alpha
  352.     message_end()
  353. }
  354.  
  355. public FireArrow3(id)
  356. {
  357.     static Float:StartOrigin[3], Float:TargetOrigin[3], Float:angles[3], Float:anglestrue[3]
  358.     get_position(id, 2.0, 2.0, 4.0, StartOrigin)
  359.  
  360.     pev(id,pev_v_angle,angles)
  361.     static Ent; Ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
  362.     if(!pev_valid(Ent)) return
  363.     anglestrue[0] = 180.0 - angles[0]
  364.     anglestrue[1] = angles[1]
  365.     anglestrue[2] = angles[2]
  366.    
  367.     // Set info for ent
  368.     set_pev(Ent, pev_movetype, MOVETYPE_TOSS)
  369.     set_pev(Ent, pev_owner, id) // Better than pev_owner
  370.     set_pev(Ent, pev_fuser1, get_gametime() + 4.0)
  371.     set_pev(Ent, pev_nextthink, halflife_time() + 0.1)
  372.    
  373.     entity_set_string(Ent, EV_SZ_classname, SYSTEM_CLASSNAME)
  374.     engfunc(EngFunc_SetModel, Ent, ARROW_MODEL)
  375.     set_pev(Ent, pev_mins, Float:{-0.1, -0.1, -0.1})
  376.     set_pev(Ent, pev_maxs, Float:{0.1, 0.1, 0.1})
  377.     set_pev(Ent, pev_origin, StartOrigin)
  378.     set_pev(Ent, pev_angles, anglestrue)
  379.     set_pev(Ent, pev_gravity, 0.5)
  380.     set_pev(Ent, pev_solid, SOLID_BBOX)
  381.     set_pev(Ent, pev_frame, 0.0)
  382.    
  383.     static Float:Velocity[3]
  384.     get_position(id, 1024.0, 12.0, 12.0, TargetOrigin)
  385.     get_speed_vector(StartOrigin, TargetOrigin, 2300.0, Velocity)
  386.     set_pev(Ent, pev_velocity, Velocity)
  387.  
  388.    
  389.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  390.     write_byte(TE_BEAMFOLLOW) // Temporary entity ID
  391.     write_short(Ent) // Entity
  392.     write_short(sTrail) // Sprite index
  393.     write_byte(7) // Life
  394.     write_byte(1) // Line width
  395.     write_byte(255) // Red
  396.     write_byte(255) // Green
  397.     write_byte(255) // Blue
  398.     write_byte(65) // Alpha
  399.     message_end()
  400. }
  401.  
  402. public FireArrow_Charge(id)
  403. {
  404.     static Float:StartOrigin[3], Float:TargetOrigin[3], Float:angles[3]
  405.     get_position(id, 2.0, 0.0, 0.0, StartOrigin)
  406.  
  407.     pev(id,pev_angles,angles)
  408.     static Ent; Ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
  409.     if(!pev_valid(Ent)) return
  410.    
  411.     // Set info for ent
  412.     set_pev(Ent, pev_movetype, MOVETYPE_FLY)
  413.     set_pev(Ent, pev_owner, id) // Better than pev_owner
  414.     set_pev(Ent, pev_rendermode, kRenderTransAdd)
  415.     set_pev(Ent, pev_renderamt, 1.0)
  416.     set_pev(Ent, pev_fuser1, get_gametime() + 0.1)
  417.     set_pev(Ent, pev_nextthink, halflife_time() + 0.1)
  418.    
  419.     entity_set_string(Ent, EV_SZ_classname, SYSTEM_CLASSNAME2)
  420.     engfunc(EngFunc_SetModel, Ent, ARROW_MODEL)
  421.     set_pev(Ent, pev_mins, Float:{-0.1, -0.1, -0.1})
  422.     set_pev(Ent, pev_maxs, Float:{0.1, 0.1, 0.1})
  423.     set_pev(Ent, pev_origin, StartOrigin)
  424.     set_pev(Ent, pev_angles, angles)
  425.     set_pev(Ent, pev_gravity, 0.01)
  426.     set_pev(Ent, pev_solid, SOLID_BBOX)
  427.     set_pev(Ent, pev_frame, 0.0)
  428.    
  429.     static Float:Velocity[3]
  430.     fm_get_aim_origin(id, TargetOrigin)
  431.     get_speed_vector(StartOrigin, TargetOrigin, 800.0, Velocity)
  432.     set_pev(Ent, pev_velocity, Velocity)
  433. }
  434.  
  435. public fw_Think(ent)
  436. {
  437.     if(!pev_valid(ent))
  438.         return
  439.    
  440.     static Float:fFrame; pev(ent, pev_frame, fFrame)
  441.    
  442.     fFrame += 1.5
  443.     fFrame = floatmin(21.0, fFrame)
  444.    
  445.     set_pev(ent, pev_frame, fFrame)
  446.     set_pev(ent, pev_nextthink, get_gametime() + 0.05)
  447.    
  448.     // time remove
  449.     static Float:fTimeRemove, Float:Amount
  450.     pev(ent, pev_fuser1, fTimeRemove)
  451.     pev(ent, pev_renderamt, Amount)
  452.    
  453.     if(get_gametime() >= fTimeRemove)
  454.     {
  455.         remove_entity(ent)
  456.     }
  457. }
  458.  
  459.  
  460.  
  461. public fw_touch(Ent, Id)
  462. {
  463.     // If ent is valid
  464.     if(!pev_valid(Ent))
  465.         return
  466.     static Owner; Owner = pev(Ent, pev_owner)
  467.     if(pev(Ent, pev_movetype) == MOVETYPE_NONE)
  468.         return
  469.     static classnameptd[32]
  470.     pev(Id, pev_classname, classnameptd, 31)
  471.     if (equali(classnameptd, "func_breakable")) ExecuteHamB( Ham_TakeDamage, Id, 0, 0, 60.0, DMG_GENERIC )
  472.     Damage_tact(Ent, Id)
  473.    
  474.     // Get it's origin
  475.     new Float:originF[3]
  476.     pev(Ent, pev_origin, originF)
  477.     // Alive...
  478.    
  479.     if(is_user_alive(Id) && zp_get_user_zombie(Id))
  480.     {
  481.         remove_entity(Ent)
  482.         create_blood(originF)
  483.         create_blood(originF)
  484.         emit_sound(Id, CHAN_BODY, weapon_sound[3], 1.0, ATTN_NORM, 0, PITCH_NORM)
  485.     }
  486.    
  487.     else if(is_user_alive(Id) && !zp_get_user_zombie(Id))
  488.     {
  489.         remove_entity(Ent)
  490.         emit_sound(Id, CHAN_VOICE, weapon_sound[3], 1.0, ATTN_NORM, 0, PITCH_NORM)
  491.     }
  492.    
  493.     else
  494.     {
  495.         set_pev(Ent, pev_fuser1, get_gametime() + 1.0)
  496.         make_bullet(Owner, originF)
  497.         engfunc(EngFunc_EmitSound, Ent, CHAN_WEAPON, tact_wall[random( sizeof(tact_wall))], 1.0, ATTN_STATIC, 0, PITCH_NORM)
  498.         set_pev(Ent, pev_movetype, MOVETYPE_NONE)
  499.         set_pev(Ent, pev_solid, SOLID_NOT)
  500.     }
  501. }
  502.  
  503. public fw_touch2(Ent, Id)
  504. {
  505.     // If ent is valid
  506.     if(!pev_valid(Ent))
  507.         return
  508.     if(pev(Ent, pev_movetype) == MOVETYPE_NONE)
  509.         return
  510.    
  511.     static classnameptd[32]
  512.     pev(Id, pev_classname, classnameptd, 31)
  513.     if (equali(classnameptd, "func_breakable")) ExecuteHamB( Ham_TakeDamage, Id, 0, 0, 200.0, DMG_GENERIC )
  514.     Damage_tact2(Ent, Id)
  515.    
  516.     // Get it's origin
  517.     new Float:originF[3]
  518.     pev(Ent, pev_origin, originF)
  519.     // Alive...
  520.    
  521.     if(is_user_alive(Id) && zp_get_user_zombie(Id))
  522.     {
  523.         remove_entity(Ent)
  524.         create_blood(originF)
  525.         create_blood(originF)
  526.         emit_sound(Id, CHAN_BODY, weapon_sound[3], 1.0, ATTN_NORM, 0, PITCH_NORM)
  527.     }
  528.    
  529.     else if(is_user_alive(Id) && !zp_get_user_zombie(Id))
  530.     {
  531.         remove_entity(Ent)
  532.         emit_sound(Id, CHAN_VOICE, weapon_sound[3], 1.0, ATTN_NORM, 0, PITCH_NORM)
  533.     }
  534.    
  535.     else
  536.     {
  537.         engfunc(EngFunc_EmitSound, Ent, CHAN_WEAPON, tact_wall[random( sizeof(tact_wall))], 1.0, ATTN_STATIC, 0, PITCH_NORM)
  538.         set_pev(Ent, pev_movetype, MOVETYPE_NONE)
  539.         set_pev(Ent, pev_solid, SOLID_NOT)
  540.     }
  541. }
  542.        
  543. public Remove_tactBall(Ent)
  544. {
  545.     if(!pev_valid(Ent)) return
  546.     engfunc(EngFunc_RemoveEntity, Ent)
  547. }
  548.  
  549. public Damage_tact(Ent, Id)
  550. {
  551.     static Owner; Owner = pev(Ent, pev_owner)
  552.     static Attacker;
  553.     if(!is_user_alive(Owner))
  554.     {
  555.         Attacker = 0
  556.         return
  557.     } else Attacker = Owner
  558.    
  559.     if(g_endround)
  560.         return
  561.  
  562.     new bool:bIsHeadShot; // never make that one static
  563.     new Float:flAdjustedDamage, bool:death
  564.  
  565.     switch( Get_MissileWeaponHitGroup(Ent) )
  566.     {
  567.         case HIT_GENERIC: flAdjustedDamage = get_pcvar_float(cvar_dmg_slash_tact) * 1.5
  568.         case HIT_CHEST: flAdjustedDamage = get_pcvar_float(cvar_dmg_slash_tact) * 1.0
  569.         case HIT_STOMACH: flAdjustedDamage = get_pcvar_float(cvar_dmg_slash_tact) * 1.0
  570.         case HIT_LEFTLEG, HIT_RIGHTLEG: flAdjustedDamage = get_pcvar_float(cvar_dmg_slash_tact) * 0.75
  571.         case HIT_LEFTARM, HIT_RIGHTARM: flAdjustedDamage = get_pcvar_float(cvar_dmg_slash_tact) * 0.35
  572.         case HIT_HEAD:
  573.         {
  574.             flAdjustedDamage = get_pcvar_float(cvar_dmg_slash_tact) * 2.50
  575.             bIsHeadShot = true;
  576.         }
  577.     }
  578.     if(pev(Id, pev_health) <= flAdjustedDamage) death = true
  579.    
  580.     if(is_user_alive(Id))
  581.     {
  582.         if( bIsHeadShot && death)
  583.         {
  584.             emessage_begin(MSG_BROADCAST, g_MsgDeathMsg)
  585.             ewrite_byte(Attacker)
  586.             ewrite_byte(Id)
  587.             ewrite_byte(1)
  588.             ewrite_string("Triple Tactical Knife")
  589.             emessage_end()
  590.            
  591.             set_msg_block(g_MsgDeathMsg, BLOCK_SET)
  592.             user_silentkill(Id)
  593.             set_msg_block(g_MsgDeathMsg, BLOCK_NOT)
  594.  
  595.             death = false
  596.         }
  597.         else ExecuteHamB(Ham_TakeDamage, Id, Ent, Attacker, flAdjustedDamage, DMG_BULLET)
  598.     }
  599. }
  600.  
  601. public Damage_tact2(Ent, Id)
  602. {
  603.     static Owner; Owner = pev(Ent, pev_owner)
  604.     static Attacker;
  605.     if(!is_user_alive(Owner))
  606.     {
  607.         Attacker = 0
  608.         return
  609.     } else Attacker = Owner
  610.    
  611.     if(g_endround)
  612.         return
  613.    
  614.     new bool:bIsHeadShot; // never make that one static
  615.     new Float:flAdjustedDamage, bool:death
  616.  
  617.     switch( Get_MissileWeaponHitGroup(Ent) )
  618.     {
  619.         case HIT_GENERIC: flAdjustedDamage = get_pcvar_float(cvar_dmg_stab_tact) * 1.5
  620.         case HIT_CHEST: flAdjustedDamage = get_pcvar_float(cvar_dmg_stab_tact) * 1.0
  621.         case HIT_STOMACH: flAdjustedDamage = get_pcvar_float(cvar_dmg_stab_tact) * 1.0
  622.         case HIT_LEFTLEG, HIT_RIGHTLEG: flAdjustedDamage = get_pcvar_float(cvar_dmg_stab_tact) * 0.75
  623.         case HIT_LEFTARM, HIT_RIGHTARM: flAdjustedDamage = get_pcvar_float(cvar_dmg_stab_tact) * 0.35
  624.         case HIT_HEAD:
  625.         {
  626.             flAdjustedDamage = get_pcvar_float(cvar_dmg_stab_tact) * 2.50
  627.             bIsHeadShot = true;
  628.         }
  629.     }
  630.     if(pev(Id, pev_health) <= flAdjustedDamage) death = true
  631.    
  632.     if(is_user_alive(Id))
  633.     {
  634.         if( bIsHeadShot && death)
  635.         {
  636.             emessage_begin(MSG_BROADCAST, g_MsgDeathMsg)
  637.             ewrite_byte(Attacker)
  638.             ewrite_byte(Id)
  639.             ewrite_byte(1)
  640.             ewrite_string("Triple Tactical Knife")
  641.             emessage_end()
  642.            
  643.             set_msg_block(g_MsgDeathMsg, BLOCK_SET)
  644.             user_silentkill(Id)
  645.             set_msg_block(g_MsgDeathMsg, BLOCK_NOT)
  646.  
  647.             death = false
  648.         }
  649.         else ExecuteHamB(Ham_TakeDamage, Id, Ent, Attacker, flAdjustedDamage, DMG_BULLET)
  650.     }
  651. }
  652.  
  653. public fw_SetModel(entity, model[])
  654. {
  655.     if(!pev_valid(entity))
  656.         return FMRES_IGNORED
  657.    
  658.     static Classname[64]
  659.     pev(entity, pev_classname, Classname, sizeof(Classname))
  660.    
  661.     if(!equal(Classname, "weaponbox"))
  662.         return FMRES_IGNORED
  663.    
  664.     static id
  665.     id = pev(entity, pev_owner)
  666.    
  667.     if(equal(model, old_w_model))
  668.     {
  669.         static weapon
  670.         weapon = fm_get_user_weapon_entity(entity, CSW_TACT)
  671.        
  672.         if(!pev_valid(weapon))
  673.             return FMRES_IGNORED
  674.        
  675.         if(g_had_tact[id])
  676.         {
  677.             set_pev(weapon, pev_impulse, WEAPON_SECRETCODE)
  678.             set_pev(weapon, pev_iuser4, g_tact_ammo[id])
  679.             engfunc(EngFunc_SetModel, entity, w_model)
  680.            
  681.             g_had_tact[id] = 0
  682.             g_tact_ammo[id] = 0
  683.            
  684.             return FMRES_SUPERCEDE
  685.         }
  686.     }
  687.  
  688.     return FMRES_IGNORED;
  689. }
  690.  
  691. public fw_AddToPlayer_Post(ent, id)
  692. {
  693.     if(pev(ent, pev_impulse) == WEAPON_SECRETCODE)
  694.     {
  695.         g_had_tact[id] = 1
  696.         g_tact_ammo[id] = pev(ent, pev_iuser4)
  697.        
  698.         set_pev(ent, pev_impulse, 0)
  699.     }          
  700.    
  701.     message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("WeaponList"), _, id)
  702.     write_string((g_had_tact[id] == 1 ? "weapon_tknifeex2" : "weapon_p228"))
  703.     write_byte(1)
  704.     write_byte(52)
  705.     write_byte(-1)
  706.     write_byte(-1)
  707.     write_byte(1)
  708.     write_byte(3)
  709.     write_byte(CSW_TACT)
  710.     write_byte(0)
  711.     message_end()
  712. }
  713.  
  714. public update_ammo(id)
  715. {
  716.     if(!is_user_alive(id))
  717.         return
  718.    
  719.     static weapon_ent; weapon_ent = fm_find_ent_by_owner(-1, weapon_tact, id)
  720.     if(pev_valid(weapon_ent)) cs_set_weapon_ammo(weapon_ent, 1) 
  721.    
  722.     cs_set_user_bpammo(id, CSW_P228, 0)
  723.    
  724.     engfunc(EngFunc_MessageBegin, MSG_ONE_UNRELIABLE, get_user_msgid("CurWeapon"), {0, 0, 0}, id)
  725.     write_byte(1)
  726.     write_byte(CSW_TACT)
  727.     write_byte(-1)
  728.     message_end()
  729.    
  730.     message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("AmmoX"), _, id)
  731.     write_byte(1)
  732.     write_byte(g_tact_ammo[id])
  733.     message_end()
  734. }
  735.  
  736. stock make_bullet(id, Float:Origin[3])
  737. {
  738.     // Find target
  739.     new decal = random_num(41, 45)
  740.     const loop_time = 2
  741.    
  742.     static Body, Target
  743.     get_user_aiming(id, Target, Body, 999999)
  744.    
  745.     if(is_user_connected(Target))
  746.         return
  747.    
  748.     for(new i = 0; i < loop_time; i++)
  749.     {
  750.         // Put decal on "world" (a wall)
  751.         message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  752.         write_byte(TE_WORLDDECAL)
  753.         engfunc(EngFunc_WriteCoord, Origin[0])
  754.         engfunc(EngFunc_WriteCoord, Origin[1])
  755.         engfunc(EngFunc_WriteCoord, Origin[2])
  756.         write_byte(decal)
  757.         message_end()
  758.        
  759.         // Show sparcles
  760.         message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  761.         write_byte(TE_GUNSHOTDECAL)
  762.         engfunc(EngFunc_WriteCoord, Origin[0])
  763.         engfunc(EngFunc_WriteCoord, Origin[1])
  764.         engfunc(EngFunc_WriteCoord, Origin[2])
  765.         write_short(id)
  766.         write_byte(decal)
  767.         message_end()
  768.     }
  769. }
  770.  
  771. stock set_weapon_anim(id, anim)
  772. {
  773.     if(!is_user_alive(id))
  774.         return
  775.    
  776.     set_pev(id, pev_weaponanim, anim)
  777.    
  778.     message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, {0, 0, 0}, id)
  779.     write_byte(anim)
  780.     write_byte(pev(id, pev_body))
  781.     message_end()
  782. }
  783.  
  784. stock create_blood(const Float:origin[3])
  785. {
  786.     // Show some blood :)
  787.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  788.     write_byte(TE_BLOODSPRITE)
  789.     engfunc(EngFunc_WriteCoord, origin[0])
  790.     engfunc(EngFunc_WriteCoord, origin[1])
  791.     engfunc(EngFunc_WriteCoord, origin[2])
  792.     write_short(m_iBlood[1])
  793.     write_short(m_iBlood[0])
  794.     write_byte(75)
  795.     write_byte(8)
  796.     message_end()
  797. }
  798.  
  799. stock drop_weapons(id, dropwhat)
  800. {
  801.     static weapons[32], num, i, weaponid
  802.     num = 0
  803.     get_user_weapons(id, weapons, num)
  804.      
  805.     for (i = 0; i < num; i++)
  806.     {
  807.         weaponid = weapons[i]
  808.          
  809.         if (dropwhat == 1 && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM))
  810.         {
  811.             static wname[32]
  812.             get_weaponname(weaponid, wname, sizeof wname - 1)
  813.             engclient_cmd(id, "drop", wname)
  814.         }
  815.     }
  816. }
  817.  
  818. stock get_speed_vector(const Float:origin1[3],const Float:origin2[3],Float:speed, Float:new_velocity[3])
  819. {
  820.     new_velocity[0] = origin2[0] - origin1[0]
  821.     new_velocity[1] = origin2[1] - origin1[1]
  822.     new_velocity[2] = origin2[2] - origin1[2]
  823.     static Float:num; num = floatsqroot(speed*speed / (new_velocity[0]*new_velocity[0] + new_velocity[1]*new_velocity[1] + new_velocity[2]*new_velocity[2]))
  824.     new_velocity[0] *= num
  825.     new_velocity[1] *= num
  826.     new_velocity[2] *= num
  827.    
  828.     return 1;
  829. }
  830.  
  831. stock Get_MissileWeaponHitGroup( iEnt )
  832. {
  833.     new Float:flStart[ 3 ], Float:flEnd[ 3 ];
  834.    
  835.     pev( iEnt, pev_origin, flStart );
  836.     pev( iEnt, pev_velocity, flEnd );
  837.     xs_vec_add( flStart, flEnd, flEnd );
  838.    
  839.     new ptr = create_tr2();
  840.     engfunc( EngFunc_TraceLine, flStart, flEnd, 0, iEnt, ptr );
  841.    
  842.     new iHitGroup
  843.     iHitGroup = get_tr2( ptr, TR_iHitgroup )
  844.     free_tr2( ptr );
  845.    
  846.     return iHitGroup;
  847. }
  848.  
  849. stock get_position(id,Float:forw, Float:right, Float:up, Float:vStart[])
  850. {
  851.     static Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
  852.    
  853.     pev(id, pev_origin, vOrigin)
  854.     pev(id, pev_view_ofs, vUp) //for player
  855.     xs_vec_add(vOrigin, vUp, vOrigin)
  856.     pev(id, pev_v_angle, vAngle) // if normal entity ,use pev_angles
  857.    
  858.     angle_vector(vAngle, ANGLEVECTOR_FORWARD, vForward) //or use EngFunc_AngleVectors
  859.     angle_vector(vAngle, ANGLEVECTOR_RIGHT, vRight)
  860.     angle_vector(vAngle, ANGLEVECTOR_UP, vUp)
  861.    
  862.     vStart[0] = vOrigin[0] + vForward[0] * forw + vRight[0] * right + vUp[0] * up
  863.     vStart[1] = vOrigin[1] + vForward[1] * forw + vRight[1] * right + vUp[1] * up
  864.     vStart[2] = vOrigin[2] + vForward[2] * forw + vRight[2] * right + vUp[2] * up
  865. }
  866.  
  867. stock set_weapons_timeidle(id, WeaponId ,Float:TimeIdle)
  868. {
  869.     if(!is_user_alive(id))
  870.         return
  871.        
  872.     static entwpn; entwpn = fm_get_user_weapon_entity(id, WeaponId)
  873.     if(!pev_valid(entwpn))
  874.         return
  875.        
  876.     set_pdata_float(entwpn, 46, TimeIdle, OFFSET_LINUX_WEAPONS)
  877.     set_pdata_float(entwpn, 47, TimeIdle, OFFSET_LINUX_WEAPONS)
  878.     set_pdata_float(entwpn, 48, TimeIdle + 0.5, OFFSET_LINUX_WEAPONS)
  879. }
  880.  
  881. stock set_player_nextattackx(id, Float:nexttime)
  882. {
  883.     if(!is_user_alive(id))
  884.         return
  885.        
  886.     set_pdata_float(id, m_flNextAttack, nexttime, 5)
  887. }
  888.  


Dekui is karto :)



_________________
Ačiū kad padedate pradedančiajam :)

Paveikslėlis
Atsijungęs
 Aprašymas  
 
 Pranešimo tema: Re: pagalbos zp_extra_items
Žinutės numeris: #2  StandartinėParašytas: 2018 Sau 20 22:51 
Jau po truputį tampa savu

Užsiregistravo: 2016 Sau 17 20:11
Pranešimai: 173
Karma: 3
patikrink ar tas entity i kuri sauni yra zaidejas. is_user_connected() arba is_user_alive(). turetu uztekt connected. arba kaskas tokio if(1<=entity<=32).


Atsijungęs
 Aprašymas  
 
 Pranešimo tema: Re: pagalbos zp_extra_items
Žinutės numeris: #3  StandartinėParašytas: 2018 Sau 21 15:31 
Jau po truputį tampa savu

Užsiregistravo: 2015 Gru 24 14:55
Pranešimai: 159
Karma: 7

Miestas: Kaunas
Softero rašė:
patikrink ar tas entity i kuri sauni yra zaidejas. is_user_connected() arba is_user_alive(). turetu uztekt connected. arba kaskas tokio if(1<=entity<=32).

gal gali biski placiau paaiskinti, nes nelabai supratau :)



_________________
Ačiū kad padedate pradedančiajam :)

Paveikslėlis
Atsijungęs
 Aprašymas  
 
 Pranešimo tema: Re: pagalbos zp_extra_items
Žinutės numeris: #4  StandartinėParašytas: 2018 Sau 21 22:26 
Jau po truputį tampa savu

Užsiregistravo: 2016 Sau 17 20:11
Pranešimai: 173
Karma: 3
istrink situos:
  1.  
  2.     if (equali(classnameptd, "func_breakable")) ExecuteHamB( Ham_TakeDamage, Id, 0, 0, 60.0, DMG_GENERIC )
  3.     if (equali(classnameptd, "func_breakable")) ExecuteHamB( Ham_TakeDamage, Id, 0, 0, 200.0, DMG_GENERIC )
  4.  


Paskutinį kartą redagavo Softero 2018 Sau 22 11:32. Iš viso redaguota 1 kartą.

Atsijungęs
 Aprašymas  
 
 Pranešimo tema: Re: pagalbos zp_extra_items
Žinutės numeris: #5  StandartinėParašytas: 2018 Sau 27 23:31 
Jau po truputį tampa savu

Užsiregistravo: 2015 Gru 24 14:55
Pranešimai: 159
Karma: 7

Miestas: Kaunas
Gal galit dar su vienu itemu padet, problema tapati ir dar butu gerai kad kai sauni Special Shoot pataikius i ct ju nenumestu toint tai veiktu tik pries t komanda
  1.  
  2. ***********************************************************************
  3. ************************** http://WWW.ZOMBIE-MOD.RU **************************
  4. ***********************************************************************
  5. ****** The Plugins Is Made Indonesia :) || Sorry For Bad Coding *******
  6. ** My Group Community: Counter:Strike Zombie Plague Modder Indonesia **
  7. ***********************************************************************
  8. */
  9.  
  10. #include <amxmodx>
  11. #include <engine>
  12. #include <fakemeta>
  13. #include <fakemeta_util>
  14. #include <hamsandwich>
  15. #include <cstrike>
  16. #include <xs>
  17.  
  18. #define PLUGIN "[CSO] AK47 PALADIN || NATIVE ONLY"
  19. #define VERSION "1.0 || CLOSED BETA"
  20. #define AUTHOR "AsepKhairulAnam@CS:ZPMI || -RequiemID- || Facebook.com/asepdwa11"
  21.  
  22. // CONFIGURATION WEAPON
  23. #define system_name     "buffak"
  24. #define system_base     "ak47"
  25.  
  26. #define DRAW_TIME       0.66
  27. #define RELOAD_TIME     2.1
  28.  
  29. #define CSW_BASE        CSW_AK47
  30. #define WEAPON_KEY      11092002112
  31.  
  32. #define OLD_MODEL       "models/w_ak47.mdl"
  33. #define ANIMEXT         "carbine"
  34.  
  35. // ALL MACRO
  36. #define ENG_NULLENT     -1
  37. #define EV_INT_WEAPONKEY    EV_INT_impulse
  38. #define TASK_MUZZLEFLASH    102291
  39.  
  40. #define USE_STOPPED         0
  41. #define OFFSET_LINUX_WEAPONS    4
  42. #define OFFSET_LINUX        5
  43. #define OFFSET_WEAPONOWNER  41
  44. #define OFFSET_ACTIVE_ITEM  373
  45.  
  46. #define m_fKnown        44
  47. #define m_flNextPrimaryAttack   46
  48. #define m_flTimeWeaponIdle  48
  49. #define m_iClip         51
  50. #define m_fInReload     54
  51. #define m_flNextAttack      83
  52. #define write_coord_f(%1)   engfunc(EngFunc_WriteCoord,%1)
  53.  
  54. // ALL ANIM
  55. #define ANIM_RELOAD     1
  56. #define ANIM_DRAW       2
  57. #define ANIM_SHOOT1     3
  58. #define ANIM_SHOOT2     4
  59. #define ANIM_SHOOT3     5
  60.  
  61. #define MODE_A          0
  62. #define MODE_B          1
  63.  
  64. // All Models Of The Weapon
  65. new V_MODEL[64] = "models/v_buffak_fix.mdl"
  66. new W_MODEL[64] = "models/w_buffak.mdl"
  67. new P_MODEL[64] = "models/p_buffak.mdl"
  68. new S_MODEL[64] = "sprites/asep/ef_buffak_hit.spr"
  69.  
  70. new const WeaponResources[][] =
  71. {
  72.     "sprites/asep/640hud7.spr",
  73.     "sprites/asep/640hud132.spr"
  74. }
  75.  
  76. new const MuzzleFlash[][] =
  77. {
  78.     "sprites/asep/muzzleflash40.spr",
  79.     "sprites/asep/muzzleflash41.spr"
  80. }
  81.  
  82. // You Can Add Fire Sound Here
  83. new const Fire_Sounds[][] = { "weapons/ak47buff-1.wav", "weapons/ak47buff-2.wav" }
  84.  
  85. // All Vars Here
  86. new const GUNSHOT_DECALS[] = { 41, 42, 43, 44, 45 }
  87. new cvar_dmg, cvar_recoil, cvar_clip, cvar_spd, cvar_ammo, cvar_radius, cvar_dmg_2, cvar_trace_color
  88. new g_MaxPlayers, g_orig_event, g_IsInPrimaryAttack, g_attack_type[33], Float:cl_pushangle[33][3]
  89. new g_has_weapon[33], g_clip_ammo[33], g_weapon_TmpClip[33], oldweap[33], sBuffakHit
  90. new g_Muzzleflash_Ent[2], g_Muzzleflash[33][2], g_Mode[33], g_list_variables[10]
  91.  
  92. // Macros Again :v
  93. new weapon_name_buffer[512]
  94. new weapon_base_buffer[512]
  95.        
  96. const PRIMARY_WEAPONS_BIT_SUM =
  97. (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<<
  98. 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)
  99. new const WEAPONENTNAMES[][] = { "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10",
  100.             "weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550",
  101.             "weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249",
  102.             "weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552",
  103.             "weapon_ak47", "weapon_knife", "weapon_p90" }
  104.  
  105. // START TO CREATE PLUGINS || AMXMODX FORWARD
  106. public plugin_init()
  107. {
  108.     formatex(weapon_name_buffer, sizeof(weapon_name_buffer), "weapon_%s_asep", system_name)
  109.     formatex(weapon_base_buffer, sizeof(weapon_base_buffer), "weapon_%s", system_base)
  110.    
  111.     register_plugin(PLUGIN, VERSION, AUTHOR)
  112.    
  113.     // Event And Message
  114.     register_event("CurWeapon", "Forward_CurrentWeapon", "be", "1=1")
  115.     register_message(get_user_msgid("DeathMsg"), "Forward_DeathMsg")
  116.     register_message(get_user_msgid("WeaponList"), "Forward_MessageWeapList")
  117.    
  118.     // Ham Forward (Entity) || Ham_Use
  119.     RegisterHam(Ham_Use, "func_tank", "Forward_UseStationary_Post", 1)
  120.     RegisterHam(Ham_Use, "func_tankmortar", "Forward_UseStationary_Post", 1)
  121.     RegisterHam(Ham_Use, "func_tankrocket", "Forward_UseStationary_Post", 1)
  122.     RegisterHam(Ham_Use, "func_tanklaser", "Forward_UseStationary_Post", 1)
  123.    
  124.     // Ham Forward (Entity) || Ham_TraceAttack
  125.     RegisterHam(Ham_TraceAttack, "player", "Forward_TraceAttack", 1)
  126.     RegisterHam(Ham_TraceAttack, "worldspawn", "Forward_TraceAttack", 1)
  127.     RegisterHam(Ham_TraceAttack, "func_wall", "Forward_TraceAttack", 1)
  128.     RegisterHam(Ham_TraceAttack, "func_breakable", "Forward_TraceAttack", 1)
  129.     RegisterHam(Ham_TraceAttack, "func_door", "Forward_TraceAttack", 1)
  130.     RegisterHam(Ham_TraceAttack, "func_door_rotating", "Forward_TraceAttack", 1)
  131.     RegisterHam(Ham_TraceAttack, "func_rotating", "Forward_TraceAttack", 1)
  132.     RegisterHam(Ham_TraceAttack, "func_plat", "Forward_TraceAttack", 1)
  133.    
  134.     // Ham Forward (Weapon)
  135.     RegisterHam(Ham_Weapon_PrimaryAttack, weapon_base_buffer, "Weapon_PrimaryAttack")
  136.     RegisterHam(Ham_Weapon_PrimaryAttack, weapon_base_buffer, "Weapon_PrimaryAttack_Post", 1)
  137.     RegisterHam(Ham_Item_PostFrame, weapon_base_buffer, "Weapon_ItemPostFrame")
  138.     RegisterHam(Ham_Weapon_Reload, weapon_base_buffer, "Weapon_Reload")
  139.     RegisterHam(Ham_Weapon_Reload, weapon_base_buffer, "Weapon_Reload_Post", 1)
  140.     RegisterHam(Ham_Item_AddToPlayer, weapon_base_buffer, "Weapon_AddToPlayer")
  141.    
  142.     for(new i = 1; i < sizeof WEAPONENTNAMES; i++)
  143.         if(WEAPONENTNAMES[i][0]) RegisterHam(Ham_Item_Deploy, WEAPONENTNAMES[i], "Weapon_Deploy_Post", 1)
  144.        
  145.     // Ham Forward (Player)
  146.     RegisterHam(Ham_Killed, "player", "Forward_PlayerKilled")
  147.    
  148.     // Fakemeta Forward
  149.     register_forward(FM_SetModel, "Forward_SetModel")
  150.     register_forward(FM_PlaybackEvent, "Forward_PlaybackEvent")
  151.     register_forward(FM_UpdateClientData, "Forward_UpdateClientData_Post", 1)
  152.     register_forward(FM_AddToFullPack, "Forward_AddToFullPack", 1)
  153.     register_forward(FM_CheckVisibility, "Forward_CheckVisibility")
  154.    
  155.     // All Some Cvar
  156.     cvar_clip = register_cvar("buffak_clip", "50")
  157.     cvar_spd = register_cvar("buffak_speed", "1.15")
  158.     cvar_ammo = register_cvar("buffak_ammo", "240")
  159.     cvar_dmg = register_cvar("buffak_damage", "2.0")
  160.     cvar_recoil = register_cvar("buffak_recoil", "0.62")
  161.     cvar_dmg_2 = register_cvar("buffak_buff_damage", "100")
  162.     cvar_radius = register_cvar("buffak_buff_radius", "50")
  163.     cvar_trace_color = register_cvar("buffak_trace_color", "7")
  164.    
  165.     g_MaxPlayers = get_maxplayers()
  166. }
  167.  
  168. public plugin_precache()
  169. {
  170.     formatex(weapon_name_buffer, sizeof(weapon_name_buffer), "weapon_%s_asep", system_name)
  171.     formatex(weapon_base_buffer, sizeof(weapon_base_buffer), "weapon_%s", system_base)
  172.    
  173.     precache_model(V_MODEL)
  174.     precache_model(P_MODEL)
  175.     precache_model(W_MODEL)
  176.     sBuffakHit = precache_model(S_MODEL)
  177.    
  178.     new Buffer[512]
  179.     formatex(Buffer, sizeof(Buffer), "sprites/%s.txt", weapon_name_buffer)
  180.     precache_generic(Buffer) // EG: Output "sprites/weapon_buffak_asep.txt"
  181.    
  182.     for(new i = 0; i < sizeof Fire_Sounds; i++)
  183.         precache_sound(Fire_Sounds[i])
  184.     for(new i = 0; i < sizeof MuzzleFlash; i++)
  185.         precache_model(MuzzleFlash[i])
  186.     for(new i = 0; i < sizeof WeaponResources; i++)
  187.         precache_model(WeaponResources[i])
  188.        
  189.     precache_viewmodel_sound(V_MODEL)
  190.     formatex(Buffer, sizeof(Buffer), "test_%s", system_name)
  191.    
  192.     register_clcmd(Buffer, "give_item") // EG: Output "test_buffak"
  193.     register_clcmd(weapon_name_buffer, "weapon_hook")
  194.     register_forward(FM_PrecacheEvent, "Forward_PrecacheEvent_Post", 1)
  195.    
  196.     g_Muzzleflash_Ent[0] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
  197.     engfunc(EngFunc_SetModel, g_Muzzleflash_Ent[0], MuzzleFlash[0])
  198.     set_pev(g_Muzzleflash_Ent[0], pev_scale, 0.08)
  199.     set_pev(g_Muzzleflash_Ent[0], pev_rendermode, kRenderTransTexture)
  200.     set_pev(g_Muzzleflash_Ent[0], pev_renderamt, 0.0)
  201.  
  202.     g_Muzzleflash_Ent[1] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
  203.     engfunc(EngFunc_SetModel, g_Muzzleflash_Ent[1], MuzzleFlash[1])
  204.     set_pev(g_Muzzleflash_Ent[1], pev_scale, 0.07)
  205.     set_pev(g_Muzzleflash_Ent[1], pev_rendermode, kRenderTransTexture)
  206.     set_pev(g_Muzzleflash_Ent[1], pev_renderamt, 0.0)
  207. }
  208.  
  209. public plugin_natives()
  210. {
  211.     new Buffer[512]
  212.     formatex(Buffer, sizeof(Buffer), "give_%s", system_name)
  213.     register_native(Buffer, "give_item", 1) // EG: Output "give_buffak"
  214.     formatex(Buffer, sizeof(Buffer), "remove_%s", system_name)
  215.     register_native(Buffer, "remove_item", 1) // EG: Output "remove_buffak"
  216. }
  217.  
  218. // Reset Bitvar (Fix Bug) If You Connect Or Disconnect Server
  219. public client_connect(id) remove_item(id)
  220. public client_disconnect(id) remove_item(id)
  221. /* ========= START OF REGISTER HAM TO SUPPORT BOTS FUNC ========= */
  222. new g_HamBot
  223. public client_putinserver(id)
  224. {
  225.     if(!g_HamBot && is_user_bot(id))
  226.     {
  227.         g_HamBot = 1
  228.         set_task(0.1, "Do_RegisterHam", id)
  229.     }
  230. }
  231.  
  232. public Do_RegisterHam(id)
  233. {
  234.     RegisterHamFromEntity(Ham_Killed, id, "Forward_PlayerKilled")
  235.     RegisterHamFromEntity(Ham_TraceAttack, id, "Forward_TraceAttack", 1)
  236. }
  237.  
  238. /* ======== END OF REGISTER HAM TO SUPPORT BOTS FUNC ============= */
  239. /* ============ START OF ALL FORWARD (FAKEMETA) ================== */
  240. public Forward_AddToFullPack(esState, iE, iEnt, iHost, iHostFlags, iPlayer, pSet)
  241. {
  242.     if(iEnt == g_Muzzleflash_Ent[0])
  243.     {
  244.         if(g_Muzzleflash[iHost][0] == 3)
  245.         {
  246.             set_es(esState, ES_RenderMode, kRenderTransAdd)
  247.             set_es(esState, ES_RenderAmt, random_float(200.0, 255.0))
  248.             set_es(esState, ES_Scale, random_float(0.06, 0.1))
  249.            
  250.             g_Muzzleflash[iHost][0] = 2
  251.         }
  252.         else if(g_Muzzleflash[iHost][0] == 2)
  253.         {
  254.             set_es(esState, ES_RenderMode, kRenderTransAdd)
  255.             set_es(esState, ES_RenderAmt, random_float(200.0, 255.0))
  256.             set_es(esState, ES_Scale, random_float(0.06, 0.1))
  257.            
  258.             g_Muzzleflash[iHost][0] = 1
  259.             g_Muzzleflash[iHost][1] = 1
  260.         }
  261.         else if(g_Muzzleflash[iHost][0] == 1)
  262.         {
  263.             set_es(esState, ES_RenderMode, kRenderTransAdd)
  264.             set_es(esState, ES_RenderAmt, random_float(200.0, 255.0))
  265.             set_es(esState, ES_Scale, random_float(0.06, 0.1))
  266.            
  267.             g_Muzzleflash[iHost][0] = 0
  268.         }
  269.            
  270.         set_es(esState, ES_Skin, iHost)
  271.         set_es(esState, ES_Body, 1)
  272.         set_es(esState, ES_AimEnt, iHost)
  273.         set_es(esState, ES_MoveType, MOVETYPE_FOLLOW)
  274.     }
  275.     else if(iEnt == g_Muzzleflash_Ent[1])
  276.     {
  277.         if(g_Muzzleflash[iHost][1])
  278.         {
  279.             set_es(esState, ES_RenderMode, kRenderTransAdd)
  280.             set_es(esState, ES_RenderAmt, 240.0)
  281.            
  282.             g_Muzzleflash[iHost][1] = 0
  283.         }
  284.            
  285.         set_es(esState, ES_Skin, iHost)
  286.         set_es(esState, ES_Body, 1)
  287.         set_es(esState, ES_AimEnt, iHost)
  288.         set_es(esState, ES_MoveType, MOVETYPE_FOLLOW)
  289.     }
  290.  
  291. }
  292.  
  293. public Forward_CheckVisibility(iEntity, pSet)
  294. {
  295.     if(iEntity == g_Muzzleflash_Ent[0] || iEntity == g_Muzzleflash_Ent[1])
  296.     {
  297.         forward_return(FMV_CELL, 1)
  298.         return FMRES_SUPERCEDE
  299.     }
  300.    
  301.     return FMRES_IGNORED
  302. }
  303.  
  304. public Forward_PrecacheEvent_Post(type, const name[])
  305. {
  306.     new Buffer[512]
  307.     formatex(Buffer, sizeof(Buffer), "events/%s.sc", system_base)
  308.     if(equal(Buffer, name, 0))
  309.     {
  310.         g_orig_event = get_orig_retval()
  311.         return FMRES_HANDLED
  312.     }
  313.     return FMRES_IGNORED
  314. }
  315.  
  316. public Forward_SetModel(entity, model[])
  317. {
  318.     if(!is_valid_ent(entity))
  319.         return FMRES_IGNORED
  320.    
  321.     static szClassName[33]
  322.     entity_get_string(entity, EV_SZ_classname, szClassName, charsmax(szClassName))
  323.        
  324.     if(!equal(szClassName, "weaponbox"))
  325.         return FMRES_IGNORED
  326.    
  327.     static iOwner
  328.     iOwner = entity_get_edict(entity, EV_ENT_owner)
  329.    
  330.     if(equal(model, OLD_MODEL))
  331.     {
  332.         static iStoredAugID
  333.         iStoredAugID = find_ent_by_owner(ENG_NULLENT, weapon_base_buffer, entity)
  334.            
  335.         if(!is_valid_ent(iStoredAugID))
  336.             return FMRES_IGNORED
  337.  
  338.         if(g_has_weapon[iOwner])
  339.         {
  340.             entity_set_int(iStoredAugID, EV_INT_WEAPONKEY, WEAPON_KEY)
  341.             g_has_weapon[iOwner] = 0
  342.             entity_set_model(entity, W_MODEL)
  343.            
  344.             return FMRES_SUPERCEDE
  345.         }
  346.     }
  347.     return FMRES_IGNORED
  348. }
  349.  
  350. public Forward_UseStationary_Post(entity, caller, activator, use_type)
  351. {
  352.     if(use_type == USE_STOPPED && is_user_connected(caller))
  353.         replace_weapon_models(caller, get_user_weapon(caller))
  354. }
  355.  
  356. public Forward_UpdateClientData_Post(Player, SendWeapons, CD_Handle)
  357. {
  358.     if(!is_user_alive(Player) || (get_user_weapon(Player) != CSW_BASE || !g_has_weapon[Player]))
  359.         return FMRES_IGNORED
  360.    
  361.     set_cd(CD_Handle, CD_flNextAttack, halflife_time () + 0.001)
  362.     return FMRES_HANDLED
  363. }
  364.  
  365. public Forward_PlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2)
  366. {
  367.     if((eventid != g_orig_event) || !g_IsInPrimaryAttack)
  368.         return FMRES_IGNORED
  369.     if(!(1 <= invoker <= g_MaxPlayers))
  370.         return FMRES_IGNORED
  371.  
  372.     playback_event(flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2)
  373.     return FMRES_SUPERCEDE
  374. }
  375.  
  376. /* ================= END OF ALL FAKEMETA FORWARD ================= */
  377. /* ================= START OF ALL MESSAGE FORWARD ================ */
  378. public Forward_DeathMsg(msg_id, msg_dest, id)
  379. {
  380.     static szTruncatedWeapon[33], iAttacker, iVictim
  381.    
  382.     get_msg_arg_string(4, szTruncatedWeapon, charsmax(szTruncatedWeapon))
  383.    
  384.     iAttacker = get_msg_arg_int(1)
  385.     iVictim = get_msg_arg_int(2)
  386.    
  387.     if(!is_user_connected(iAttacker) || iAttacker == iVictim)
  388.         return PLUGIN_CONTINUE
  389.    
  390.     if(equal(szTruncatedWeapon, system_base) && get_user_weapon(iAttacker) == CSW_BASE)
  391.     {
  392.         if(g_has_weapon[iAttacker])
  393.             set_msg_arg_string(4, system_name)
  394.     }
  395.     return PLUGIN_CONTINUE
  396. }
  397. /* ================== END OF ALL MESSAGE FORWARD ================ */
  398. /* ================== START OF ALL EVENT FORWARD ================ */
  399. public Forward_MessageWeapList(msg_id, msg_dest, id)
  400. {
  401.     if(get_msg_arg_int(8) != CSW_BASE)
  402.         return
  403.  
  404.     g_list_variables[2] = get_msg_arg_int(2)
  405.     g_list_variables[3] = get_msg_arg_int(3)
  406.     g_list_variables[4] = get_msg_arg_int(4)
  407.     g_list_variables[5] = get_msg_arg_int(5)
  408.     g_list_variables[6] = get_msg_arg_int(6)
  409.     g_list_variables[7] = get_msg_arg_int(7)
  410.     g_list_variables[8] = get_msg_arg_int(8)
  411.     g_list_variables[9] = get_msg_arg_int(9)
  412. }
  413.  
  414. public Forward_CurrentWeapon(id)
  415. {
  416.     replace_weapon_models(id, read_data(2))
  417.      
  418.     if(!is_user_alive(id))
  419.         return
  420.     if(read_data(2) != CSW_BASE || !g_has_weapon[id])
  421.         return
  422.      
  423.     static Float:Speed
  424.     if(g_has_weapon[id])
  425.         Speed = get_pcvar_float(cvar_spd)
  426.    
  427.     static weapon[32], Ent
  428.     get_weaponname(read_data(2), weapon, 31)
  429.     Ent = find_ent_by_owner(-1, weapon, id)
  430.     if(pev_valid(Ent))
  431.     {
  432.         static Float:Delay
  433.         Delay = get_pdata_float(Ent, 46, 4) * Speed
  434.         if(Delay > 0.0) set_pdata_float(Ent, 46, Delay, 4)
  435.     }
  436. }
  437. /* ================== END OF ALL EVENT FORWARD =================== */
  438. /* ================== START OF ALL HAM FORWARD ============== */
  439. public Forward_PlayerKilled(id) remove_item(id)
  440. public Forward_TraceAttack(iEnt, iAttacker, Float:flDamage, Float:fDir[3], ptr, iDamageType)
  441. {
  442.     if(!is_user_alive(iAttacker) || !is_user_connected(iAttacker))
  443.         return
  444.     if(get_user_weapon(iAttacker) != CSW_BASE || !g_has_weapon[iAttacker])
  445.         return
  446.  
  447.     static Float:flEnd[3], Float:WallVector[3], trace_color
  448.     get_tr2(ptr, TR_vecEndPos, flEnd)
  449.     get_tr2(ptr, TR_vecPlaneNormal, WallVector)
  450.    
  451.     if(iEnt)
  452.     {
  453.         message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  454.         write_byte(TE_DECAL)
  455.         write_coord_f(flEnd[0])
  456.         write_coord_f(flEnd[1])
  457.         write_coord_f(flEnd[2])
  458.         write_byte(GUNSHOT_DECALS[random_num (0, sizeof GUNSHOT_DECALS -1)])
  459.         write_short(iEnt)
  460.         message_end()
  461.     }
  462.     else
  463.     {
  464.         message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  465.         write_byte(TE_WORLDDECAL)
  466.         write_coord_f(flEnd[0])
  467.         write_coord_f(flEnd[1])
  468.         write_coord_f(flEnd[2])
  469.         write_byte(GUNSHOT_DECALS[random_num (0, sizeof GUNSHOT_DECALS -1)])
  470.         message_end()
  471.     }
  472.    
  473.     if(g_Mode[iAttacker] == MODE_A)
  474.     {
  475.         if(!is_user_alive(iEnt)) trace_color = get_pcvar_num(cvar_trace_color)
  476.         else if(is_user_alive(iEnt)) trace_color = 2000 // NO STREAK COLOR or Disabled
  477.         ExecuteHamB(Ham_TakeDamage, iEnt, iAttacker, iAttacker, flDamage * get_pcvar_float(cvar_dmg), DMG_BULLET)
  478.     }
  479.    
  480.     if(pev(iEnt, pev_takedamage) != DAMAGE_NO)
  481.     {
  482.         set_hudmessage(255, 0, 0, -1.0, 0.46, 0, 0.2, 0.2)
  483.         show_hudmessage(iAttacker, "\        /^n+^n/         \")
  484.     }
  485.    
  486.     if(trace_color < 2000)
  487.     {
  488.         message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  489.         write_byte(TE_STREAK_SPLASH)
  490.         engfunc(EngFunc_WriteCoord, flEnd[0])
  491.         engfunc(EngFunc_WriteCoord, flEnd[1])
  492.         engfunc(EngFunc_WriteCoord, flEnd[2])
  493.         engfunc(EngFunc_WriteCoord, WallVector[0] * random_float(25.0,30.0))
  494.         engfunc(EngFunc_WriteCoord, WallVector[1] * random_float(25.0,30.0))
  495.         engfunc(EngFunc_WriteCoord, WallVector[2] * random_float(25.0,30.0))
  496.         write_byte(trace_color)
  497.         write_short(50)
  498.         write_short(3)
  499.         write_short(90) 
  500.         message_end()
  501.        
  502.         message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  503.         write_byte(TE_GUNSHOTDECAL)
  504.         write_coord_f(flEnd[0])
  505.         write_coord_f(flEnd[1])
  506.         write_coord_f(flEnd[2])
  507.         write_short(iAttacker)
  508.         write_byte(GUNSHOT_DECALS[random_num (0, sizeof GUNSHOT_DECALS -1)])
  509.         message_end()
  510.     }
  511. }
  512.  
  513. public Weapon_Deploy_Post(weapon_entity)
  514. {
  515.     static owner
  516.     owner = fm_cs_get_weapon_ent_owner(weapon_entity)
  517.    
  518.     static weaponid
  519.     weaponid = cs_get_weapon_id(weapon_entity)
  520.    
  521.     replace_weapon_models(owner, weaponid)
  522. }
  523.  
  524. public Weapon_AddToPlayer(weapon_entity, id)
  525. {
  526.     if(!is_valid_ent(weapon_entity) || !is_user_connected(id))
  527.         return HAM_IGNORED
  528.    
  529.     if(entity_get_int(weapon_entity, EV_INT_WEAPONKEY) == WEAPON_KEY)
  530.     {
  531.         g_has_weapon[id] = true
  532.         entity_set_int(weapon_entity, EV_INT_WEAPONKEY, 0)
  533.         set_weapon_list(id, weapon_name_buffer)
  534.        
  535.         return HAM_HANDLED
  536.     }
  537.     else
  538.     {
  539.         set_weapon_list(id, weapon_base_buffer)
  540.     }
  541.    
  542.     return HAM_IGNORED
  543. }
  544.  
  545. public Weapon_PrimaryAttack(weapon_entity)
  546. {
  547.     new Player = get_pdata_cbase(weapon_entity, 41, 4)
  548.    
  549.     if(!g_has_weapon[Player])
  550.         return
  551.    
  552.     g_IsInPrimaryAttack = 1
  553.     pev(Player,pev_punchangle,cl_pushangle[Player])
  554.    
  555.     g_clip_ammo[Player] = cs_get_weapon_ammo(weapon_entity)
  556. }
  557.  
  558. public Weapon_PrimaryAttack_Post(weapon_entity)
  559. {
  560.     g_IsInPrimaryAttack = 0
  561.     new Player = get_pdata_cbase(weapon_entity, 41, 4)
  562.    
  563.     new szClip, szAmmo
  564.     get_user_weapon(Player, szClip, szAmmo)
  565.    
  566.     if(!is_user_alive(Player))
  567.         return
  568.        
  569.     if(g_has_weapon[Player])
  570.     {
  571.         if(!g_clip_ammo[Player])
  572.         {
  573.             ExecuteHam(Ham_Weapon_PlayEmptySound, weapon_entity)
  574.             return
  575.         }
  576.        
  577.         new Float:push[3]
  578.         pev(Player,pev_punchangle,push)
  579.         xs_vec_sub(push,cl_pushangle[Player],push)
  580.         xs_vec_mul_scalar(push,get_pcvar_float(cvar_recoil),push)
  581.         xs_vec_add(push,cl_pushangle[Player],push)
  582.         set_pev(Player,pev_punchangle,push)
  583.        
  584.         set_weapon_shoot_anim(Player)
  585.         emit_sound(Player, CHAN_WEAPON, Fire_Sounds[0], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  586.         set_task(random_float(0.001, 0.005), "Re_MuzzleFlash", Player+TASK_MUZZLEFLASH)
  587.     }
  588. }
  589.  
  590. public Weapon_ItemPostFrame(weapon_entity)
  591. {
  592.     new id = pev(weapon_entity, pev_owner)
  593.     if(!is_user_connected(id))
  594.         return HAM_IGNORED
  595.     if(!g_has_weapon[id])
  596.         return HAM_IGNORED
  597.  
  598.     static iClipExtra
  599.     iClipExtra = get_pcvar_num(cvar_clip)
  600.     new Float:flNextAttack = get_pdata_float(id, m_flNextAttack, OFFSET_LINUX)
  601.  
  602.     new iBpAmmo = cs_get_user_bpammo(id, CSW_BASE)
  603.     new iClip = get_pdata_int(weapon_entity, m_iClip, OFFSET_LINUX_WEAPONS)
  604.  
  605.     new fInReload = get_pdata_int(weapon_entity, m_fInReload, OFFSET_LINUX_WEAPONS)
  606.     if(fInReload && flNextAttack <= 0.0)
  607.     {
  608.         new j = min(iClipExtra - iClip, iBpAmmo)
  609.    
  610.         set_pdata_int(weapon_entity, m_iClip, iClip + j, OFFSET_LINUX_WEAPONS)
  611.         cs_set_user_bpammo(id, CSW_BASE, iBpAmmo-j)
  612.        
  613.         set_pdata_int(weapon_entity, m_fInReload, 0, OFFSET_LINUX_WEAPONS)
  614.         fInReload = 0
  615.     }
  616.     else if(!fInReload && !get_pdata_int(weapon_entity, 74, 4))
  617.     {
  618.         if(!iClip)
  619.             return HAM_IGNORED
  620.            
  621.         if(get_pdata_float(id, 83, 5) <= 0.0 && get_pdata_float(weapon_entity, 46, 4) <= 0.0 ||
  622.         get_pdata_float(weapon_entity, 47, 4) <= 0.0 || get_pdata_float(weapon_entity, 48, 4) <= 0.0)
  623.         {
  624.             if(pev(id, pev_button) & IN_ATTACK)
  625.             {
  626.                 if(g_Mode[id] == MODE_B)
  627.                     Shoot_Special(id)
  628.             }
  629.             else if(pev(id, pev_button) & IN_ATTACK2)
  630.             {
  631.                 set_buffak_zoom(id, 0)
  632.                 set_weapons_timeidle(id, CSW_BASE, 0.4)
  633.                 set_player_nextattackx(id, 0.4)
  634.             }
  635.         }
  636.     }
  637.    
  638.     return HAM_IGNORED
  639. }
  640.  
  641. public Weapon_Reload(weapon_entity)
  642. {
  643.     new id = pev(weapon_entity, pev_owner)
  644.     if(!is_user_connected(id))
  645.         return HAM_IGNORED
  646.     if(!g_has_weapon[id])
  647.         return HAM_IGNORED
  648.     static iClipExtra
  649.     if(g_has_weapon[id])
  650.         iClipExtra = get_pcvar_num(cvar_clip)
  651.  
  652.     g_weapon_TmpClip[id] = -1
  653.  
  654.     new iBpAmmo = cs_get_user_bpammo(id, CSW_BASE)
  655.     new iClip = get_pdata_int(weapon_entity, m_iClip, OFFSET_LINUX_WEAPONS)
  656.  
  657.     if(iBpAmmo <= 0)
  658.         return HAM_SUPERCEDE
  659.  
  660.     if(iClip >= iClipExtra)
  661.         return HAM_SUPERCEDE
  662.  
  663.     g_weapon_TmpClip[id] = iClip
  664.  
  665.     return HAM_IGNORED
  666. }
  667.  
  668. public Weapon_Reload_Post(weapon_entity)
  669. {
  670.     new id = pev(weapon_entity, pev_owner)
  671.     if (!is_user_connected(id))
  672.         return HAM_IGNORED
  673.  
  674.     if(!g_has_weapon[id])
  675.         return HAM_IGNORED
  676.     if(g_weapon_TmpClip[id] == -1)
  677.         return HAM_IGNORED
  678.    
  679.     set_pdata_int(weapon_entity, m_iClip, g_weapon_TmpClip[id], OFFSET_LINUX_WEAPONS)
  680.     set_pdata_float(weapon_entity, m_flTimeWeaponIdle, RELOAD_TIME, OFFSET_LINUX_WEAPONS)
  681.     set_pdata_float(id, m_flNextAttack, RELOAD_TIME, OFFSET_LINUX)
  682.     set_pdata_int(weapon_entity, m_fInReload, 1, OFFSET_LINUX_WEAPONS)
  683.    
  684.     set_weapon_anim(id, ANIM_RELOAD)
  685.     set_pdata_string(id, (492) * 4, ANIMEXT, -1 , 20)
  686.     set_buffak_zoom(id, 1)
  687.    
  688.     return HAM_IGNORED
  689. }
  690.  
  691. /* ===================== END OF ALL HAM FORWARD ====================== */
  692. /* ================= START OF OTHER PUBLIC FUNCTION  ================= */
  693. public give_item(id)
  694. {
  695.     drop_weapons(id, 1)
  696.     new iWeapon = fm_give_item(id, weapon_base_buffer)
  697.     if(iWeapon > 0)
  698.     {
  699.         cs_set_weapon_ammo(iWeapon, get_pcvar_num(cvar_clip))
  700.         cs_set_user_bpammo(id, CSW_BASE, get_pcvar_num(cvar_ammo))
  701.         emit_sound(id, CHAN_ITEM, "items/gunpickup2.wav", VOL_NORM, ATTN_NORM,0,PITCH_NORM)
  702.        
  703.         set_weapon_anim(id, ANIM_DRAW)
  704.         set_pdata_float(id, m_flNextAttack, DRAW_TIME, OFFSET_LINUX)
  705.        
  706.         set_weapon_list(id, weapon_name_buffer)
  707.         set_pdata_string(id, (492) * 4, ANIMEXT, -1 , 20)
  708.         set_pdata_int(iWeapon, 74, MODE_A)
  709.     }
  710.    
  711.     g_has_weapon[id] = true
  712.     g_Mode[id] = MODE_A
  713.     remove_bitvar(id)
  714. }
  715.  
  716. public remove_item(id)
  717. {
  718.     g_has_weapon[id] = false
  719.     g_Mode[id] = MODE_A
  720.     remove_bitvar(id)
  721. }
  722.  
  723. public remove_bitvar(id)
  724. {
  725.     g_attack_type[id] = 0
  726.     g_Muzzleflash[id][0] = 0
  727.     g_Muzzleflash[id][1] = 0
  728. }
  729.  
  730. public weapon_hook(id)
  731. {
  732.     engclient_cmd(id, weapon_base_buffer)
  733.     return PLUGIN_HANDLED
  734. }
  735.  
  736. public replace_weapon_models(id, weaponid)
  737. {
  738.     if(weaponid != CSW_BASE)
  739.     {
  740.         if(g_has_weapon[id])
  741.         {
  742.             remove_bitvar(id)
  743.             set_buffak_zoom(id, 1)
  744.         }
  745.     }
  746.    
  747.     switch(weaponid)
  748.     {
  749.         case CSW_BASE:
  750.         {
  751.             if(g_has_weapon[id])
  752.             {
  753.                 set_pev(id, pev_viewmodel2, V_MODEL)
  754.                 set_pev(id, pev_weaponmodel2, P_MODEL)
  755.                
  756.                 if(oldweap[id] != CSW_BASE)
  757.                 {
  758.                     set_weapon_anim(id, ANIM_DRAW)
  759.                     set_player_nextattackx(id, DRAW_TIME)
  760.                     set_weapons_timeidle(id, CSW_BASE, DRAW_TIME)
  761.                     set_weapon_list(id, weapon_name_buffer)
  762.                     set_pdata_string(id, (492) * 4, ANIMEXT, -1 , 20)
  763.                 }
  764.             }
  765.         }
  766.     }
  767.    
  768.     oldweap[id] = weaponid
  769. }
  770.  
  771. public Shoot_Special(id)
  772. {
  773.     if(!is_user_alive(id) || !is_user_connected(id))
  774.         return
  775.        
  776.     new szClip, szWeapId
  777.     szWeapId = get_user_weapon(id, szClip)
  778.     if(szWeapId != CSW_BASE || !g_has_weapon[id] || !szClip)
  779.         return
  780.    
  781.     g_Muzzleflash[id][0] = 3
  782.     set_task(random_float(0.001, 0.005), "Re_MuzzleFlash", id+TASK_MUZZLEFLASH)
  783.    
  784.     static Float:PunchAngles[3]
  785.     PunchAngles[0] = -5.0
  786.     PunchAngles[1] = -2.5
  787.     PunchAngles[2] = -2.5
  788.     set_pev(id, pev_punchangle, PunchAngles)
  789.    
  790.     set_weapon_shoot_anim(id)
  791.     emit_sound(id, CHAN_WEAPON, Fire_Sounds[1], 1.0, ATTN_NORM, 0, PITCH_NORM)
  792.    
  793.     new Float:fStart[3], Float:originF[3]
  794.     new target, body
  795.    
  796.     fm_get_aim_origin(id, originF)
  797.     get_user_aiming(id, target, body)
  798.    
  799.     pev(id, pev_origin, fStart)
  800.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, fStart, 0)
  801.     write_byte(TE_SPRITE)
  802.     engfunc(EngFunc_WriteCoord, originF[0])
  803.     engfunc(EngFunc_WriteCoord, originF[1])
  804.     engfunc(EngFunc_WriteCoord, originF[2] + 20.0)
  805.     write_short(sBuffakHit)
  806.     write_byte(10)
  807.     write_byte(240)
  808.     message_end()
  809.    
  810.     new a = FM_NULLENT
  811.     while((a = find_ent_in_sphere(a, originF, float(get_pcvar_num(cvar_radius)))) != 0)
  812.     {
  813.         if(id == a)
  814.             continue
  815.    
  816.         if(pev(a, pev_takedamage) != DAMAGE_NO)
  817.             ExecuteHamB(Ham_TakeDamage, a, 0, id, float(get_pcvar_num(cvar_dmg_2)), DMG_BULLET)
  818.     }
  819.    
  820.     if(!is_user_alive(target))
  821.     {
  822.         static Classname[32]
  823.         pev(target, pev_classname, Classname, sizeof(Classname))
  824.        
  825.         if(equal(Classname, "func_breakable"))
  826.             ExecuteHamB(Ham_TakeDamage, target, 0, 0, float(get_pcvar_num(cvar_dmg_2)), DMG_GENERIC)
  827.     }
  828.     else if(is_user_alive(target) && is_user_connected(target))
  829.     {
  830.         static Float:MyOrigin[3]
  831.         pev(id, pev_origin, MyOrigin)
  832.         hook_ent2(target, MyOrigin, 400.0, 2)
  833.         ExecuteHamB(Ham_TakeDamage, target, 0, id, float(get_pcvar_num(cvar_dmg_2))*0.75, DMG_BULLET)
  834.     }
  835.    
  836.     static entity_weapon
  837.     entity_weapon = find_ent_by_owner(ENG_NULLENT, weapon_base_buffer, id)
  838.    
  839.     if(!pev_valid(entity_weapon))
  840.         return
  841.    
  842.     cs_set_weapon_ammo(entity_weapon, szClip - 1)
  843.     set_player_nextattackx(id, 0.7)
  844.     set_weapons_timeidle(id, CSW_BASE, 0.7)
  845. }
  846.  
  847. public set_weapon_shoot_anim(id)
  848. {
  849.     if(!g_attack_type[id])
  850.     {
  851.         set_weapon_anim(id, ANIM_SHOOT1)
  852.         g_attack_type[id] = 1
  853.     }
  854.     else if(g_attack_type[id] == 1)
  855.     {
  856.         set_weapon_anim(id, ANIM_SHOOT2)
  857.         g_attack_type[id] = 2
  858.     }
  859.     else if(g_attack_type[id] == 2)
  860.     {
  861.         set_weapon_anim(id, ANIM_SHOOT3)
  862.         g_attack_type[id] = 0
  863.     }
  864. }
  865.  
  866. public Re_MuzzleFlash(id)
  867. {
  868.     id -= TASK_MUZZLEFLASH
  869.  
  870.     if(!is_user_alive(id) || !is_user_connected(id))
  871.         return
  872.     if(get_user_weapon(id) != CSW_BASE || !g_has_weapon[id])
  873.         return
  874.    
  875.     if(g_Mode[id] == MODE_A) g_Muzzleflash[id][0] = true
  876.     else if(g_Mode[id] == MODE_B) g_Muzzleflash[id][1] = true
  877. }
  878.  
  879. /* ============= END OF OTHER PUBLIC FUNCTION (Weapon) ============= */
  880. /* ================= START OF ALL STOCK TO MACROS ================== */
  881. stock set_buffak_zoom(id, const reset = 0)
  882. {
  883.     if(reset == 1)
  884.     {
  885.         set_fov(id)
  886.         g_Mode[id] = MODE_A
  887.     }
  888.     else if(reset == 0)
  889.     {
  890.         if(g_Mode[id] == MODE_A)
  891.         {
  892.             set_fov(id, 80)
  893.             g_Mode[id] = MODE_B
  894.         }
  895.         else if(g_Mode[id] == MODE_B)
  896.         {
  897.             set_fov(id)
  898.             g_Mode[id] = MODE_A
  899.         }
  900.     }
  901. }
  902.  
  903. stock set_fov(id, fov = 90)
  904. {
  905.     message_begin(MSG_ONE, get_user_msgid("SetFOV"), {0,0,0}, id)
  906.     write_byte(fov)
  907.     message_end()
  908. }
  909.  
  910. stock set_weapon_list(id, const weapon_name[])
  911. {
  912.     message_begin(MSG_ONE, get_user_msgid("WeaponList"), {0,0,0}, id)
  913.     write_string(weapon_name)
  914.     write_byte(g_list_variables[2])
  915.     write_byte(g_list_variables[3])
  916.     write_byte(g_list_variables[4])
  917.     write_byte(g_list_variables[5])
  918.     write_byte(g_list_variables[6])
  919.     write_byte(g_list_variables[7])
  920.     write_byte(g_list_variables[8])
  921.     write_byte(g_list_variables[9])
  922.     message_end()
  923. }
  924.  
  925. stock hook_ent2(ent, Float:VicOrigin[3], Float:speed, type)
  926. {
  927.     static Float:fl_Velocity[3]
  928.     static Float:EntOrigin[3]
  929.    
  930.     pev(ent, pev_origin, EntOrigin)
  931.     static Float:distance_f
  932.     distance_f = 100.0
  933.    
  934.     new Float:fl_Time = distance_f / speed
  935.     if(type == 1)
  936.     {
  937.         fl_Velocity[0] = ((VicOrigin[0] - EntOrigin[0]) / fl_Time) * 1.5
  938.         fl_Velocity[1] = ((VicOrigin[1] - EntOrigin[1]) / fl_Time) * 1.5
  939.         fl_Velocity[2] = (VicOrigin[2] - EntOrigin[2]) / fl_Time       
  940.     }
  941.     else if(type == 2)
  942.     {
  943.         fl_Velocity[0] = ((EntOrigin[0] - VicOrigin[0]) / fl_Time) * 1.5
  944.         fl_Velocity[1] = ((EntOrigin[1] - VicOrigin[1]) / fl_Time) * 1.5
  945.         fl_Velocity[2] = (EntOrigin[2] - VicOrigin[2]) / fl_Time
  946.     }
  947.    
  948.     entity_set_vector(ent, EV_VEC_velocity, fl_Velocity)
  949. }
  950.  
  951. stock drop_weapons(id, dropwhat)
  952. {
  953.     static weapons[32], num = 0, i, weaponid
  954.     get_user_weapons(id, weapons, num)
  955.    
  956.     for (i = 0; i < num; i++)
  957.     {
  958.         weaponid = weapons[i]
  959.          
  960.         if(dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM))
  961.         {
  962.             static wname[32]
  963.             get_weaponname(weaponid, wname, sizeof wname - 1)
  964.             engclient_cmd(id, "drop", wname)
  965.         }
  966.     }
  967. }
  968.  
  969. stock set_player_nextattackx(id, Float:nexttime)
  970. {
  971.     if(!is_user_alive(id))
  972.         return
  973.        
  974.     set_pdata_float(id, m_flNextAttack, nexttime, 5)
  975. }
  976.  
  977. stock set_weapons_timeidle(id, WeaponId ,Float:TimeIdle)
  978. {
  979.     if(!is_user_alive(id))
  980.         return
  981.        
  982.     static entwpn; entwpn = fm_get_user_weapon_entity(id, WeaponId)
  983.     if(!pev_valid(entwpn))
  984.         return
  985.        
  986.     set_pdata_float(entwpn, 46, TimeIdle, OFFSET_LINUX_WEAPONS)
  987.     set_pdata_float(entwpn, 47, TimeIdle, OFFSET_LINUX_WEAPONS)
  988.     set_pdata_float(entwpn, 48, TimeIdle + 1.0, OFFSET_LINUX_WEAPONS)
  989. }
  990.  
  991. stock set_weapons_timeidlex(id, Float:TimeIdle, Float:Idle)
  992. {
  993.     new entwpn = fm_get_user_weapon_entity(id, CSW_BASE)
  994.     if(!pev_valid(entwpn))
  995.         return
  996.    
  997.     set_pdata_float(entwpn, 46, TimeIdle, 4)
  998.     set_pdata_float(entwpn, 47, TimeIdle, 4)
  999.     set_pdata_float(entwpn, 48, Idle, 4)
  1000. }
  1001.  
  1002. stock set_weapon_anim(const Player, const Sequence)
  1003. {
  1004.     set_pev(Player, pev_weaponanim, Sequence)
  1005.    
  1006.     message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, .player = Player)
  1007.     write_byte(Sequence)
  1008.     write_byte(pev(Player, pev_body))
  1009.     message_end()
  1010. }
  1011.  
  1012. stock precache_viewmodel_sound(const model[]) // I Get This From BTE
  1013. {
  1014.     new file, i, k
  1015.     if((file = fopen(model, "rt")))
  1016.     {
  1017.         new szsoundpath[64], NumSeq, SeqID, Event, NumEvents, EventID
  1018.         fseek(file, 164, SEEK_SET)
  1019.         fread(file, NumSeq, BLOCK_INT)
  1020.         fread(file, SeqID, BLOCK_INT)
  1021.        
  1022.         for(i = 0; i < NumSeq; i++)
  1023.         {
  1024.             fseek(file, SeqID + 48 + 176 * i, SEEK_SET)
  1025.             fread(file, NumEvents, BLOCK_INT)
  1026.             fread(file, EventID, BLOCK_INT)
  1027.             fseek(file, EventID + 176 * i, SEEK_SET)
  1028.            
  1029.             // The Output Is All Sound To Precache In ViewModels (GREAT :V)
  1030.             for(k = 0; k < NumEvents; k++)
  1031.             {
  1032.                 fseek(file, EventID + 4 + 76 * k, SEEK_SET)
  1033.                 fread(file, Event, BLOCK_INT)
  1034.                 fseek(file, 4, SEEK_CUR)
  1035.                
  1036.                 if(Event != 5004)
  1037.                     continue
  1038.                
  1039.                 fread_blocks(file, szsoundpath, 64, BLOCK_CHAR)
  1040.                
  1041.                 if(strlen(szsoundpath))
  1042.                 {
  1043.                     strtolower(szsoundpath)
  1044.                     engfunc(EngFunc_PrecacheSound, szsoundpath)
  1045.                 }
  1046.             }
  1047.         }
  1048.     }
  1049.     fclose(file)
  1050. }
  1051.  
  1052. stock fm_cs_get_weapon_ent_owner(ent)
  1053. {
  1054.     return get_pdata_cbase(ent, OFFSET_WEAPONOWNER, OFFSET_LINUX_WEAPONS)
  1055. }
  1056.  
  1057. /* ================= END OF ALL STOCK AND PLUGINS CREATED ================== */
  1058.  
  1059.  
Dekui jei kas padesit :)


Edit

del deziu sprogimo jau susitvarkiau problema


Paskutinį kartą redagavo KaimyneliS 2018 Sau 27 23:51. Iš viso redaguota 1 kartą.


_________________
Ačiū kad padedate pradedančiajam :)

Paveikslėlis
Atsijungęs
 Aprašymas  
 
Rodyti paskutinius pranešimus:  Rūšiuoti pagal  
 Puslapis 11 [ 5 pranešimai(ų) ] 


Dabar prisijungę

Vartotojai naršantys šį forumą: Registruotų vartotojų nėra ir 1 svečias


Jūs negalite kurti naujų temų šiame forume
Jūs negalite atsakinėti į temas šiame forume
Jūs negalite redaguoti savo pranešimų šiame forume
Jūs negalite trinti savo pranešimų šiame forume
Jūs negalite prikabinti failų šiame forume

Ieškoti:
Pereiti į: