Solved CSO guns

Unpaid Requests, Public Plugins
czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 598
Joined: 7 years ago
Contact:

CSO guns

#1

Post by czirimbolo » 7 years ago

Image

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#2

Post by johnnysins2000 » 7 years ago

Wait for Jack and Raheem bro (Because I am on mobile and can't code In Mobile)

All Of Your Request Is making me impatient That I want to return to ze as soon I can
Nobody Is That Busy If They Make Time :roll:

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 598
Joined: 7 years ago
Contact:

#3

Post by czirimbolo » 7 years ago

johnny, finish those exams and back to us ;)
Image

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#4

Post by johnnysins2000 » 7 years ago

czirimbolo wrote: 7 years ago johnny, finish those exams and back to us ;)

OK bro
Nobody Is That Busy If They Make Time :roll:

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#5

Post by Night Fury » 7 years ago

J3:
  1. #include <zombie_escape>
  2. #include <fakemeta_util>
  3. #include <cstrike>
  4.  
  5. const USE_STOPPED = 0
  6. const OFFSET_ACTIVE_ITEM = 373
  7. const OFFSET_WEAPONOWNER = 41
  8. const OFFSET_LINUX = 5
  9. const OFFSET_LINUX_WEAPONS = 4
  10. const m_szAnimExtention = 492
  11.  
  12. #if cellbits == 32
  13. const OFFSET_CLIPAMMO = 51
  14. #else
  15. const OFFSET_CLIPAMMO = 65
  16. #endif
  17.  
  18. #define WEAP_LINUX_XTRA_OFF     4
  19. #define m_fKnown                    44
  20. #define m_flNextPrimaryAttack       46
  21. #define m_flTimeWeaponIdle          48
  22. #define m_iClip                 51
  23. #define m_fInReload             54
  24. #define PLAYER_LINUX_XTRA_OFF   5
  25. #define m_flNextAttack              83
  26. #define janus3_READY 20
  27. #define janus3_RELOAD_TIME  3.0
  28.  
  29. enum
  30. {
  31.     ANIM_IDLE = 0,
  32.     ANIM_RELOAD_NORMAL,
  33.     ANIM_DRAW_NORMAL,
  34.     ANIM_SHOOT_NORMAL,
  35.     ANIM_SHOOT_SIGNAL,
  36.     ANIM_CHANGE_1,
  37.     ANIM_IDLE_B,
  38.     ANIM_DRAW_B,
  39.     ANIM_SHOOT_B,
  40.     ANIM_SHOOT_B2,
  41.     ANIM_SHOOT_B3,
  42.     ANIM_CHANGE_2,
  43.     ANIM_SIGNAL,
  44.     ANIM_RELOAD_SIGNAL,
  45.     ANIM_DRAW_SIGNAL
  46. }
  47.  
  48. #define write_coord_f(%1)   engfunc(EngFunc_WriteCoord,%1)
  49.  
  50. new const Fire_Sounds[][] = { "weapons/janusmk5-12.wav" }
  51. new const Fire_Sounds2[][] = { "weapons/janusmk5-2.wav" }
  52.  
  53. new janus3_V_MODEL[64] = "models/v_janus3.mdl"
  54. new janus3_P_MODEL[64] = "models/p_janus3.mdl"
  55. new janus3_W_MODEL[64] = "models/w_janus3.mdl"
  56.  
  57. new const GUNSHOT_DECALS[] = { 41, 42, 43, 44, 45 }
  58.  
  59. new cvar_dmg_janus3, cvar_dmg2_janus3, cvar_recoil_janus3, cvar_recoil2_janus3, cvar_clip_janus3, cvar_spd_janus3, cvar_spd2_janus3, cvar_janus3_ammo
  60. new g_MaxPlayers, g_orig_event_janus3, g_IsInPrimaryAttack
  61. new Float:cl_pushangle[32 + 1][3], m_iBlood[2]
  62. new g_has_janus3[33], g_clip_ammo[33], g_janus3_TmpClip[33], oldweap[33], janus3_mode[33], janus3_signal[33], siap_janus3[33]
  63. new gmsgWeaponList, g_Ham_Bot, item_janus
  64.  
  65. const PRIMARY_WEAPONS_BIT_SUM =
  66. (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<<
  67. 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)
  68. new const WEAPONENTNAMES[][] = { "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10",
  69.             "weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550",
  70.             "weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249",
  71.             "weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552",
  72.             "weapon_ak47", "weapon_knife", "weapon_p90" }
  73.  
  74. public plugin_init()
  75. {
  76.     register_plugin("Janus-3", "1.0", "m4m3ts")
  77.     register_cvar("janus3_version", "m4m3ts", FCVAR_SERVER|FCVAR_SPONLY)
  78.     register_message(get_user_msgid("DeathMsg"), "message_DeathMsg")
  79.     register_event("CurWeapon","CurrentWeapon","be","1=1")
  80.     register_forward(FM_SetModel, "fw_SetModel")
  81.     register_forward(FM_CmdStart, "fw_CmdStart")
  82.     register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1)
  83.     register_forward(FM_PlaybackEvent, "fwPlaybackEvent")
  84.     RegisterHookChain(RG_CBasePlayer_Spawn, "Player_Spawn", 1)
  85.     RegisterHookChain(RG_CBasePlayer_TakeDamage, "fw_TakeDamage")
  86.     RegisterHam(Ham_Item_AddToPlayer, "weapon_galil", "fw_janus3_AddToPlayer")
  87.     RegisterHam(Ham_Use, "func_tank", "fw_UseStationary_Post", 1)
  88.     RegisterHam(Ham_Use, "func_tankmortar", "fw_UseStationary_Post", 1)
  89.     RegisterHam(Ham_Use, "func_tankrocket", "fw_UseStationary_Post", 1)
  90.     RegisterHam(Ham_Use, "func_tanklaser", "fw_UseStationary_Post", 1)
  91.     for (new i = 1; i < sizeof WEAPONENTNAMES; i++)
  92.     if (WEAPONENTNAMES[i][0]) RegisterHam(Ham_Item_Deploy, WEAPONENTNAMES[i], "fw_Item_Deploy_Post", 1)
  93.     RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_galil", "fw_janus3_PrimaryAttack")
  94.     RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_galil", "fw_janus3_PrimaryAttack_Post", 1)
  95.     RegisterHam(Ham_Item_PostFrame, "weapon_galil", "janus3_ItemPostFrame")
  96.     RegisterHam(Ham_Weapon_Reload, "weapon_galil", "janus3_Reload")
  97.     RegisterHam(Ham_Weapon_Reload, "weapon_galil", "janus3_Reload_Post", 1)
  98.     RegisterHam(Ham_Weapon_WeaponIdle, "weapon_galil", "fw_janus3idleanim", 1)
  99.     RegisterHam(Ham_TraceAttack, "worldspawn", "fw_TraceAttack", 1)
  100.     RegisterHam(Ham_TraceAttack, "func_breakable", "fw_TraceAttack", 1)
  101.     RegisterHam(Ham_TraceAttack, "func_wall", "fw_TraceAttack", 1)
  102.     RegisterHam(Ham_TraceAttack, "func_door", "fw_TraceAttack", 1)
  103.     RegisterHam(Ham_TraceAttack, "func_door_rotating", "fw_TraceAttack", 1)
  104.     RegisterHam(Ham_TraceAttack, "func_plat", "fw_TraceAttack", 1)
  105.     RegisterHam(Ham_TraceAttack, "func_rotating", "fw_TraceAttack", 1)
  106.  
  107.     cvar_dmg_janus3 = register_cvar("ze_janus3_dmg", "1.0")
  108.     cvar_dmg2_janus3 = register_cvar("ze_janus3_dmg2", "2.0")
  109.     cvar_recoil_janus3 = register_cvar("ze_janus3_recoil", "0.8")
  110.     cvar_recoil2_janus3 = register_cvar("ze_janus3_recoil2", "0.45")
  111.     cvar_clip_janus3 = register_cvar("ze_janus3_clip", "50")
  112.     cvar_spd_janus3 = register_cvar("ze_janus3_spd", "1.1")
  113.     cvar_spd2_janus3 = register_cvar("ze_janus3_spd2", "0.07")
  114.     cvar_janus3_ammo = register_cvar("ze_janus3_ammo", "200")
  115.    
  116.     item_janus = ze_register_item("Janus-3", 20)
  117.        
  118.     g_MaxPlayers = get_member_game(m_nMaxPlayers)
  119.     gmsgWeaponList = get_user_msgid("WeaponList")
  120. }
  121.  
  122. public plugin_precache()
  123. {
  124.     precache_model(janus3_V_MODEL)
  125.     precache_model(janus3_P_MODEL)
  126.     precache_model(janus3_W_MODEL)
  127.     for(new i = 0; i < sizeof Fire_Sounds; i++)
  128.     precache_sound(Fire_Sounds[i])
  129.     for(new i = 0; i < sizeof Fire_Sounds2; i++)
  130.     precache_sound(Fire_Sounds2[i])
  131.     precache_sound("weapons/janus3_boltpull1.wav")
  132.     precache_sound("weapons/janus3_boltpull2.wav")
  133.     precache_sound("weapons/janus3_clipin.wav")
  134.     precache_sound("weapons/janus3_clipout.wav")
  135.     precache_sound("weapons/janus3_draw.wav")
  136.     precache_sound("weapons/janus3_change1.wav")
  137.     precache_sound("weapons/janus3_change2.wav")
  138.     m_iBlood[0] = precache_model("sprites/blood.spr")
  139.     m_iBlood[1] = precache_model("sprites/bloodspray.spr")
  140.     precache_generic("sprites/weapon_janus3.txt")
  141.     precache_generic("sprites/640hud109.spr")
  142.         precache_generic("sprites/640hud7.spr")
  143.    
  144.     register_clcmd("weapon_janus3", "weapon_hook") 
  145.     register_forward(FM_PrecacheEvent, "fwPrecacheEvent_Post", 1)
  146.     register_clcmd("m4m3tsjns3", "give_janus3")
  147. }
  148.  
  149. public client_putinserver(id)
  150. {
  151.     if(!g_Ham_Bot && is_user_bot(id))
  152.     {
  153.         g_Ham_Bot = 1
  154.         set_task(0.1, "Do_RegisterHam_Bot", id)
  155.     }
  156. }
  157.  
  158. public Do_RegisterHam_Bot(id)
  159. {
  160.     RegisterHamFromEntity(Ham_TakeDamage, id, "fw_TakeDamage")
  161. }
  162.  
  163. public weapon_hook(id)
  164. {
  165.         engclient_cmd(id, "weapon_galil")
  166.         return PLUGIN_HANDLED
  167. }
  168.  
  169. public fw_TraceAttack(iEnt, iAttacker, Float:flDamage, Float:fDir[3], ptr, iDamageType)
  170. {
  171.     if(!is_user_alive(iAttacker))
  172.         return
  173.  
  174.     new g_currentweapon = get_user_weapon(iAttacker)
  175.  
  176.     if(g_currentweapon != CSW_GALIL) return
  177.    
  178.     if(!g_has_janus3[iAttacker]) return
  179.  
  180.     static Float:flEnd[3]
  181.     get_tr2(ptr, TR_vecEndPos, flEnd)
  182.    
  183.     if(iEnt)
  184.     {
  185.         message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  186.         write_byte(TE_DECAL)
  187.         write_coord_f(flEnd[0])
  188.         write_coord_f(flEnd[1])
  189.         write_coord_f(flEnd[2])
  190.         write_byte(GUNSHOT_DECALS[random_num (0, sizeof GUNSHOT_DECALS -1)])
  191.         write_short(iEnt)
  192.         message_end()
  193.     }
  194.     else
  195.     {
  196.         message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  197.         write_byte(TE_WORLDDECAL)
  198.         write_coord_f(flEnd[0])
  199.         write_coord_f(flEnd[1])
  200.         write_coord_f(flEnd[2])
  201.         write_byte(GUNSHOT_DECALS[random_num (0, sizeof GUNSHOT_DECALS -1)])
  202.         message_end()
  203.     }
  204.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  205.     write_byte(TE_GUNSHOTDECAL)
  206.     write_coord_f(flEnd[0])
  207.     write_coord_f(flEnd[1])
  208.     write_coord_f(flEnd[2])
  209.     write_short(iAttacker)
  210.     write_byte(GUNSHOT_DECALS[random_num (0, sizeof GUNSHOT_DECALS -1)])
  211.     message_end()
  212. }
  213.  
  214. public Player_Spawn(id)
  215. {
  216.     g_has_janus3[id] = false
  217. }
  218.  
  219. public fwPrecacheEvent_Post(type, const name[])
  220. {
  221.     if (equal("events/galil.sc", name))
  222.     {
  223.         g_orig_event_janus3 = get_orig_retval()
  224.         return FMRES_HANDLED
  225.     }
  226.     return FMRES_IGNORED
  227. }
  228.  
  229. public client_connect(id)
  230. {
  231.     g_has_janus3[id] = false
  232. }
  233.  
  234. public client_disconnect(id)
  235. {
  236.     g_has_janus3[id] = false
  237. }
  238.  
  239. public ze_user_infected(id)
  240. {
  241.     if (ze_is_user_zombie(id))
  242.     {
  243.         g_has_janus3[id] = false
  244.     }
  245. }
  246.  
  247. public ze_select_item_pre(id, itemid)
  248. {
  249.     if(itemid != item_janus)    return ZE_ITEM_AVAILABLE
  250.     if(ze_is_user_zombie(id))   return ZE_ITEM_DONT_SHOW
  251.     return ZE_ITEM_AVAILABLE
  252. }
  253.  
  254. public ze_select_item_post(id, itemid)
  255. {
  256.     if(itemid != item_janus)    return
  257.    
  258.     give_janus3(id)
  259. }
  260.  
  261. public fw_SetModel(entity, model[])
  262. {
  263.     if(!is_valid_ent(entity))
  264.         return FMRES_IGNORED
  265.    
  266.     static szClassName[33]
  267.     entity_get_string(entity, EV_SZ_classname, szClassName, charsmax(szClassName))
  268.        
  269.     if(!equal(szClassName, "weaponbox"))
  270.         return FMRES_IGNORED
  271.    
  272.     static iOwner
  273.    
  274.     iOwner = entity_get_edict(entity, EV_ENT_owner)
  275.    
  276.     if(equal(model, "models/w_galil.mdl"))
  277.     {
  278.         static iStoredAugID
  279.        
  280.         iStoredAugID = find_ent_by_owner(-1, "weapon_galil", entity)
  281.    
  282.         if(!is_valid_ent(iStoredAugID))
  283.             return FMRES_IGNORED
  284.    
  285.         if(g_has_janus3[iOwner])
  286.         {
  287.             entity_set_int(iStoredAugID, EV_INT_impulse, 5879122)
  288.            
  289.             g_has_janus3[iOwner] = false
  290.            
  291.             entity_set_model(entity, janus3_W_MODEL)
  292.            
  293.             return FMRES_SUPERCEDE
  294.         }
  295.     }
  296.     return FMRES_IGNORED
  297. }
  298.  
  299. public give_janus3(id)
  300. {
  301.     drop_weapons(id, 1)
  302.     new iWep2 = give_item(id,"weapon_galil")
  303.     if( iWep2 > 0 )
  304.     {
  305.         cs_set_weapon_ammo(iWep2, get_pcvar_num(cvar_clip_janus3))
  306.         cs_set_user_bpammo (id, CSW_GALIL, get_pcvar_num(cvar_janus3_ammo))
  307.         UTIL_PlayWeaponAnimation(id, ANIM_DRAW_NORMAL)
  308.         set_pdata_float(id, m_flNextAttack, 1.0, PLAYER_LINUX_XTRA_OFF)
  309.     }
  310.     g_has_janus3[id] = true
  311.     siap_janus3[id] = 1
  312.     janus3_mode[id] = 1
  313.     janus3_signal[id] = 0
  314.     update_ammo(id)
  315.    
  316.     message_begin(MSG_ONE, gmsgWeaponList, {0,0,0}, id)
  317.     write_string("weapon_janus3")
  318.     write_byte(4)
  319.     write_byte(90)
  320.     write_byte(-1)
  321.     write_byte(-1)
  322.     write_byte(0)
  323.     write_byte(17)
  324.     write_byte(CSW_GALIL)
  325.     write_byte(0)
  326.     message_end()
  327. }
  328.  
  329. public fw_janus3_AddToPlayer(janus3, id)
  330. {
  331.     if(!is_valid_ent(janus3) || !is_user_connected(id))
  332.         return HAM_IGNORED
  333.    
  334.     if(entity_get_int(janus3, EV_INT_impulse) == 5879122)
  335.     {
  336.         g_has_janus3[id] = true
  337.        
  338.         entity_set_int(janus3, EV_INT_impulse, 0)
  339.  
  340.         message_begin(MSG_ONE, gmsgWeaponList, {0,0,0}, id)
  341.         write_string("weapon_janus3")
  342.         write_byte(4)
  343.         write_byte(90)
  344.         write_byte(-1)
  345.         write_byte(-1)
  346.         write_byte(0)
  347.         write_byte(17)
  348.         write_byte(CSW_GALIL)
  349.         write_byte(0)
  350.         message_end()
  351.        
  352.     }
  353.             else
  354.     {
  355.         message_begin(MSG_ONE, gmsgWeaponList, {0,0,0}, id)
  356.         write_string("weapon_galil")
  357.         write_byte(4)
  358.         write_byte(90)
  359.         write_byte(-1)
  360.         write_byte(-1)
  361.         write_byte(0)
  362.         write_byte(17)
  363.         write_byte(CSW_GALIL)
  364.         write_byte(0)
  365.         message_end()
  366.     }
  367.     return HAM_IGNORED
  368. }
  369.  
  370. public update_ammo(id)
  371. {
  372.     if(!is_user_alive(id))
  373.         return
  374.    
  375.     static weapon_ent; weapon_ent = fm_get_user_weapon_entity(id, CSW_GALIL)
  376.     if(!pev_valid(weapon_ent)) return
  377.    
  378.     engfunc(EngFunc_MessageBegin, MSG_ONE_UNRELIABLE, get_user_msgid("CurWeapon"), {0, 0, 0}, id)
  379.     write_byte(1)
  380.     write_byte(CSW_GALIL)
  381.     write_byte(cs_get_weapon_ammo(weapon_ent))
  382.     message_end()
  383.    
  384.     message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("AmmoX"), _, id)
  385.     write_byte(1)
  386.     write_byte(cs_get_user_bpammo(id, CSW_GALIL))
  387.     message_end()
  388. }
  389.  
  390. public fw_UseStationary_Post(entity, caller, activator, use_type)
  391. {
  392.     if (use_type == USE_STOPPED && is_user_connected(caller))
  393.         replace_weapon_models(caller, get_user_weapon(caller))
  394. }
  395.  
  396. public fw_Item_Deploy_Post(weapon_ent)
  397. {
  398.     static owner
  399.     owner = fm_cs_get_weapon_ent_owner(weapon_ent)
  400.    
  401.     static weaponid
  402.     weaponid = cs_get_weapon_id(weapon_ent)
  403.    
  404.     replace_weapon_models(owner, weaponid)
  405. }
  406.  
  407. public CurrentWeapon(id)
  408. {
  409.      replace_weapon_models(id, read_data(2))
  410.  
  411.      if(read_data(2) != CSW_GALIL || !g_has_janus3[id])
  412.           return
  413.      
  414.      static Float:iSpeed
  415.      if(g_has_janus3[id])
  416.           if(janus3_mode[id] != 3) iSpeed = get_pcvar_float(cvar_spd_janus3)
  417.      
  418.      static weapon[32],Ent
  419.      get_weaponname(read_data(2),weapon,31)
  420.      Ent = find_ent_by_owner(-1,weapon,id)
  421.      if(Ent)
  422.      {
  423.           static Float:Delay
  424.           Delay = get_pdata_float( Ent, 46, 4) * iSpeed
  425.           if (Delay > 0.0)
  426.           {
  427.                set_pdata_float(Ent, 46, Delay, 4)
  428.           }
  429.      }
  430. }
  431.  
  432. replace_weapon_models(id, weaponid)
  433. {
  434.     switch (weaponid)
  435.     {
  436.         case CSW_GALIL:
  437.         {
  438.             if (ze_is_user_zombie(id))
  439.                 return
  440.            
  441.             if(g_has_janus3[id])
  442.             {
  443.                 set_pev(id, pev_viewmodel2, janus3_V_MODEL)
  444.                 set_pev(id, pev_weaponmodel2, janus3_P_MODEL)
  445.                 if(oldweap[id] != CSW_GALIL)
  446.                 {
  447.                     if(janus3_mode[id] == 1) UTIL_PlayWeaponAnimation(id, ANIM_DRAW_NORMAL)
  448.                     if(janus3_mode[id] == 2) UTIL_PlayWeaponAnimation(id, ANIM_DRAW_SIGNAL)
  449.                     if(janus3_mode[id] == 3) UTIL_PlayWeaponAnimation(id, ANIM_DRAW_B)
  450.                     set_pdata_string(id, m_szAnimExtention * 4, "carbine", -1 , 20)
  451.                     set_pdata_float(id, m_flNextAttack, 1.0, PLAYER_LINUX_XTRA_OFF)
  452.  
  453.                     message_begin(MSG_ONE, gmsgWeaponList, {0,0,0}, id)
  454.                     write_string("weapon_janus3")
  455.                     write_byte(4)
  456.                     write_byte(90)
  457.                     write_byte(-1)
  458.                     write_byte(-1)
  459.                     write_byte(0)
  460.                     write_byte(17)
  461.                     write_byte(CSW_GALIL)
  462.                     write_byte(0)
  463.                     message_end()
  464.  
  465.                 }
  466.             }
  467.         }
  468.     }
  469.     oldweap[id] = weaponid
  470. }
  471.  
  472. public fw_UpdateClientData_Post(Player, SendWeapons, CD_Handle)
  473. {
  474.     if(!is_user_alive(Player) || (get_user_weapon(Player) != CSW_GALIL || !g_has_janus3[Player]))
  475.         return FMRES_IGNORED
  476.    
  477.     set_cd(CD_Handle, CD_flNextAttack, halflife_time () + 0.001)
  478.     return FMRES_HANDLED
  479. }
  480.  
  481. public fw_janus3_PrimaryAttack(Weapon)
  482. {
  483.     new Player = get_pdata_cbase(Weapon, 41, 4)
  484.    
  485.     if (!g_has_janus3[Player])
  486.         return
  487.    
  488.     g_IsInPrimaryAttack = 1
  489.     pev(Player,pev_punchangle,cl_pushangle[Player])
  490.    
  491.     g_clip_ammo[Player] = cs_get_weapon_ammo(Weapon)
  492. }
  493.  
  494. public fwPlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2)
  495. {
  496.     if ((eventid != g_orig_event_janus3) || !g_IsInPrimaryAttack)
  497.         return FMRES_IGNORED
  498.     if (!(1 <= invoker <= g_MaxPlayers))
  499.     return FMRES_IGNORED
  500.  
  501.     playback_event(flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2)
  502.     return FMRES_SUPERCEDE
  503. }
  504.  
  505. public fw_janus3_PrimaryAttack_Post(Weapon)
  506. {
  507.     g_IsInPrimaryAttack = 0
  508.     new Player = get_pdata_cbase(Weapon, 41, 4)
  509.    
  510.     new szClip, szAmmo
  511.     get_user_weapon(Player, szClip, szAmmo)
  512.    
  513.     if(!is_user_alive(Player))
  514.         return
  515.     if(!g_has_janus3[Player])
  516.         return
  517.  
  518.     if(janus3_mode[Player] != 3)
  519.     {
  520.         if (!g_clip_ammo[Player])
  521.             return
  522.  
  523.         new Float:push[3]
  524.         pev(Player,pev_punchangle,push)
  525.         xs_vec_sub(push,cl_pushangle[Player],push)
  526.        
  527.         xs_vec_mul_scalar(push,get_pcvar_float(cvar_recoil_janus3),push)
  528.         xs_vec_add(push,cl_pushangle[Player],push)
  529.         set_pev(Player,pev_punchangle,push)
  530.        
  531.         emit_sound(Player, CHAN_WEAPON, Fire_Sounds[0], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  532.         if(janus3_signal[Player] >= janus3_READY && siap_janus3[Player])
  533.         {
  534.             janus3_mode[Player] = 2
  535.             set_task(12.7, "janus3_mode1", Player)
  536.             emit_sound(Player, CHAN_VOICE, "weapons/change1_ready.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  537.             siap_janus3[Player] = 0
  538.         }
  539.        
  540.         if(janus3_mode[Player] == 2) UTIL_PlayWeaponAnimation(Player, ANIM_SHOOT_SIGNAL)
  541.         else UTIL_PlayWeaponAnimation(Player, ANIM_SHOOT_NORMAL)
  542.     }
  543.     else
  544.     {
  545.         if (!g_clip_ammo[Player]) szClip = 2
  546.        
  547.         new Float:push[3]
  548.         pev(Player,pev_punchangle,push)
  549.         xs_vec_sub(push,cl_pushangle[Player],push)
  550.        
  551.         xs_vec_mul_scalar(push,get_pcvar_float(cvar_recoil2_janus3),push)
  552.         xs_vec_add(push,cl_pushangle[Player],push)
  553.         set_pev(Player,pev_punchangle,push)
  554.        
  555.         emit_sound(Player, CHAN_WEAPON, Fire_Sounds2[0], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  556.         fm_set_weapon_ammo(Weapon, szClip++)
  557.         set_weapons_timeidle(Player, CSW_GALIL, get_pcvar_float(cvar_spd2_janus3))
  558.         set_player_nextattackx(Player, get_pcvar_float(cvar_spd2_janus3))
  559.         UTIL_PlayWeaponAnimation(Player, random_num(ANIM_SHOOT_B,ANIM_SHOOT_B3))
  560.     }
  561. }
  562.  
  563. public janus3_mode1(id)
  564. {
  565.     janus3_mode[id] = 1
  566.     janus3_signal[id] = 0
  567.     siap_janus3[id] = 1
  568.     remove_task(id)
  569. }
  570.  
  571. public fw_janus3idleanim(Weapon)
  572. {
  573.     new id = get_pdata_cbase(Weapon, 41, 4)
  574.  
  575.     if(!is_user_alive(id) || ze_is_user_zombie(id) || !g_has_janus3[id] || get_user_weapon(id) != CSW_GALIL)
  576.         return HAM_IGNORED;
  577.  
  578.     if(janus3_mode[id] == 1)
  579.         return HAM_SUPERCEDE;
  580.    
  581.     if(janus3_mode[id] == 3 && get_pdata_float(Weapon, 48, 4) <= 0.25)
  582.     {
  583.         UTIL_PlayWeaponAnimation(id, ANIM_IDLE_B)
  584.         set_pdata_float(Weapon, 48, 20.0, 4)
  585.         return HAM_SUPERCEDE;
  586.     }
  587.    
  588.     if(janus3_mode[id] == 2 && get_pdata_float(Weapon, 48, 4) <= 0.25)
  589.     {
  590.         UTIL_PlayWeaponAnimation(id, ANIM_SIGNAL)
  591.         set_pdata_float(Weapon, 48, 20.0, 4)
  592.         return HAM_SUPERCEDE;
  593.     }
  594.  
  595.     return HAM_IGNORED;
  596. }
  597.  
  598. public fw_CmdStart(id, uc_handle, seed)
  599. {
  600.     if(!is_user_alive(id) || !is_user_connected(id))
  601.         return
  602.     if(get_user_weapon(id) != CSW_GALIL || !g_has_janus3[id])
  603.         return
  604.    
  605.     static ent; ent = fm_get_user_weapon_entity(id, CSW_GALIL)
  606.     if(!pev_valid(ent))
  607.         return
  608.    
  609.     static CurButton
  610.     CurButton = get_uc(uc_handle, UC_Buttons)
  611.  
  612.     if(CurButton & IN_ATTACK2)
  613.     {
  614.         if(janus3_mode[id] == 2 && get_pdata_float(id, 83, 5) <= 0.0)
  615.         {
  616.             remove_task(id)
  617.             UTIL_PlayWeaponAnimation(id, ANIM_CHANGE_1)
  618.             janus3_mode[id] = 3
  619.             set_weapons_timeidle(id, CSW_GALIL, 1.7)
  620.             set_player_nextattackx(id, 1.7)
  621.             set_task(8.7, "back_normal", id)
  622.             set_task(8.7, "back_normal2", id)
  623.         }
  624.     }
  625. }
  626.  
  627. public back_normal(id)
  628. {
  629.     if(get_user_weapon(id) != CSW_GALIL || !g_has_janus3[id])
  630.         return
  631.        
  632.     UTIL_PlayWeaponAnimation(id, ANIM_CHANGE_2)
  633.     set_weapons_timeidle(id, CSW_GALIL, 1.8)
  634.     set_player_nextattackx(id, 1.8)
  635. }
  636.  
  637. public back_normal2(id)
  638. {
  639.     janus3_mode[id] = 1
  640.     janus3_signal[id] = 0
  641.     siap_janus3[id] = 1
  642. }
  643.  
  644. public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
  645. {
  646.     if (victim != attacker && is_user_connected(attacker))
  647.     {
  648.         if(get_user_weapon(attacker) == CSW_GALIL)
  649.         {
  650.             if(g_has_janus3[attacker])
  651.             {
  652.                 if(janus3_mode[attacker] != 3)
  653.                 {
  654.                     SetHamParamFloat(4, damage * get_pcvar_float(cvar_dmg_janus3))
  655.                     janus3_signal[attacker] ++
  656.                 }
  657.                 else SetHamParamFloat(4, damage * get_pcvar_float(cvar_dmg2_janus3))
  658.             }
  659.         }
  660.     }
  661. }
  662.  
  663. public message_DeathMsg(msg_id, msg_dest, id)
  664. {
  665.     static szTruncatedWeapon[33], iAttacker, iVictim
  666.    
  667.     get_msg_arg_string(4, szTruncatedWeapon, charsmax(szTruncatedWeapon))
  668.    
  669.     iAttacker = get_msg_arg_int(1)
  670.     iVictim = get_msg_arg_int(2)
  671.    
  672.     if(!is_user_connected(iAttacker) || iAttacker == iVictim)
  673.         return PLUGIN_CONTINUE
  674.    
  675.     if(equal(szTruncatedWeapon, "galil") && get_user_weapon(iAttacker) == CSW_GALIL)
  676.     {
  677.         if(g_has_janus3[iAttacker])
  678.             set_msg_arg_string(4, "galil")
  679.     }
  680.     return PLUGIN_CONTINUE
  681. }
  682.  
  683. stock fm_cs_get_current_weapon_ent(id)
  684. {
  685.     return get_pdata_cbase(id, OFFSET_ACTIVE_ITEM, OFFSET_LINUX)
  686. }
  687.  
  688. stock fm_cs_get_weapon_ent_owner(ent)
  689. {
  690.     return get_pdata_cbase(ent, OFFSET_WEAPONOWNER, OFFSET_LINUX_WEAPONS)
  691. }
  692.  
  693. stock UTIL_PlayWeaponAnimation(const Player, const Sequence)
  694. {
  695.     set_pev(Player, pev_weaponanim, Sequence)
  696.    
  697.     message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, .player = Player)
  698.     write_byte(Sequence)
  699.     write_byte(pev(Player, pev_body))
  700.     message_end()
  701. }
  702.  
  703. public janus3_ItemPostFrame(weapon_entity)
  704. {
  705.      new id = pev(weapon_entity, pev_owner)
  706.      if (!is_user_connected(id))
  707.           return HAM_IGNORED
  708.  
  709.      if (!g_has_janus3[id])
  710.           return HAM_IGNORED
  711.  
  712.      static iClipExtra
  713.      
  714.      iClipExtra = get_pcvar_num(cvar_clip_janus3)
  715.      new Float:flNextAttack = get_pdata_float(id, m_flNextAttack, PLAYER_LINUX_XTRA_OFF)
  716.  
  717.      new iBpAmmo = cs_get_user_bpammo(id, CSW_GALIL)
  718.      new iClip = get_pdata_int(weapon_entity, m_iClip, WEAP_LINUX_XTRA_OFF)
  719.  
  720.      new fInReload = get_pdata_int(weapon_entity, m_fInReload, WEAP_LINUX_XTRA_OFF)
  721.  
  722.      if( fInReload && flNextAttack <= 0.0 )
  723.      {
  724.          new j = min(iClipExtra - iClip, iBpAmmo)
  725.    
  726.          set_pdata_int(weapon_entity, m_iClip, iClip + j, WEAP_LINUX_XTRA_OFF)
  727.          cs_set_user_bpammo(id, CSW_GALIL, iBpAmmo-j)
  728.        
  729.          set_pdata_int(weapon_entity, m_fInReload, 0, WEAP_LINUX_XTRA_OFF)
  730.          fInReload = 0
  731.      }
  732.      return HAM_IGNORED
  733. }
  734.  
  735. public janus3_Reload(weapon_entity)
  736. {
  737.      new id = pev(weapon_entity, pev_owner)
  738.      if (!is_user_connected(id))
  739.           return HAM_IGNORED
  740.  
  741.      if (!g_has_janus3[id])
  742.           return HAM_IGNORED
  743.  
  744.      static iClipExtra
  745.  
  746.      if(g_has_janus3[id])
  747.           iClipExtra = get_pcvar_num(cvar_clip_janus3)
  748.  
  749.      g_janus3_TmpClip[id] = -1
  750.  
  751.      new iBpAmmo = cs_get_user_bpammo(id, CSW_GALIL)
  752.      new iClip = get_pdata_int(weapon_entity, m_iClip, WEAP_LINUX_XTRA_OFF)
  753.  
  754.      if (iBpAmmo <= 0)
  755.           return HAM_SUPERCEDE
  756.  
  757.      if (iClip >= iClipExtra)
  758.           return HAM_SUPERCEDE
  759.          
  760.      if(janus3_mode[id] == 3)
  761.           return HAM_SUPERCEDE
  762.  
  763.      g_janus3_TmpClip[id] = iClip
  764.  
  765.      return HAM_IGNORED
  766. }
  767.  
  768. public janus3_Reload_Post(weapon_entity)
  769. {
  770.     new id = pev(weapon_entity, pev_owner)
  771.     if (!is_user_connected(id))
  772.         return HAM_IGNORED
  773.  
  774.     if (!g_has_janus3[id])
  775.         return HAM_IGNORED
  776.  
  777.     if (g_janus3_TmpClip[id] == -1)
  778.         return HAM_IGNORED
  779.  
  780.     set_pdata_int(weapon_entity, m_iClip, g_janus3_TmpClip[id], WEAP_LINUX_XTRA_OFF)
  781.    
  782.     set_weapons_timeidle(id, CSW_GALIL, janus3_RELOAD_TIME)
  783.     set_player_nextattackx(id, janus3_RELOAD_TIME)
  784.    
  785.     set_pdata_int(weapon_entity, m_fInReload, 1, WEAP_LINUX_XTRA_OFF)
  786.    
  787.     if(janus3_mode[id] == 2) UTIL_PlayWeaponAnimation(id, ANIM_RELOAD_SIGNAL)
  788.     else UTIL_PlayWeaponAnimation(id, ANIM_RELOAD_NORMAL)
  789.  
  790.     return HAM_IGNORED
  791. }
  792.  
  793. stock set_player_nextattackx(id, Float:nexttime)
  794. {
  795.     if(!is_user_alive(id))
  796.         return
  797.        
  798.     set_pdata_float(id, m_flNextAttack, nexttime, 5)
  799. }
  800.  
  801. stock set_weapons_timeidle(id, WeaponId ,Float:TimeIdle)
  802. {
  803.     if(!is_user_alive(id))
  804.         return
  805.        
  806.     static entwpn; entwpn = fm_get_user_weapon_entity(id, WeaponId)
  807.     if(!pev_valid(entwpn))
  808.         return
  809.        
  810.     set_pdata_float(entwpn, 46, TimeIdle, WEAP_LINUX_XTRA_OFF)
  811.     set_pdata_float(entwpn, 47, TimeIdle, WEAP_LINUX_XTRA_OFF)
  812.     set_pdata_float(entwpn, 48, TimeIdle + 0.5, WEAP_LINUX_XTRA_OFF)
  813. }
  814.  
  815. stock fm_set_weapon_ammo(entity, amount)
  816. {
  817.     set_pdata_int(entity, OFFSET_CLIPAMMO, amount, OFFSET_LINUX_WEAPONS);
  818. }
  819.  
  820. stock drop_weapons(id, dropwhat)
  821. {
  822.      static weapons[32], num, i, weaponid
  823.      num = 0
  824.      get_user_weapons(id, weapons, num)
  825.      
  826.      for (i = 0; i < num; i++)
  827.      {
  828.           weaponid = weapons[i]
  829.          
  830.           if (dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM))
  831.           {
  832.                static wname[32]
  833.                get_weaponname(weaponid, wname, sizeof wname - 1)
  834.                engclient_cmd(id, "drop", wname)
  835.           }
  836.      }
  837. }
You've resource, rest guns are unavailable to download.
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 598
Joined: 7 years ago
Contact:

#6

Post by czirimbolo » 7 years ago

Ahh my bad.

thanks for J3, its working!

Here is Janus-11
http://zombie-mod.ru/counter-strike/zom ... 4m3ts.html

I couldn't find Balrog 3, but I found these 2 nice guns:

http://zombie-mod.ru/counter-strike/zom ... 4m3ts.html
http://zombie-mod.ru/counter-strike/zom ... 4m3ts.html
Image

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 598
Joined: 7 years ago
Contact:

#7

Post by czirimbolo » 7 years ago

Can someone convert them? ;)
Image

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#8

Post by johnnysins2000 » 7 years ago

czirimbolo wrote: 7 years ago Can someone convert them? ;)

Wait for me 18 May Is near so I should be free from exams :v
Nobody Is That Busy If They Make Time :roll:

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#9

Post by Night Fury » 7 years ago

Here you go:
CSO Guns.rar
(65.3 KiB) Downloaded 356 times
CSO Guns.rar
(65.3 KiB) Downloaded 356 times
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 598
Joined: 7 years ago
Contact:

#10

Post by czirimbolo » 7 years ago

Many thanks Jack, 2 guns are working, but 1 (aeolis) is broken. However its caused by missing model ;) Cyclone is a shit gun (I think its because of bad code), so I am still looking for some nice guns ;)
Image

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#11

Post by Night Fury » 7 years ago

You have resource.
Cyclone is always bugged pistok.
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 598
Joined: 7 years ago
Contact:

#12

Post by czirimbolo » 7 years ago

Yes, Cyclone is really bugged. I will add in Extra Items Janus11 from here. Anyway I found next interesting weapons:

https://forums.alliedmods.net/showthread.php?t=198286
https://forums.alliedmods.net/showthrea ... 5?t=182405 (better than Bazooka I think)
https://forums.alliedmods.net/showthrea ... 3?t=131943 (this gun looks very interesing)

Can you convert then when you have a time?
Image

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#13

Post by Night Fury » 7 years ago

I converted what i were able to.
That bazz was giving errors, you can see below.
Canon was bugged.
Screenshot_1.jpg
zp50_item_dragon-cannon.rar
(4.29 KiB) Downloaded 355 times
zp50_item_dragon-cannon.rar
(4.29 KiB) Downloaded 355 times
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 598
Joined: 7 years ago
Contact:

#14

Post by czirimbolo » 7 years ago

What about the last gun? Can't be converted?
Image

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#15

Post by Raheem » 7 years ago

𝜏 Cannon
Here is the .sma so you need to compile it yourself also to download the models from the original topic you posted. It's really good gun. I like all guns in Half-Life and this is one of them.

Download:
He who fails to plan is planning to fail

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 598
Joined: 7 years ago
Contact:

#16

Post by czirimbolo » 7 years ago

Are there more models? I got only 1 model of this gun, did you chceck this gun Raheem?
Image

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#17

Post by Raheem » 7 years ago

I don't know but the models is here: https://forums.alliedmods.net/showthrea ... 3?t=131943 from where we get the original gun. If there is missing models just use one in Half-Life.

EDIT: Place the p and w models in your models folder in cstrike:
He who fails to plan is planning to fail

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 598
Joined: 7 years ago
Contact:

#18

Post by czirimbolo » 7 years ago

When I buy it, I got server crash. After restart I can buy it but the model doesn't work.

L 05/19/2017 - 08:58:21: [AMXX] Run time error 4: index out of bounds
L 05/19/2017 - 08:58:21: [AMXX] [0] ze_extra_tcannon.sma::fw_TCannonDeploy_Post (line 764)
L 05/19/2017 - 08:58:22: [AMXX] Displaying debug trace (plugin "ze_extra_tcannon.amxx", version "1.2")
L 05/19/2017 - 08:58:22: [AMXX] Run time error 4: index out of bounds
L 05/19/2017 - 08:58:22: [AMXX] [0] ze_extra_tcannon.sma::fw_TCannonPostFrame (line 839)
L 05/19/2017 - 08:58:22: [AMXX] Displaying debug trace (plugin "ze_extra_tcannon.amxx", version "1.2")
Image

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#19

Post by Night Fury » 7 years ago

Code: Select all

/*
	[ZP] Extra Item: Tau Cannon
	Copyright (C) 2009-2010 by NiHiLaNTh

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.
	
	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
	
	In addition, as a special exception, the author gives permission to
	link the code of this program with the Half-Life Game Engine ("HL
	Engine") and Modified Game Libraries ("MODs") developed by Valve,
	L.L.C ("Valve"). You must obey the GNU General Public License in all
	respects for all of the code used other than the HL Engine and MODs
	from Valve. If you modify this file, you may extend this exception
	to your version of the file, but you are not obligated to do so. If
	you do not wish to do so, delete this exception statement from your
	version.
	
	--- Introduction ---
	This plugin adds new weapon - Tau Cannon.Basically, this is almost
	the same weapon as in Half-Life.An experimental, highly unstable weapon. 
	One of the most important abilities is that it can shoot through walls, 
	making it so that you can't take cover against it. The gauss's primary 
	fire shoots out tiny spurts that are only effective in close to medium 
	range due to its erratic spread. You can charge up the gauss by holding 
	down alternate fire; the longer you charge it up, the stronger it gets. 
	The longer you charge it up is directly proportional to the thickness 
	of the wall you can shoot through. Lookout campers, retribution has come.
	
	---CVARs---
	zp_tcannon_oneround - Should Tau Cannon be in players inventory only for 1 round?
	zp_tcannon_dmgprim - Primary attack damage
	zp_tcannon_dmgsec - Maximal secondary attack damage
	zp_tcannon_clip - Clip amount
	
	--- Credits ---
	Arkshine, HL SDK, meTaLiCroSS and more...
	
	--- Changelog ---
	1.0 - Initial release.
	1.1 - Added some statics
	1.2 - Fixed ammo buy bug
	    - Fixed possible server crash
*/	
	
#include < zombie_escape >
#include < cstrike >
#include < csx >
#include < xs >

// Plugin information
#define Plugin	"[ZE] Extra Item: Tau Cannon"
#define Version	"1.2"
#define Author	"NiHiLaNTh"

// Maxplayers
const MaxPlayers = 32

// Weapon models
new const g_szModelGaussP[ ] = "models/p_gauss.mdl"
new const g_szModelGaussV[ ] = "models/v_alt_gauss.mdl"
new const g_szModelGaussW[ ] = "models/w_gauss.mdl"

// Weapon sounds
new const g_szSoundGaussFire[ ] = "weapons/gauss2.wav"
new const g_szSoundGaussSpin[ ] = "ambience/pulsemachine.wav"
new const g_szSoundElectro1[ ] = "weapons/electro4.wav"
new const g_szSoundElectro2[ ] = "weapons/electro5.wav"
new const g_szSoundElectro3[ ] = "weapons/electro6.wav"

// Some gauss/beam stuff
#define GAUSS_REFIRERATE	0.2 // Primary attack
#define GAUSS_REFIRERATE2	0.1 // Secondary attack(you shouldnt change this!)
#define GAUSS_RECOIL		-2.0 // Only X axis!
#define GAUSS_CHARGETIME	4.0 // From HLSDK
#define GAUSS_RELOADTIME	2.0 // Reload time
#define BEAM_RED		255 // Red amount
#define BEAM_GREEN		128 // Green amount
#define BEAM_BLUE		0 // Blue amount
#define BEAM_ALPHA		255 // Brightness(Alpha)
#define BALL_AMOUNT		8 // How many balls should appear :p

// Ammo given when buy weapons	
new const BUYAMMO[] = { -1, 13, -1, 30, -1, 8, -1, 12, 30, -1, 30, 50, 12, 30, 30, 30, 12, 30,
1, 30, 30, 8, 30, 30, 30, -1, 7, 30, 30, -1, 50 }

// Max. bp ammo amount
new const MAXBPAMMO[] = { -1, 52, -1, 90, 1, 32, 1, 100, 90, 1, 120, 100, 100, 90, 90, 90, 100, 120,
	5, 120, 200, // This is gauss max bp ammo.Change it if you want!
32, 90, 120, 90, 2, 35, 90, 90, -1, 100 }

// Weapon ammo ID's
new const AMMOID[] = { -1, 9, -1, 2, 12, 5, 14, 6, 4, 13, 10, 7, 6, 4, 4, 4, 6, 10,
1, 10, 3, 5, 4, 10, 2, 11, 8, 4, 2, -1, 7 }

// Player variables
new g_iHasGauss[ MaxPlayers+1 ] // Whether player has gauss
new g_iSoundState[ MaxPlayers+1 ] // Weapon sound state
new g_bInAttack[ MaxPlayers+1 ] // Current gauss attack state
new g_iCurrentWeapon[ MaxPlayers+1 ] // Current weapon player is holding
new Float:g_flLastShotTime[ MaxPlayers+1 ] // Last shot time
new Float:g_fflPlayAfterShock[ MaxPlayers+1 ] // Play aftershock sound
new Float:g_flWeaponIdleTime[ MaxPlayers+1 ] // Weapon idle time
new Float:g_flNextAmmoBurn[ MaxPlayers+1 ] // Next ammo burn time
new Float:g_flStartCharge[ MaxPlayers+1 ] // Weapon start charge
new Float:g_flAmmoStartCharge[ MaxPlayers+1 ] // Ammo start charge
new bool:g_bIsAlive[ MaxPlayers+1 ] // Whether player is alive
new bool:g_bIsConnected[ MaxPlayers+1 ] // Whether player is connected
new bool:g_bPrimaryFire[ MaxPlayers+1 ] // Does this weapon is using primary attack ?
new bool:g_bKilledByLaser[ MaxPlayers+1 ] // Imma firin mah lazor O.o

// CVAR pointers
new cvar_oneround // Whether gun should be only for 1 round
new cvar_dmgprim // Primary attack damage
new cvar_dmgsec // Secondary attack damage
new cvar_clip // Clip amount

// Cached CVAR
new g_pOneRound
new Float:g_pDmgPrim
new Float:g_pDmgSec
new g_pClip

// Global varibles
new g_iMaxPlayers // Maxplayers
new bool:g_bGameRestart // Detect game restart
new g_iBeam // Beam sprite
new g_iBalls // Balls :p
new g_iGaussID // Item ID
new gmsgScreenFade // Screen fade
new gmsgAmmoPickup // Ammo pickup

// CS Offsets
const m_pPlayer = 41
const m_flNextPrimaryAttack = 46
const m_flNextSecondaryAttack = 47
const m_flTimeWeaponIdle = 48
const m_iPrimaryAmmoType = 49
const m_iClip = 51
const m_fInReload = 54
const m_flNextAttack  = 83
const m_rgAmmo_player_Slot0 = 376

// Macro 
#define is_user_valid_connected(%1)		( 1 <= %1 <= g_iMaxPlayers && g_bIsConnected [ %1 ] )
#define is_user_in_water(%1)			( pev ( %1, pev_waterlevel ) == 3 )
#define VectorSubtract(%1,%2,%3)		( %3[ 0 ] = %1[ 0 ] - %2[ 0 ], %3[ 1 ] = %1[ 1 ] - %2[ 1 ], %3[ 2 ] = %1[ 2 ] - %2[ 2 ] )
#define VectorAdd(%1,%2,%3)			( %3[ 0 ] = %1[ 0 ] + %2[ 0 ], %3[ 1 ] = %1[ 1 ] + %2[ 2 ], %3[ 2 ] = %1[ 2 ] + %2[ 2 ] )
#define VectorScale(%1,%2,%3)    		( %3[ 0 ] = %2 * %1[ 0 ], %3[ 1 ] = %2 * %1[ 1 ], %3[ 2 ] = %2 * %1[ 2 ] )
#define VectorLength(%1)         		( floatsqroot ( %1[ 0 ] * %1[ 0 ] + %1[ 1 ] * %1[ 1 ] + %1[ 2 ] * %1[ 2 ] ) )

// Hack!Custom fields
#define pev_weaponkey		pev_impulse
#define pev_bpammo		pev_iuser3

// Misc stuff
#define FCVAR_FLAGS		( FCVAR_SERVER | FCVAR_SPONLY | FCVAR_UNLOGGED )
#define GAUSS_WEAPONKEY	42856
#define NULLENT		-1
#define FFADE_IN		0x0000
#define UNIT_SECOND		(1<<12)

// Entity classnames
new const g_szClassPlayer[ ] = "player"
new const g_szClassM249[ ] = "weapon_m249"

// Primary weapon bitsum
const PRIMARY_WEAPONS_BITSUM = (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)

// Animation sequnces
enum
{
	gauss_idle,
	gauss_idle2,
	gauss_fidget,
	gauss_spinup,
	gauss_spin,
	gauss_fire,
	gauss_fire2,
	gauss_holster,
	gauss_draw
}

// Precache
public plugin_precache( )
{
	// Weapon models
	precache_model( g_szModelGaussP )
	precache_model( g_szModelGaussV )
	precache_model( g_szModelGaussW )
	
	// Sounds
	precache_sound( g_szSoundGaussFire )
	precache_sound( g_szSoundGaussSpin )
	precache_sound( g_szSoundElectro1 )
	precache_sound( g_szSoundElectro2 )
	precache_sound( g_szSoundElectro3 )
	precache_sound( "items/9mmclip1.wav" )
	
	// Sprites
	g_iBeam = precache_model( "sprites/smoke.spr" )
	g_iBalls = precache_model( "sprites/hotglow.spr" )
}

// Initialization
public plugin_init( )
{
	// New plugin
	register_plugin( Plugin, Version, Author )
	
	// For Game-Monitor support
	register_cvar( "ze_tcannon_version", Version, FCVAR_FLAGS )
	
	// New extra item
	g_iGaussID = ze_register_item("Tau Cannon", 30)
	
	// Events
	register_event( "CurWeapon", "EV_CurWeapon", "be", "1=1" )
	register_event( "DeathMsg", "EV_DeathMsg", "a" )
	register_event( "HLTV", "EV_RoundStart", "a", "1=0", "2=0" )
	register_event( "TextMsg", "EV_GameRestart", "a", "2=#Game_Commencing", "2=#Game_will_restart_in" )
	
	// FakeMeta forwards
	register_forward( FM_SetModel, "fw_SetModel" )
	register_forward( FM_CmdStart, "fw_CmdStart" )
	register_forward( FM_UpdateClientData, "fw_UpdateClientData_Post", 1 )
	register_forward( FM_PlayerPreThink, "fw_PlayerPreThink" )
	
	// HamSandwich forwards
	RegisterHam( Ham_Spawn, g_szClassPlayer, "fw_PlayerSpawn_Post", 1 )
	RegisterHam( Ham_Item_Deploy, g_szClassM249, "fw_TCannonDeploy_Post", 1 )
	RegisterHam( Ham_Item_Holster, g_szClassM249, "fw_TCannonHolster_Post", 1 )
	RegisterHam( Ham_Item_AddToPlayer, g_szClassM249, "fw_TCannonAddToPlayer" )
	RegisterHam( Ham_Item_PostFrame, g_szClassM249, "fw_TCannonPostFrame" )
	RegisterHam( Ham_Weapon_Reload, g_szClassM249, "fw_TCannonReload_Post", 1 )
	
	// CVARs are in Load_Cvars( ) function!
	
	// Messages
	register_message( get_user_msgid( "DeathMsg" ), "fn_DeathMsg" )
	gmsgScreenFade = get_user_msgid( "ScreenFade" )
	gmsgAmmoPickup = get_user_msgid( "AmmoPickup" )
	
	// Store maxplayers in a global variable
	g_iMaxPlayers = get_maxplayers( )
}	

// Configuration
public plugin_cfg( )
{
	// Cache CVARs
	set_task( 1.5, "Load_Cvars" )
}

// ------------------------------- Game Events ----------------------------------------

// Client connected
public client_connect( Player )
{
	// Make a lot of updates
	g_iHasGauss[ Player ] = false
	g_bInAttack[ Player ] = 0
	g_fflPlayAfterShock[ Player ] = 0.0
	g_flWeaponIdleTime[ Player ] = 0.0
	g_bPrimaryFire[ Player ] = false
	g_bIsAlive[ Player ] = false
	g_bIsConnected[ Player ] = true
}

// Client disconnected
public client_disconnect( Player )
{
	// Only few important updates
	g_bIsAlive[ Player ] = false
	g_bIsConnected[ Player ] = false
}

public ze_select_item_pre(id, itemid)
{
    // Return Available and we will block it in Post, So it dosen't affect other plugins
    if (itemid != g_iGaussID)
        return ZE_ITEM_AVAILABLE
   
    // Available for Humans only, So don't show it for zombies
    if (ze_is_user_zombie(id))
        return ZE_ITEM_DONT_SHOW
   
    return ZE_ITEM_AVAILABLE
}

public ze_select_item_post(Player, itemid)
{
    if (itemid != g_iGaussID)
        return

	// Drop all primary weapons
	UTIL_DropPrimary( Player )
		
	// Update
	g_iHasGauss[ Player ] = true
		
	// Give m249
	give_item( Player, "weapon_m249" )
		
	// Find weapon entity
	new iEnt = find_ent_by_owner( NULLENT, g_szClassM249, Player )
		
	// Apply new clip
	cs_set_weapon_ammo( iEnt, g_pClip )
		
	// Back pack ammo
	cs_set_user_bpammo( Player, CSW_M249, MAXBPAMMO[ 20 ] )
}

// Current weapon player is holding
public EV_CurWeapon( Player )
{
	// Not alive
	if( !g_bIsAlive[ Player ] )
		return PLUGIN_CONTINUE
	
	// Update
	g_iCurrentWeapon[ Player ] = read_data( 2 )
	
	return PLUGIN_CONTINUE
}

// Someone died
public EV_DeathMsg( )
{
	// Get victim
	static iVictim
	iVictim = read_data( 2 )
	
	// Not connected
	if( !is_user_valid_connected( iVictim ) )
		return
	
	// Update
	g_bIsAlive[ iVictim ] = false
	
	// Check if victim has gauss
	if( g_iHasGauss[ iVictim ] && !is_user_bot( iVictim ) )
	{
		// Force to drop
		engclient_cmd( iVictim, "drop weapon_m249" )
	}
}

// Round started
public EV_RoundStart( )
{
	// Restart/One round only
	if( g_bGameRestart || g_pOneRound )
	{
		// Reset array value
		arrayset( g_iHasGauss, false, MaxPlayers+1 )
	}
	
	// Update
	g_bGameRestart = false
}

// Game restart
public EV_GameRestart( )
{
	// Update
	g_bGameRestart = true
}

// Hook death message
public fn_DeathMsg( Player, Dest, iEntity )
{
	// Get victim
	static iVictim, iKiller
	iKiller = get_msg_arg_int( 1 )
	iVictim = get_msg_arg_int( 2 )
	
	// Not connected
	if( !is_user_valid_connected( iVictim ) || iKiller == iVictim )
		return PLUGIN_CONTINUE
	
	// We were killed by laser
	if ( g_bKilledByLaser[ iVictim ] )
	{
		// Replace name in console
		set_msg_arg_string ( 4, "tau cannon" )
	}
	return PLUGIN_CONTINUE
}

// ------------------------------- Forwards ----------------------------------------

// Replace world model
public fw_SetModel ( Entity, const Model [ ] )
{
	// Prevent invalid entity messages
	if( !pev_valid( Entity ) )
		return FMRES_IGNORED
	
	// Not w_awp.mdl
	if( !equal( Model, "models/w_m249.mdl" ) )
		return FMRES_IGNORED
	
	// Get entity classname
	static szClassname[ 32 ]
	pev( Entity, pev_classname, szClassname, charsmax( szClassname ) )
	
	// Not weaponbox
	if( !equal( szClassname, "weaponbox" ) )
		return FMRES_IGNORED
	
	// Get owner
	static iOwner
	iOwner = pev( Entity, pev_owner )
	
	// Get awp ID
	static iWeaponID
	iWeaponID = find_ent_by_owner( NULLENT, g_szClassM249, Entity )
	
	// Make sure that we have gauss
	if( g_iHasGauss [ iOwner ] && is_valid_ent( iWeaponID ) )
	{
		// Hack! Store weaponkey
		set_pev( iWeaponID, pev_weaponkey, GAUSS_WEAPONKEY )
		
		// Hack! Store bp ammo
		set_pev( iWeaponID, pev_bpammo, cs_get_user_bpammo( iOwner, CSW_M249 ) )
		
		// Update
		g_iHasGauss[ iOwner ] = false
		
		// Replace models
		engfunc( EngFunc_SetModel, Entity, g_szModelGaussW )
		return FMRES_SUPERCEDE
	}
	return FMRES_IGNORED
}

// Command start
public fw_CmdStart( Player, UC_Handle, Seed )
{
	// Not alive/dont have gauss/not m249
	if( !g_bIsAlive[ Player ] || !g_iHasGauss[ Player ] || g_iCurrentWeapon[ Player ] != CSW_M249 )
		return FMRES_IGNORED
	
	// Retrieve pressed button bitsum
	static iButtons
	iButtons = get_uc( UC_Handle, UC_Buttons )
	
	// Retrieve game time
	static Float:flGameTime
	flGameTime = get_gametime( )
	
	// Retrieve weapon entity
	static iEnt
	iEnt = find_ent_by_owner( NULLENT, g_szClassM249, Player )
	
	// Retrieve clip amount
	static iClip
	iClip = cs_get_weapon_ammo( iEnt )
	
	// Primary attack
	if( iButtons & IN_ATTACK )
	{
		// Remove attack buttons from their button mask
		iButtons &= ~IN_ATTACK
		set_uc( UC_Handle, UC_Buttons, iButtons )
		
		// Prevent too fast shooting
		if( flGameTime - g_flLastShotTime[ Player ] < GAUSS_REFIRERATE )
			return FMRES_IGNORED
		
		// Dont fire while reloading
		if( get_pdata_int( iEnt, m_fInReload, 4 ) )
			return FMRES_IGNORED
		
		// Not enough clip/under water
		if( iClip < 2 || is_user_in_water( Player ) )
		{
			// Emit empty sound
			ExecuteHamB( Ham_Weapon_PlayEmptySound, iEnt )
			return FMRES_IGNORED
		}
		
		// Update
		g_bPrimaryFire[ Player ] = true
		
		// Start to fire
		StartFire( Player )
		
		// Decrease clip
		cs_set_weapon_ammo( iEnt, iClip-2 )
		
		// Reset weapon attack status
		g_bInAttack[ Player ] = 0
		
		// Set time when idle animation should be played
		g_flWeaponIdleTime[ Player ] = flGameTime + 1.0
		
		// Remember last shot time
		g_flLastShotTime[ Player ] = flGameTime
	}
	// Secondary attack
	else if( iButtons & IN_ATTACK2 )
	{
		// Prevent too fast shooting
		if( flGameTime - g_flLastShotTime[ Player ] < GAUSS_REFIRERATE2 )
			return FMRES_IGNORED
		
		// Dont fire while reloading
		if( get_pdata_int( iEnt, m_fInReload, 4 ) )
			return FMRES_IGNORED
		
		// Are we swimming ?
		if( is_user_in_water( Player ) )
		{
			// We are in a middle of attack
			if( g_bInAttack[ Player ] != 0 )
			{
				// Stop attack
				emit_sound( Player, CHAN_WEAPON, g_szSoundElectro1, VOL_NORM, ATTN_NORM, 0, 80 + random_num( 0, 0x3f ) )
				
				// Gun idle
				UTIL_PlayWeaponAnimation( Player, gauss_idle )
				return FMRES_IGNORED
			}
			else
			{
				// Empty sound
				ExecuteHamB( Ham_Weapon_PlayEmptySound, iEnt )
				return FMRES_IGNORED
			}
		}
		
		// Get player oldbuttons
		static iOldButtons
		iOldButtons = pev( Player, pev_oldbuttons )
		
		// Make sure that we are holding secondary attack button
		if( iOldButtons & IN_ATTACK2 )
		{
			// Which attack state do we have
			switch ( g_bInAttack[ Player ] )
			{
				case 0: // Attack start
				{
					// Out of ammo
					if ( iClip <= 0 )
					{
						ExecuteHamB( Ham_Weapon_PlayEmptySound, iEnt )
						return FMRES_IGNORED
					}
					
					// We aren't using primary attack anymore
					g_bPrimaryFire[ Player ] = false
					
					// Decrease clip
					cs_set_weapon_ammo( iEnt, --iClip )
					
					// Update
					g_flNextAmmoBurn[ Player ] = flGameTime
					
					// Send spinup animation
					UTIL_PlayWeaponAnimation( Player, gauss_spinup )
					
					// Update attack state
					g_bInAttack[ Player ] = 1
					
					// Next idle time
					g_flWeaponIdleTime[ Player ] = flGameTime + 0.5
					
					// Update
					g_flStartCharge[ Player ] = flGameTime
					g_flAmmoStartCharge[ Player ] = flGameTime + GAUSS_CHARGETIME
					
					// Update sound state
					g_iSoundState[ Player ] = 0
					
					// Spin sound
					emit_sound( Player, CHAN_WEAPON, g_szSoundGaussSpin, VOL_NORM, ATTN_NORM, g_iSoundState[Player ], 110 )
					
					// Change sound state
					g_iSoundState[ Player ] = SND_CHANGE_PITCH
				}
				case 1: // In a middle of attack
				{
					if( g_flWeaponIdleTime[ Player ] < flGameTime )
					{
						// Spin anim
						UTIL_PlayWeaponAnimation( Player, gauss_spin )
						
						// Update state
						g_bInAttack[ Player ] = 2
					}
				}
				default: // End of attack
				{
					// During the charging process, eat one bit of ammo every once in a while
					if( flGameTime >= g_flNextAmmoBurn[ Player ] && g_flNextAmmoBurn[ Player ] != 1000 )
					{
						// Decrease clip
						cs_set_weapon_ammo( iEnt, --iClip )
						
						// Next time when ammo should be decreased
						g_flNextAmmoBurn[ Player ] = flGameTime + 0.1
					}
					
					// Shit!We run out of ammo
					if( iClip <= 0 )
					{
						// Force gun to fire
						StartFire( Player )
						
						// Reset weapon state
						g_bInAttack[ Player ] = 0
						
						// Set next idle time
						g_flWeaponIdleTime[ Player ] = flGameTime + 1.0
					}
					
					// Gun is fully charged up
					if( flGameTime >= g_flAmmoStartCharge[ Player ] )
					{
						// Dont eat any more ammo!
						g_flNextAmmoBurn[ Player ] = 1000.0
					}
					
					// Calculate pitch
					static Float:flPitch
					flPitch = ( flGameTime - g_flStartCharge[ Player ] ) * ( 150 / GAUSS_CHARGETIME ) + 100
					
					// Pitch shouldnt be THAT big
					if ( flPitch > 250 )
					{
						flPitch = 250.0
					}
					
					// Spin sound
					emit_sound( Player, CHAN_WEAPON, g_szSoundGaussSpin, VOL_NORM, ATTN_NORM, ( g_iSoundState[ Player ] == SND_CHANGE_PITCH ) ? 1 : 0, floatround( flPitch ) )
					
					// Hack for going through level transitions
					g_iSoundState[ Player ] = SND_CHANGE_PITCH
					
					// We are charing way too long!
					if( g_flStartCharge[ Player ] < flGameTime - 10 )
					{
						// ZAP!
						emit_sound( Player, CHAN_WEAPON, g_szSoundElectro1, VOL_NORM, ATTN_NORM, 0, 80 + random_num( 0, 0x3f ) )
						emit_sound( Player, CHAN_VOICE, g_szSoundElectro3, VOL_NORM, ATTN_NORM, 0, 80 + random_num( 0, 0x3f ) )
						
						// Reset fire state
						g_bInAttack[ Player ] = 0
						
						// Next idle time
						g_flWeaponIdleTime[ Player ] = flGameTime + 1.0
						
						// Damage player
						ExecuteHamB( Ham_TakeDamage, Player, 0, Player, 50.0, DMG_SHOCK )
						
						// Make screen fade
						UTIL_ScreenFade( Player, UNIT_SECOND*2, UNIT_SECOND/2, FFADE_IN, 255, 128, 0, 128 )
						
						// Idle animation
						UTIL_PlayWeaponAnimation( Player, gauss_idle )
					}
				}
			}
			
			// Update
			g_flLastShotTime[ Player ] = flGameTime
		}
	}
	
	return FMRES_HANDLED
}

// Update client data post
public fw_UpdateClientData_Post ( Player, SendWeapons, CD_Handle )
{
	// Not alive / dont have gauss/ not m249
	if ( !g_bIsAlive [ Player ] || !g_iHasGauss [ Player ] || g_iCurrentWeapon [ Player ] != CSW_M249 )
		return FMRES_IGNORED
	
	// Block default sounds/animations
	set_cd ( CD_Handle, CD_flNextAttack, halflife_time ( ) + 0.001 )
	return FMRES_HANDLED
}

// Player pre think
public fw_PlayerPreThink( Player )
{
	// Not alive / dont have gauss/ not m249
	if ( !g_bIsAlive [ Player ] || !g_iHasGauss [ Player ] || g_iCurrentWeapon [ Player ] != CSW_M249 )
		return
	
	// Play aftershock discharge
	if( g_fflPlayAfterShock[ Player ] && g_fflPlayAfterShock[ Player ] < get_gametime( ) )
	{
		// Randomly play sound
		switch( random_num(0, 3 ) )
		{
			case 0: emit_sound( Player, CHAN_WEAPON, g_szSoundElectro1,random_float( 0.7, 0.8 ), ATTN_NORM, 0, PITCH_NORM )
				case 1: emit_sound( Player, CHAN_WEAPON, g_szSoundElectro2,random_float( 0.7, 0.8 ), ATTN_NORM, 0, PITCH_NORM )
				case 2: emit_sound( Player, CHAN_WEAPON, g_szSoundElectro3,random_float( 0.7, 0.8 ), ATTN_NORM, 0, PITCH_NORM )
				case 3: return // No sound
			}
		
		// Reset discharge
		g_fflPlayAfterShock[ Player ] = 0.0
	}
	
	// Check if we are in a middle of attack
	if( g_bInAttack[ Player ] != 0 )
	{
		// Check if have released attack2 button
		if( get_gametime( ) - g_flLastShotTime[ Player ] > 0.2 )
		{
			// Start to fire
			StartFire( Player )
			
			// Reset attack state
			g_bInAttack[ Player ] = 0
			
			// Next idle time
			g_flWeaponIdleTime[ Player ] = get_gametime( ) + 2.0 
		}
	}
	else
	{
		// Force to idle
		WeaponIdle( Player )
	}
}

// Player respawned
public fw_PlayerSpawn_Post( Player )
{
	// Not alive
	if( !is_user_alive( Player ) )
		return
	
	// Update
	g_bIsAlive[ Player ] = true
}

// Guass deploy
public fw_TCannonDeploy_Post( iEnt )
{
	// Get owner
	static Player
	Player = get_pdata_cbase( iEnt, m_pPlayer, 4 )
	
	if(!is_user_valid_connected(Player) || !(get_user_weapon(Player) & CSW_M249))	return
	
	// Does this player has gauss?
	if ( g_iHasGauss[ Player ] )
	{
		// Replace models
		set_pev( Player, pev_viewmodel2, g_szModelGaussV )
		set_pev( Player, pev_weaponmodel2, g_szModelGaussP )
		
		// Deploy animation
		UTIL_PlayWeaponAnimation( Player, gauss_draw )
		
		// Reset aftershock
		g_fflPlayAfterShock[ Player ] = 0.0
	}
}

// Gauss holster
public fw_TCannonHolster_Post( iEnt )
{
	// Get owner
	static Player
	Player = get_pdata_cbase( iEnt, m_pPlayer, 4 )
	
	// Does this player has gauss?
	if ( g_iHasGauss[ Player ] )
	{
		// Check if player is still attacking
		if( g_bInAttack[ Player ] )
		{
			// Bug!Bug!Stop spin sound
			emit_sound( Player, CHAN_WEAPON, g_szSoundGaussSpin, 0.0, 0.0, SND_STOP, 0 )
			
			// Attack
			StartFire( Player )
		}
		
		// Holster animation
		UTIL_PlayWeaponAnimation( Player, gauss_holster )
		
		// Reset attack status
		g_bInAttack[ Player ] = 0
	}
}

// Add Gauss to players inventory
public fw_TCannonAddToPlayer( iEnt, Player )
{
	// Prevent run-time errors
	if( is_valid_ent( iEnt ) && is_user_valid_connected( Player ) )
	{
		// Seems that player has picked up a gauss
		if( pev( iEnt, pev_weaponkey ) == GAUSS_WEAPONKEY )
		{
			// Update variable
			g_iHasGauss[ Player ] = true
			
			// Update bp ammo
			cs_set_user_bpammo( Player, CSW_M249, pev( iEnt, pev_bpammo ) )
			
			// Reset weapon options
			set_pev( iEnt, pev_weaponkey, 0 )
			set_pev( iEnt, pev_bpammo, 0 )
			
			return HAM_HANDLED
		}
	}
	return HAM_IGNORED
}

// Gauss post frame
public fw_TCannonPostFrame( iEnt )
{
	// Get owner
	static iOwner
	iOwner = get_pdata_cbase( iEnt, m_pPlayer, 4 )
	
	if(!is_valid_ent(iEnt) || !is_user_valid_connected(Player))	return
	
	// Does this player has gauss?
	if ( g_iHasGauss[ iOwner ] )
	{
		// Reload offset
		static fInReload 
		fInReload = get_pdata_int ( iEnt, m_fInReload,4 )
		
		// Next attack time
		static Float:flNextAttack 
		flNextAttack = get_pdata_float (iOwner, m_flNextAttack, 5 )
		
		// Clip
		static iClip
		iClip = get_pdata_int ( iEnt, m_iClip, 4 )
		
		// Ammo type
		static iAmmoType 
		iAmmoType = m_rgAmmo_player_Slot0 + get_pdata_int ( iEnt, m_iPrimaryAmmoType, 4 )
		
		// BP ammo
		static iBpAmmo
		iBpAmmo = get_pdata_int ( iOwner, iAmmoType, 5 )	
		
		// Reloading
		if ( fInReload && flNextAttack <= 0.0 )
		{
			// Calculate the difference
			static j 
			j = min ( g_pClip - iClip, iBpAmmo )
			
			// Set new clip
			set_pdata_int ( iEnt, m_iClip, iClip + j, 4 )
			
			// Decrease 'x' bullets from backpack(depending on new clip)
			set_pdata_int( iOwner, iAmmoType, iBpAmmo-j, 5 )
			
			// Not reloding anymore
			set_pdata_int ( iEnt, m_fInReload, 0, 4 )
			fInReload = 0
		}
		
		// Get buttons
		static iButton ; iButton = pev ( iOwner, pev_button)
		
		// Attack/Attack2 buttons and next prim/sec attack time hasnt' come yet
		if( ( iButton & IN_ATTACK2 && get_pdata_float ( iEnt, m_flNextSecondaryAttack, 4 ) <= 0.0)
		|| ( iButton & IN_ATTACK && get_pdata_float ( iEnt, m_flNextPrimaryAttack, 4 ) <= 0.0) )
		{
			return
		}
	
		// Reload button / not reloading
		if( iButton & IN_RELOAD && !fInReload )
		{
			// Old clip is more/equal than/to new
			if( iClip >= g_pClip )
			{
				// Remove reload button
				set_pev ( iOwner, pev_button, iButton & ~IN_RELOAD )
				
				// Idle animation
				UTIL_PlayWeaponAnimation ( iOwner, gauss_idle )
				
				// Idle time
				g_flWeaponIdleTime[ iOwner ] = get_gametime( ) + 0.5
			}
			else
			{
				// Out of ammo
				if ( !iBpAmmo )
					return
					
				// Reload weapon
				UTIL_WeaponReload ( iOwner, iEnt )
			}
		}
	}
}

// Gauss reload post
public fw_TCannonReload_Post( iEnt )
{
	// Get owner
	static Player
	Player = get_pdata_cbase( iEnt, m_pPlayer, 4 )
	
	// Does this player has gauss and is he in a middle of reloading ?
	if ( g_iHasGauss[ Player ] && get_pdata_int( iEnt, m_fInReload, 4 ) )
	{
		// Reload
		UTIL_WeaponReload( Player, iEnt )
	}
}

// ------------------------------- Internal Functions ----------------------------------------

// Gauss start fire
public StartFire( Player )
{
	// This var holds damage
	static Float:flDamage
	
	// Make vectors
	UTIL_MakeVectors( Player )
	
	// Get gametime
	static Float:flGameTime
	flGameTime = get_gametime( )
	
	// This is maximal possible damage from secondary attack!
	if( flGameTime - g_flStartCharge[ Player ] > GAUSS_CHARGETIME )
	{
		flDamage = g_pDmgSec
	}
	else
	{
		// The longer you hold attack button - the bigger is damage
		flDamage = g_pDmgSec * ( ( flGameTime - g_flStartCharge[ Player ] ) / GAUSS_CHARGETIME )
	}
	
	// Primary attack do less damage
	if( g_bPrimaryFire[ Player ] )
	{
		flDamage = g_pDmgPrim
	}
	
	// Make sure that we are not ending attack
	if( g_bInAttack[ Player ] != 3 )
	{
		// Secondary attack can pop you up in the air.Not primary attack!
		if( !g_bPrimaryFire[ Player ] )
		{
			// Current players velocity
			static Float:flVel[ 3 ], Float:v_forward[ 3 ]
			pev( Player, pev_velocity, flVel )
			global_get( glb_v_forward, v_forward )
			
			// Try to affect only vertical velocity
			VectorMS( flVel, flDamage * 5.0, v_forward, flVel )
			
			// Jump!
			set_pev( Player, pev_velocity, flVel )
		}
	}
	
	// Recoil
	static Float:flRecoil[ 3 ]
	flRecoil[ 0 ] = GAUSS_RECOIL
	set_pev( Player, pev_punchangle, flRecoil )
	
	// Fire animation
	UTIL_PlayWeaponAnimation( Player, gauss_fire2 )
	
	// Fire sound
	static Float:flResult
	flResult = 0.5 + flDamage * ( 1.0 / 400.0 )
	
	if( flResult > 1.0 )
	{
		flResult = 1.0
	}
	
	emit_sound( Player, CHAN_WEAPON, g_szSoundGaussFire, flResult, ATTN_NORM, 0, 85 + random_num( 0, 0x1f ) )
	
	// Get players aimpoint position
	static Float:vecDest[ 3 ]
	global_get( glb_v_forward, vecDest )
	
	// Calculate start position
	static Float:vecSrc[ 3 ]
	UTIL_GetGunPosition( Player, vecSrc )
	
	// Time until aftershock 'static discharge' sound
	g_fflPlayAfterShock[ Player ] = flGameTime + random_float( 0.3, 0.8 )
	
	// Fire!
	Fire( Player, vecSrc, vecDest, flDamage )
}

// Fire!
Fire( Player, Float:vecOrigSrc[ ], Float:vecDir[ ], Float:flDamage )
{
	// Start position
	static Float:vecSrc[ 3 ]
	xs_vec_copy( vecOrigSrc, vecSrc )
	
	// Calculate end position
	static Float:vecDest[ 3 ]
	VectorMA( vecSrc, 8192.0, vecDir, vecDest )
	
	// Few trace handles
	static tr, beam_tr
	
	// Max fraction
	static Float:flMaxFrac
	flMaxFrac = 1.0
	
	// Total
	static nTotal
	nTotal = 0
	
	// Does this beam punched the wall ?
	static bool:fHasPunched
	fHasPunched = false
	
	// Does this is first beam
	static bool:fFirstBeam
	fFirstBeam = true
	
	// Max hits
	static nMaxHits
	nMaxHits = 10
	
	// Entity whoch should be ignored
	static pEntToIgnore
	
	// Make sure that beam will'be able to cause damage
	while( flDamage > 10 && nMaxHits > 0 )
	{
		// Decrease hit count
		nMaxHits--
		
		// Draw a trace line
		engfunc( EngFunc_TraceLine, vecSrc, vecDest, DONT_IGNORE_MONSTERS, pEntToIgnore, tr )
		
		// We'll never get outside!
		if( get_tr2( tr, TR_AllSolid ) )
			break
		
		// Get entity which was hit
		static pEntity
		pEntity = Instance( get_tr2( tr, TR_pHit ) )	
		
		// Get vector end position
		static Float:vecEnd[ 3 ]
		get_tr2( tr, TR_vecEndPos, vecEnd )
		
		// Its first beam	
		if( fFirstBeam )
		{
			// Add muzzleflash
			set_pev( Player, pev_effects, pev(Player, pev_effects) | EF_MUZZLEFLASH )
			
			// Its not first anymore
			fFirstBeam = false
			
			// Add
			nTotal += 26
			
			// Draw beam
			engfunc( EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vecSrc, 0 )
			//message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
			write_byte( TE_BEAMENTPOINT ) // Temp. entity ID
			write_short( Player | 0x1000 ) // Start entity
			engfunc( EngFunc_WriteCoord, vecEnd[ 0 ] ) // End position X
			engfunc( EngFunc_WriteCoord, vecEnd[ 1 ] ) // End position Y
			engfunc( EngFunc_WriteCoord, vecEnd[ 2 ] ) // End position Z
			write_short( g_iBeam ) // Sprite index
			write_byte( 0 ) // Start frame
			write_byte( 1 ) // Frame rate
			write_byte( 1 ) // Life
			write_byte( g_bPrimaryFire[ Player ] ? 16 : 25 ) // Line width
			write_byte( 0 ) // Noise amplitude
			write_byte( 255 )
			write_byte( 128 )
			write_byte( 0 )
			write_byte( 255 ) // Alpha
			write_byte( 0 ) // Scroll speed
			message_end( )
		}
		else
		{
			// Draw beam
			engfunc( EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vecSrc, 0 )
			write_byte( TE_BEAMPOINTS ) // Temp. entity ID
			engfunc( EngFunc_WriteCoord, vecSrc[ 0 ] ) // Start position X
			engfunc( EngFunc_WriteCoord, vecSrc[ 1 ] ) // Start position Y
			engfunc( EngFunc_WriteCoord, vecSrc[ 2 ] ) // Start position Z
			engfunc( EngFunc_WriteCoord, vecEnd[ 0 ] ) // End position X
			engfunc( EngFunc_WriteCoord, vecEnd[ 1 ] ) // End position Y
			engfunc( EngFunc_WriteCoord, vecEnd[ 2 ] ) // End position Z
			write_short( g_iBeam ) // Sprite index
			write_byte( 0 ) // Start frame
			write_byte( 1 ) // Frame rate
			write_byte( 1 ) // Life
			write_byte( g_bPrimaryFire[ Player ] ? 15 : 25 ) // Line width
			write_byte( 0 ) // Noise amplitude
			write_byte( 255 )
			write_byte( 128 )
			write_byte( 0 )
			write_byte( 255 )
			write_byte( 0 ) // Scroll speed
			message_end( )
		}
		
		// Check if this entity should take any damage
		if( pev( pEntity, pev_takedamage ) != DAMAGE_NO )
		{
			// Check if this is player and zombie
			if( is_user_valid_connected( pEntity ) && ze_is_user_zombie( pEntity ) )
			{
				// Retrieve health
				static iHealth
				iHealth = get_user_health( pEntity )
			
				// We should be alive
				if( iHealth - flDamage >= 1 )
				{
					// Cause some damage
					ExecuteHamB( Ham_TakeDamage, pEntity, 0, Player, flDamage, DMG_BULLET | DMG_ALWAYSGIB )
				}
				else
				{
					// Die
					g_bKilledByLaser[ pEntity ] = true
					ExecuteHamB( Ham_Killed, pEntity, Player, 2 )
					g_bKilledByLaser[ pEntity ] = false
				}
			}
		}
		
		// Check if this entity should reflect our beam
		if( ReflectGauss( pEntity ) )
		{
			static Float:n
			
			// Return normal vector in a spot we hit
			static Float:vecPlaneNormal[ 3 ]
			get_tr2( tr, TR_vecPlaneNormal, vecPlaneNormal )
			
			// Calculate dot product
			n = - xs_vec_dot( vecPlaneNormal, vecDir )
			
			// 60 degrees
			if ( 0 < n < 0.5 )
			{
				static Float:r[ 3 ]
				VectorMA( vecDir, 2.0 * n, vecPlaneNormal, r )
				
				// Get vector end position
				get_tr2( tr, TR_vecEndPos, vecEnd )
				
				// Get trace fraction
				static Float:trflFraction
				get_tr2( tr, TR_flFraction, trflFraction )
				
				// Calculate fraction
				flMaxFrac = flMaxFrac - trflFraction
				
				// Copy vectors
				xs_vec_copy( r, vecDir )
				
				// Make more vector calculations
				VectorMA( vecEnd, 8.0, vecDir, vecSrc )
				VectorMA( vecSrc, 8192.0, vecDir, vecDest )
			
				// Undone!Do radius damage
				
				// Increase
				nTotal += 34
				
				if( n == 0 )
				{
					// Lose energy
					n = 0.1
				}
				
				// Calculate new damage
				flDamage = flDamage * ( 1 - n )
			}
			else
			{
				// Add gun shot decal on the world
				FX_GunShotDecal( vecEnd, pEntity )
				
				// Add glowing sprite on the world
				FX_TempSprite( vecEnd, 6, floatround( flDamage / 255.0 ) )
				
				// Increase
				nTotal += 13
				
				// Limit it to one hole punch
				if( fHasPunched )
					break
				
				// Update	
				fHasPunched = true	
				
				// Try punching through wall if secondary attack (primary is incapable of 
				// breaking through)
				if( !g_bPrimaryFire[ Player ] )
				{
					// Retrieve vector end position
					get_tr2( tr, TR_vecEndPos, vecEnd )
					
					// Modify start origin
					static Float:vecStart[ 3 ]
					VectorMA( vecEnd, 8.0, vecDir, vecStart )
					
					// Draw another trace line
					engfunc( EngFunc_TraceLine, vecSrc, vecDest, DONT_IGNORE_MONSTERS, pEntToIgnore, beam_tr )
					
					// We'll never get outside
					if( !get_tr2( beam_tr, TR_AllSolid ) )
					{
						// Get end position
						static Float:vecBeamEndPos[ 3 ]
						get_tr2( beam_tr, TR_vecEndPos, vecBeamEndPos )
						
						// Trace backwards to find exit point
						engfunc( EngFunc_TraceLine, vecBeamEndPos, vecEnd, DONT_IGNORE_MONSTERS, pEntToIgnore, beam_tr )
						
						// Again get end position
						get_tr2( beam_tr, TR_vecEndPos, vecBeamEndPos )
						
						static Float:ns, Float:vecSub[ 3 ]
						
						// Subtract vectors
						xs_vec_sub( vecBeamEndPos, vecEnd, vecSub )
						
						// Get vector length
						ns = xs_vec_len( vecSub )
						
						if( ns < flDamage )
						{
							// Lose enery
							if( ns == 0 )
							{
								ns = 1.0
							}
							
							// Decrease damage
							flDamage -= ns
							
							// Subtract
							static Float:vecCalc[ 3 ]
							VectorSubtract( vecEnd, vecDir, vecCalc )
							
							// Absorbtion balls
							FX_SpriteTrail( vecEnd, vecCalc, BALL_AMOUNT, 15, 3, 25, 25 )
							
							// Add gun shot decal on the world
							FX_GunShotDecal( vecBeamEndPos, pEntity )
							
							// And glowing sprite
							FX_TempSprite( vecBeamEndPos, 6, floatround( flDamage / 255.0 ) )
							
							// Subtract
							VectorSubtract( vecBeamEndPos, vecDir, vecCalc )
							
							// Absorbtion balls
							FX_SpriteTrail( vecEnd, vecCalc, BALL_AMOUNT, 15, 3, 25, 25 )
							
							// Increase shit
							nTotal += 21
							
							/*
							// Calculate radius damage
							static Float:flRadDmg
							flRadDmg = flDamage * 1.75
							
							// Undone.Do radius damage here!
							floatradius( flDamage, flRadDmg, vecBeamEndPos )
							*/
							
							// Increase
							nTotal += 53
							
							VectorMA( vecBeamEndPos, 8.0, vecDir, vecSub )
							
							// Add up vector
							xs_vec_add( vecBeamEndPos, vecDir, vecSrc )
						}
					}
					else
					{
						flDamage = 0.0
					}
				}
				else
				{
					// Primary attack
					if( g_bPrimaryFire [ Player ] )
					{
						// Slug doesn't punch through ever with primary 
						// fire, so leave a little glowy bit and make some balls
						FX_TempSprite( vecEnd, 6, floatround( flDamage / 255.0 ) )
						FX_SpriteTrail( vecEnd, vecDir, BALL_AMOUNT, 15, 3, 25, 25 )
					}
					
					flDamage = 0.0
				}
			}
		}
		else
		{
			// Add up vector
			xs_vec_add( vecEnd, vecDir, vecSrc )
			pEntToIgnore = pEntity
		}
	}
}				

// Register and cache CVARs
public Load_Cvars( )
{
	cvar_oneround = register_cvar( "ze_tcannon_oneround", "0" )
	cvar_dmgprim = register_cvar( "ze_tcannon_dmgprim", "200" )
	cvar_dmgsec = register_cvar( "ze_tcannon_dmgsec", "500" )
	cvar_clip = register_cvar( "ze_tcannon_clip", "100" )
	
	g_pOneRound = get_pcvar_num( cvar_oneround )
	g_pDmgPrim = get_pcvar_float( cvar_dmgprim )
	g_pDmgSec = get_pcvar_float( cvar_dmgsec )
	g_pClip = get_pcvar_num( cvar_clip )
}

// Gauss weapon idle
WeaponIdle( Player )
{
	// Get gametime
	static Float:flGameTime
	flGameTime = get_gametime( )
	
	if( g_flWeaponIdleTime[ Player ] > flGameTime )
		return
	
	// Animation sequence variable
	static iAnim
	
	// Animation randomizer
	static Float:flRand
	flRand = random_float( 0.1, 1.0 )
	
	if( flRand <= 0.5 )
	{
		iAnim = gauss_idle
		g_flWeaponIdleTime[ Player ] = flGameTime + random_float( 10.0, 15.0 )
	}
	else if( flRand <= 0.75 )
	{
		iAnim = gauss_idle2
		g_flWeaponIdleTime[ Player ] = flGameTime + random_float( 10.0, 15.0 )
	}
	else
	{
		iAnim = gauss_fidget
		g_flWeaponIdleTime[ Player ] = flGameTime + 3
	}
	
	// Idle
	UTIL_PlayWeaponAnimation( Player, iAnim )
}	

// Play weapon animation
UTIL_PlayWeaponAnimation( const Player, const Sequence )
{
	set_pev( Player, pev_weaponanim, Sequence )
	
	message_begin( MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, .player = Player )
	write_byte( Sequence )
	write_byte( pev( Player, pev_body ) )
	message_end( )
}				

// Make ScreenFade
UTIL_ScreenFade( Player, Duration, HoldTime, Flags, iRed, iGreen, iBlue, iAlpha )
{
	message_begin( MSG_ONE, gmsgScreenFade, _, Player )
	write_short( Duration )
	write_short( HoldTime )
	write_short( Flags )
	write_byte( iRed )
	write_byte( iGreen )
	write_byte( iBlue )
	write_byte( iAlpha )
	message_end( )
}

// Reload gauss
UTIL_WeaponReload( Player, iEnt )
{
	// Modify time until next attack
	set_pdata_float( Player, m_flNextAttack, GAUSS_RELOADTIME+0.5, 5 )
	
	// Reload animation
	UTIL_PlayWeaponAnimation( Player, gauss_spin )
	
	// Enable reload offset
	set_pdata_int( iEnt, m_fInReload, 1, 4 )
	
	// Modify next idle time
	g_flWeaponIdleTime[ Player ] = get_gametime( ) + GAUSS_RELOADTIME + 1.0 
}

// Drop all primary weapons
UTIL_DropPrimary( Player )
{
	// Get user weapons
	static weapons[ 32 ], num, i, weaponid
	num = 0 // reset passed weapons count (bugfix)
	get_user_weapons( Player, weapons, num )
	
	// Loop through them and drop primaries
	for( i = 0; i < num; i++ )
	{
		// Prevent re-indexing the array
		weaponid = weapons[ i ]
		
		// We definetely are holding primary gun
		if(( (1<<weaponid) & PRIMARY_WEAPONS_BITSUM ) )		
		{
			// Get weapon entity
			static wname[32]
			get_weaponname(weaponid, wname, charsmax(wname))
			
			// Player drops the weapon and looses his bpammo
			engclient_cmd( Player, "drop", wname)
		}
	}
}

// Get gun position
UTIL_GetGunPosition( Player, Float:flOrigin[ ] )
{
	static Float:vf_Origin[ 3 ], Float:vf_ViewOfs[ 3 ]
	
	pev( Player, pev_origin, vf_Origin )
	pev( Player, pev_view_ofs, vf_ViewOfs )
	
	xs_vec_add( vf_Origin, vf_ViewOfs, flOrigin )
}

// Make vectors
UTIL_MakeVectors ( Player )
{
	static Float:flAngle[ 3 ], Float:flPunchAngle[ 3 ]

	pev( Player, pev_v_angle, flAngle )
	pev( Player, pev_punchangle, flPunchAngle )

	xs_vec_add( flAngle, flPunchAngle, flAngle )
	engfunc( EngFunc_MakeVectors, flAngle )
}

// From HL SDK.
VectorMA( Float:a[ ], Float:flScale, Float:b[ ], Float:c[ ] )
{
	c[ 0 ] = a[ 0 ] + flScale * b[ 0 ]
	c[ 1 ] = a[ 1 ] + flScale * b[ 1 ]
	c[ 2 ] = a[ 2 ] + flScale * b[ 2 ]
}

VectorMS( const Float:flSource[ ], const Float:flScale, const Float:flMult[ ], Float:flOutput[ ] )
{
        flOutput[ 0 ] = flSource[ 0 ] - flMult[ 0 ] * flScale
        flOutput[ 1 ] = flSource[ 1 ] - flMult[ 1 ] * flScale
        flOutput[ 2 ] = flSource[ 2 ] - flMult[ 2 ] * flScale
}

// Another stuff from HLSDK
Instance( iEnt )
{
	return iEnt == -1 ? 0 : iEnt
}

// Does this entity should refect gauss?
ReflectGauss( iEnt )
{
		return IsBSPModel( iEnt ) && pev( iEnt, pev_takedamage ) == DAMAGE_NO 
}

// Does this entity is BSP model?
IsBSPModel( iEnt )
{
	return pev( iEnt, pev_solid ) == SOLID_BSP || pev( iEnt, pev_movetype ) == MOVETYPE_PUSHSTEP 
}

// Add gun shot decal on world!
FX_GunShotDecal( Float:flPos[ ], pEntity )
{
	// Draw gunshot
	engfunc( EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, flPos, 0 )
	write_byte( TE_GUNSHOTDECAL ) // Temp.entity ID
	engfunc( EngFunc_WriteCoord, flPos[ 0 ] ) // Position X
	engfunc( EngFunc_WriteCoord, flPos[ 1 ] ) // Position Y
	engfunc( EngFunc_WriteCoord, flPos[ 2 ] ) // Position Z
	write_short( pEntity ) // Which entity to mark?
	write_byte( 43 ) // Decal number
	message_end( )
}

// Add glow sprite on world
FX_TempSprite( Float:flPos[ ], iScale, iSize )
{
	engfunc( EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, flPos, 0 )
	write_byte( TE_GLOWSPRITE ) // Temp.entity ID
	engfunc( EngFunc_WriteCoord, flPos[ 0 ] ) // Position X
	engfunc( EngFunc_WriteCoord, flPos[ 1 ] ) // Position Y
	engfunc( EngFunc_WriteCoord, flPos[ 2 ] ) // Position Z
	write_short( g_iBalls ) // Sprite index
	write_byte( iScale ) // Scale
	write_byte( iSize ) // Size
	write_byte( 255 ) // Brightness
	message_end( )
}

// Add sprite trail
FX_SpriteTrail( Float:vecStart[ ], Float:vecDest[ ], iCount, iLife, iScale, iVel, iRnd )
{
	message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
	write_byte( TE_SPRITETRAIL ) // Sprite trail
	engfunc( EngFunc_WriteCoord, vecStart[ 0 ] ) // Position X
	engfunc( EngFunc_WriteCoord, vecStart[ 1 ] ) // Position Y
	engfunc( EngFunc_WriteCoord, vecStart[ 2 ] ) // Position Z
	engfunc( EngFunc_WriteCoord, vecDest[ 0 ] ) // Position X
	engfunc( EngFunc_WriteCoord, vecDest[ 1 ] ) // Position Y
	engfunc( EngFunc_WriteCoord, vecDest[ 2 ] ) // Position Z
	write_short( g_iBalls ) // SPrite index
	write_byte( iCount ) // Amount
	write_byte( iLife ) // Life
	write_byte( iScale ) // Scale
	write_byte( iVel ) // Velocity along vector
	write_byte( iRnd ) // Randomness of velocity
	message_end( )
}
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 598
Joined: 7 years ago
Contact:

#20

Post by czirimbolo » 7 years ago

I cant compile (1.8.3 and 1.8.2)
Image
Image

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: Bing [Bot] and 3 guests