Advertisement
macquid123560

Top Jailbreak | Days | Dragon Cannon

Mar 23rd, 2016
812
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 15.58 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <cstrike>
  4. #include <engine>
  5. #include <hamsandwich>
  6. #include <fakemeta_util>
  7.  
  8.  
  9. //#define BUYMENU
  10.  
  11. #if defined BUYMENU
  12. #endif
  13.  
  14. #define PLUGIN "[ZP]ExtraDragonCannon"
  15. #define VERSION "1.0"
  16. #define AUTHOR "Arwel"
  17.  
  18. #define CONFIG_CFG_FILE "weapons/dragon_cannon.cfg"
  19.  
  20. #define pev_weaponkey pev_impulse
  21. #define weaponkey_value 231721
  22.  
  23. #define OFFSET_LINUX        5
  24. #define OFFSET_LINUX_WEAPONS    4
  25.  
  26. #define m_flNextAttack      83
  27. #define m_flNextPrimaryAttack   46
  28. #define m_flTimeWeaponIdle  48
  29. #define m_LastHitGroup      75
  30. #define m_bDelayFire        60
  31.  
  32. #define CSW_CANNON CSW_M249
  33.  
  34. native is_day();
  35. native get_running_day_cannon();
  36.  
  37. native is_lr_active();
  38. native is_user_lr( index );
  39.  
  40. new g_orig_event_cannon
  41.  
  42. new const g_weapon_entity[]="weapon_m249"
  43. new const g_weapon_event[]="events/m249.sc"
  44. new const g_weaponbox_model[]="models/w_m249.mdl"
  45.  
  46. new const weapon_list_txt[]="weapon_cannon_zp_cso"
  47.  
  48. new const weapon_list_sprites[][]=
  49. {  
  50.     "sprites/640hud69.spr",
  51.     "sprites/640hud2_cso.spr"
  52. }
  53.  
  54. new const g_flame_classname[]="cannon_flame"
  55.  
  56. new const ViewModel[]="models/Top/JB/Days/v_cannon.mdl"
  57. new const PlayerModel[]="models/Top/JB/Days/p_cannon.mdl"
  58. new const WorldModel[]="models/Top/JB/Days/w_cannon.mdl"
  59.  
  60. new const FlameModel[]="sprites/fire_cannon.spr"
  61.  
  62. new const Sounds[][]=
  63. {
  64.     "weapons/1/cannon-11.wav",
  65.     "weapons/1/cannon_draw1.wav"   
  66. }
  67.  
  68. new g_HasCannon[33], g_ammo[33]
  69.  
  70. new pcvar_cost, pcvar_item_name, pcvar_fire_time, pcvar_damage, pcvar_flame_speed_mins
  71. new pcvar_flame_num, pcvar_flame_speed_maxs, pcvar_flame_dist_mins, pcvar_flame_dist_maxs, pcvar_ammo_cost
  72.  
  73. new g_item, gMsg_CurWeapon, gMsg_AmmoX, gMsg_AmmoPickup
  74.  
  75. const PRIMARY_WEAPONS_BIT_SUM =
  76. (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<<
  77. 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)
  78.  
  79. public plugin_init()
  80. {
  81.     register_plugin(PLUGIN, VERSION, AUTHOR)
  82.    
  83.     register_clcmd(weapon_list_txt, "Redirect")
  84.    
  85.     pcvar_item_name=register_cvar("cannon_item_name", "Dragon-Cannon")
  86.     pcvar_cost=register_cvar("cannon_cost", "9999")
  87.     pcvar_fire_time=register_cvar("cannon_fire_time", "3.5")
  88.     pcvar_damage=register_cvar("cannon_damage", "150.0")
  89.     pcvar_flame_num=register_cvar("cannon_flame_num", "5")
  90.     pcvar_flame_speed_mins=register_cvar("cannon_flame_speed_mins", "850")
  91.     pcvar_flame_speed_maxs=register_cvar("cannon_flame_speed_maxs", "1150")
  92.     pcvar_flame_dist_mins=register_cvar("cannon_flame_dist_mins", "450.0")
  93.     pcvar_flame_dist_maxs=register_cvar("cannon_flame_dist_maxs", "650.0")
  94.  
  95.     pcvar_ammo_cost=register_cvar("cannon_ammo_cost", "650")
  96.    
  97.     ReadSettings()
  98.    
  99.     RegisterHam(Ham_Item_AddToPlayer, g_weapon_entity, "fwAddToPlayer", 1)
  100.     RegisterHam(Ham_Item_Deploy, g_weapon_entity, "fwDeployPost", 1)
  101.     RegisterHam(Ham_Weapon_PrimaryAttack, g_weapon_entity, "fwPrimaryAttackPre")
  102.     RegisterHam(Ham_RemovePlayerItem, "player", "fwRemoveItem")
  103.     RegisterHam(Ham_Item_PostFrame, g_weapon_entity, "fwItemPostFrame")
  104.    
  105.     register_forward(FM_PlaybackEvent, "fwPlaybackEvent")  
  106.     register_forward(FM_UpdateClientData, "fwUpdateClientDataPost", 1)
  107.     register_forward(FM_SetModel, "fwSetModel")
  108.    
  109.     register_think(g_flame_classname, "fwThink")
  110.     register_touch(g_flame_classname, "*", "fwTouch")
  111.    
  112.     register_clcmd("buyammo1", "CmdBuyAmmo")
  113.     register_clcmd("say /givedragon", "give_cannon")
  114.    
  115.     new item_name[64]
  116.    
  117.     get_pcvar_string(pcvar_item_name, item_name, 63)
  118.    
  119.    
  120.     gMsg_CurWeapon=get_user_msgid("CurWeapon")
  121.     gMsg_AmmoX=get_user_msgid("AmmoX") 
  122.     gMsg_AmmoPickup=get_user_msgid("AmmoPickup")   
  123.    
  124.     register_message(gMsg_AmmoX, "Message_AmmoX")
  125.     register_message(gMsg_CurWeapon, "Message_CurWeapon")
  126. }
  127.  
  128.  
  129. public plugin_precache()
  130. {  
  131.     precache_model(ViewModel)
  132.     precache_model(PlayerModel)
  133.     precache_model(WorldModel)
  134.    
  135.     precache_model(FlameModel)
  136.    
  137.     for(new i; i<=charsmax(Sounds); i++)
  138.     {
  139.         precache_sound(Sounds[i])  
  140.     }
  141.    
  142.     new tmp[128]
  143.    
  144.     formatex(tmp, charsmax(tmp), "sprites/%s.txt", weapon_list_txt)
  145.    
  146.     precache_generic(tmp)
  147.    
  148.     for(new i; i<=charsmax(weapon_list_sprites); i++)
  149.     {
  150.         precache_generic(weapon_list_sprites[i])
  151.        
  152.     }  
  153.  
  154.     register_forward(FM_PrecacheEvent, "fwPrecachePost", 1)
  155. }
  156.  
  157. public plugin_natives()
  158. {
  159.     register_native( "get_cannon", "_give_cannon" );
  160.     register_native( "remove_cannon", "_remove_cannon" );
  161. }
  162.  
  163. public ReadSettings()
  164. {
  165.    
  166.     new confdir[64], path[128]
  167.    
  168.     get_configsdir(confdir, charsmax(confdir))
  169.    
  170.     formatex(path, charsmax(path), "%s/%s", confdir, CONFIG_CFG_FILE)
  171.    
  172.     server_cmd("exec %s", path)
  173.     server_exec()
  174.    
  175. }
  176.  
  177. public zp_extra_item_selected(id, itemid)
  178. {
  179.     if(itemid!=g_item)
  180.         return
  181.        
  182.     give_cannon(id)
  183. }
  184.  
  185. public _give_cannon( plugin, params )
  186. {
  187.     new client = get_param( 1 );
  188.    
  189.     if( is_day() && get_running_day_cannon() || is_lr_active() && is_user_lr( client ) )
  190.         give_cannon( client )
  191. }
  192.  
  193. public give_cannon(id)
  194. {
  195.     drop_weapons(id)
  196.    
  197.     g_HasCannon[id]=true
  198.    
  199.     g_ammo[id]=9999
  200.    
  201.     fm_give_item(id, g_weapon_entity)
  202.    
  203.     Msg_CurWeapon(id, 1, CSW_CANNON, -1)
  204.    
  205.     Msg_AmmoX(id, 3, g_ammo[id])
  206.    
  207.     WeapListSpr(id, weapon_list_txt)
  208. }
  209.  
  210. public _remove_cannon( plugin, params )
  211. {
  212.     new client = get_param( 1 );
  213.    
  214.     remove_cannon( client );
  215. }
  216.  
  217. public remove_cannon(id)
  218. {
  219.    
  220.     g_HasCannon[id]=false
  221.    
  222.     g_ammo[id]=0
  223. }
  224. public Message_AmmoX(msg_id, msg_dest, msg_entity)
  225. {
  226.     if(!g_HasCannon[msg_entity])
  227.         return
  228.        
  229.     if(get_user_weapon(msg_entity)!=CSW_CANNON)
  230.         return
  231.        
  232.     set_msg_arg_int(1, ARG_BYTE, g_ammo[msg_entity])   
  233. }
  234.  
  235. public Message_CurWeapon(msg_id, msg_dest, msg_entity)
  236. {
  237.     if(!g_HasCannon[msg_entity])
  238.         return
  239.        
  240.     if(get_msg_arg_int(2)!=CSW_CANNON)
  241.         return
  242.        
  243.     set_msg_arg_int(3, ARG_BYTE, -1)       
  244. }
  245.  
  246. public CmdBuyAmmo(id)
  247. {
  248.     if(!g_HasCannon[id])
  249.         return PLUGIN_CONTINUE
  250.        
  251.     if(g_ammo[id]>=9999)
  252.         return PLUGIN_HANDLED
  253.    
  254.     new money
  255.    
  256.     #if defined BUYMENU
  257.    
  258.     money=zp_cs_get_user_money(id)-get_pcvar_num(pcvar_ammo_cost)
  259.    
  260.     if(money<0)
  261.         return PLUGIN_HANDLED
  262.        
  263.     zp_cs_set_user_money(id, money)
  264.    
  265.     #else
  266.    
  267.     money=cs_get_user_money(id)-get_pcvar_num(pcvar_ammo_cost)
  268.    
  269.     if(money<0)
  270.         return PLUGIN_HANDLED
  271.        
  272.     cs_set_user_money(id, money)       
  273.    
  274.     #endif
  275.    
  276.     g_ammo[id]++
  277.    
  278.     Msg_AmmoX(id, 3, g_ammo[id])
  279.     Msg_AmmoPickup(id, 3, 1)
  280.    
  281.     emit_sound(id, CHAN_ITEM, "items/9mmclip1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  282.    
  283.     return PLUGIN_HANDLED
  284. }
  285.  
  286. public client_disconnect(id)   
  287.     g_HasCannon[id]=false  
  288.  
  289.  
  290. public fwPrecachePost(type, const name[])
  291. {
  292.     if (equal(g_weapon_event, name))
  293.     {
  294.         g_orig_event_cannon=get_orig_retval()
  295.        
  296.         return FMRES_HANDLED
  297.     }
  298.    
  299.     return FMRES_IGNORED
  300. }
  301.  
  302. public fwPlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2)
  303. {
  304.     if ((eventid != g_orig_event_cannon))
  305.         return FMRES_IGNORED
  306.        
  307.     if (!is_valid_player(invoker))
  308.         return FMRES_IGNORED
  309.    
  310.     fm_playback_event(flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2)
  311.    
  312.     return FMRES_SUPERCEDE
  313. }
  314.  
  315. public fwUpdateClientDataPost(id, SendWeapons, CD_Handle)
  316. {
  317.     if (!is_valid_player(id))
  318.         return FMRES_IGNORED
  319.    
  320.     if(get_user_weapon(id)!=CSW_CANNON)
  321.         return FMRES_IGNORED
  322.    
  323.     set_cd(CD_Handle, CD_flNextAttack, get_gametime() + 0.001)
  324.    
  325.     return FMRES_HANDLED
  326. }
  327.  
  328. public fwSetModel(ent, model[])
  329. {
  330.     if(!pev_valid(ent))
  331.         return FMRES_IGNORED;
  332.  
  333.     if(!equal(model, g_weaponbox_model))
  334.         return FMRES_IGNORED;
  335.  
  336.     static classname[33]
  337.     pev(ent, pev_classname, classname, charsmax(classname))
  338.        
  339.     if(!equal(classname, "weaponbox"))
  340.         return FMRES_IGNORED
  341.  
  342.     static owner, weap
  343.    
  344.     owner=pev(ent, pev_owner)
  345.     weap=fm_find_ent_by_owner(-1, g_weapon_entity, ent)
  346.        
  347.     if(g_HasCannon[owner]&&pev_valid(weap))
  348.     {
  349.         set_pev(weap, pev_weaponkey, weaponkey_value)
  350.        
  351.         g_HasCannon[owner]=false
  352.        
  353.         engfunc(EngFunc_SetModel, ent, WorldModel)
  354.        
  355.         return FMRES_SUPERCEDE
  356.     }
  357.    
  358.     return FMRES_IGNORED
  359. }
  360.  
  361. public fwAddToPlayer(ent, id)
  362. {
  363.     if(pev_valid(ent)&&is_user_connected(id)&&pev(ent, pev_weaponkey)==weaponkey_value)
  364.     {
  365.         WeapListSpr(id, weapon_list_txt)
  366.        
  367.         g_HasCannon[id]=true
  368.        
  369.         set_pev(ent, pev_weaponkey, 0)
  370.        
  371.         return HAM_HANDLED
  372.     }
  373.    
  374.     return HAM_IGNORED
  375. }
  376.  
  377. public fwDeployPost(ent)
  378. {
  379.     new id=fm_get_weapon_owner(ent)
  380.    
  381.     if(!is_valid_player(id))
  382.         return 
  383.        
  384.     playanim(id, 3)
  385.        
  386.     set_pev(id, pev_viewmodel2, ViewModel)
  387.     set_pev(id, pev_weaponmodel2, PlayerModel)
  388. }
  389.  
  390. public fwPrimaryAttackPre(ent)
  391. {
  392.     new id=fm_get_weapon_owner(ent)
  393.    
  394.     if(!is_valid_player(id))
  395.         return HAM_IGNORED
  396.            
  397.     if(g_ammo[id]<=0)
  398.     {
  399.         ExecuteHamB(Ham_Weapon_PlayEmptySound, ent)
  400.        
  401.         set_pdata_float(ent, m_flNextPrimaryAttack, 0.5, OFFSET_LINUX_WEAPONS)
  402.        
  403.         return HAM_SUPERCEDE
  404.     }
  405.    
  406.     set_pev(id,pev_punchangle,Float:{0.0, 0.0, 0.0})   
  407.    
  408.     playanim(id, 1)
  409.    
  410.     CreateFlame(id)
  411.    
  412.     emit_sound(id, CHAN_WEAPON, Sounds[0], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  413.    
  414.     static Float:next_attack;next_attack=get_pcvar_float(pcvar_fire_time)
  415.    
  416.     set_pdata_float(id, m_flNextAttack, next_attack, OFFSET_LINUX)
  417.     set_pdata_float(ent, m_flNextPrimaryAttack, next_attack, OFFSET_LINUX_WEAPONS)
  418.     set_pdata_float(ent, m_flTimeWeaponIdle, next_attack, OFFSET_LINUX_WEAPONS)
  419.    
  420.     set_pdata_int(ent, m_bDelayFire, 1, OFFSET_LINUX_WEAPONS)
  421.    
  422.     return HAM_SUPERCEDE
  423. }
  424.  
  425. public fwItemPostFrame(ent)
  426. {
  427.     new id=fm_get_weapon_owner(ent)
  428.    
  429.     if(!is_valid_player(id))
  430.         return
  431.        
  432.     if(get_pdata_int(ent, m_bDelayFire, OFFSET_LINUX_WEAPONS))
  433.     {
  434.        
  435.         Msg_AmmoX(id, 3, g_ammo[id])
  436.        
  437.         set_pdata_int(ent, m_bDelayFire, 0, OFFSET_LINUX_WEAPONS)
  438.     }
  439. }
  440.  
  441. public CreateAnimationSprite(owner, const classname[], const model[], Float:scale)
  442. {
  443.     new ent=fm_create_entity("info_target")
  444.  
  445.     set_pev(ent, pev_model, model)
  446.  
  447.     set_pev(ent, pev_owner, owner)
  448.     set_pev(ent, pev_classname, classname)
  449.    
  450.     fm_entity_set_model(ent, model)
  451.     fm_set_rendering(ent, kRenderFxNoDissipation, 255, 255, 255, kRenderGlow, 255)
  452.  
  453.     set_pev(ent, pev_scale, scale)
  454.  
  455.     set_pev(ent, pev_movetype, MOVETYPE_FLY)
  456.     set_pev(ent, pev_solid, SOLID_BBOX)
  457.    
  458.     entity_set_size(ent, Float:{0.0, 0.0, 0.0}, Float:{0.0, 0.0, 0.0}) 
  459.    
  460.     set_pev(ent, pev_fuser1, 255.0)
  461.    
  462.     set_pev(ent, pev_nextthink, get_gametime()+random_float(0.001, 0.2))
  463.    
  464.     return ent
  465. }
  466.  
  467.  
  468. public CreateFlame(id)
  469. {  
  470.     static Float:fVec[3], Float:fVec2[3], Float:fVec3[3], Float:fOrigin[3], Float:Angles[3], Float:pVel[3]
  471.    
  472.     static Float:right, Float:dist_add, ent, Float:speed_mins, Float:speed_maxs, num
  473.    
  474.     speed_mins=get_pcvar_float(pcvar_flame_speed_mins)
  475.     speed_maxs=get_pcvar_float(pcvar_flame_speed_maxs)
  476.    
  477.     num=get_pcvar_num(pcvar_flame_num)
  478.        
  479.     pev(id, pev_v_angle, Angles)
  480.     pev(id, pev_velocity, pVel)
  481.    
  482.     get_weapon_position(id, fOrigin, .add_forward=20.0, .add_right=10.0, .add_up=-2.0)
  483.    
  484.     dist_add=random_float(get_pcvar_float(pcvar_flame_dist_mins), get_pcvar_float(pcvar_flame_dist_maxs))
  485.    
  486.     right=dist_add/-2.0
  487.    
  488.     for(new i; i<num; i++)
  489.     {
  490.         ent=CreateAnimationSprite(id, g_flame_classname, FlameModel, 0.7)
  491.            
  492.         angle_vector(Angles, ANGLEVECTOR_FORWARD, fVec)
  493.         angle_vector(Angles, ANGLEVECTOR_RIGHT, fVec2)
  494.         angle_vector(Angles, ANGLEVECTOR_UP, fVec3)
  495.        
  496.         xs_vec_mul_scalar(fVec, random_float(speed_mins, speed_maxs), fVec)
  497.         xs_vec_mul_scalar(fVec2, right, fVec2)
  498.         xs_vec_mul_scalar(fVec3, random_float(-50.0, 5.0), fVec3)      
  499.        
  500.         fVec[0]=fVec[0]+fVec2[0]+fVec3[0]+pVel[0]
  501.         fVec[1]=fVec[1]+fVec2[1]+fVec3[1]+pVel[1]
  502.         fVec[2]=fVec[2]+fVec2[2]+fVec3[2]+pVel[2]
  503.        
  504.         set_pev(ent, pev_origin, fOrigin)
  505.         set_pev(ent, pev_velocity, fVec)
  506.        
  507.         right+=dist_add/num
  508.     }
  509. }
  510.  
  511. public fwThink(ent)
  512. {
  513.     set_pev(ent, pev_nextthink, get_gametime()+0.035)
  514.    
  515.     static Float:amt
  516.    
  517.     pev(ent, pev_fuser1, amt)
  518.    
  519.     if(amt<=30.0)
  520.     {
  521.         fm_remove_entity(ent)
  522.        
  523.         return
  524.     }
  525.    
  526.     amt-=6.0
  527.    
  528.     set_pev(ent, pev_fuser1, amt)
  529.     set_pev(ent, pev_renderamt, amt)
  530.    
  531.     static Float:frame
  532.    
  533.     pev(ent, pev_frame, frame)
  534.    
  535.     frame+=0.25
  536.    
  537.     if(frame>=2.5)
  538.     {
  539.         static Float:scale
  540.        
  541.         pev(ent, pev_scale, scale)
  542.        
  543.         scale+=0.13
  544.        
  545.         set_pev(ent, pev_scale, scale)
  546.     }
  547.    
  548.    
  549.     set_pev(ent, pev_frame, frame)
  550. }
  551.  
  552. public fwTouch(ent, id)
  553. {
  554.     set_pev(ent, pev_movetype, MOVETYPE_NONE)
  555.     set_pev(ent, pev_solid, SOLID_NOT)
  556.    
  557.     if(pev(ent, pev_fuser1)<10.0)
  558.         return PLUGIN_CONTINUE
  559.    
  560.     new owner=pev(ent, pev_owner)
  561.    
  562.     new Float:Origin[3], victim
  563.    
  564.     pev(ent, pev_origin, Origin)
  565.    
  566.     while((victim=fm_find_ent_in_sphere(victim, Origin, 20.0))!=0)
  567.     {  
  568.         if(pev(victim, pev_takedamage)!=DAMAGE_NO&&pev(victim, pev_solid)!=SOLID_NOT)
  569.         {
  570.             if(is_user_alive(victim))
  571.             {
  572.                 {
  573.                     ExecuteHamB( Ham_TakeDamage, victim , ent ,owner, get_pcvar_float(pcvar_damage), DMG_BURN)
  574.                    
  575.                     set_pdata_int(victim, m_LastHitGroup, HIT_GENERIC)
  576.                 }
  577.             }
  578.             else
  579.                 ExecuteHamB( Ham_TakeDamage, victim , ent ,owner, get_pcvar_float(pcvar_damage), DMG_BURN)
  580.         }
  581.     }
  582.    
  583.     return  PLUGIN_HANDLED
  584. }
  585.  
  586.  
  587. public Redirect(id)
  588.     client_cmd(id, g_weapon_entity)
  589.  
  590.  
  591. public fwRemoveItem(id, ent)
  592. {
  593.     if(!is_valid_player(id))
  594.         return
  595.        
  596.     if(cs_get_weapon_id(ent)!=CSW_CANNON)
  597.         return
  598.    
  599.     WeapListSpr(id, g_weapon_entity)
  600. }
  601.  
  602. public WeapListSpr(id, const weapon[])
  603. {
  604.     message_begin( MSG_ONE, get_user_msgid("WeaponList"), .player=id )
  605.     write_string(weapon)
  606.     write_byte(3)
  607.     write_byte(200)
  608.     write_byte(-1)
  609.     write_byte(-1)
  610.     write_byte(0)
  611.     write_byte(4)
  612.     write_byte(CSW_CANNON)
  613.     write_byte(0)
  614.     message_end()  
  615. }
  616.  
  617.  
  618. stock is_valid_player(id)
  619. {
  620.     if(!is_user_alive(id))
  621.         return false
  622.    
  623.     if(!g_HasCannon[id])
  624.         return false
  625.    
  626.     return true
  627. }
  628.  
  629. stock get_weapon_position(id, Float:fOrigin[3], Float:add_forward=0.0, Float:add_right=0.0, Float:add_up=0.0)
  630. {
  631.     static Float:Angles[3],Float:ViewOfs[3], Float:vAngles[3]
  632.     static Float:Forward[3], Float:Right[3], Float:Up[3]
  633.    
  634.     pev(id, pev_v_angle, vAngles)
  635.     pev(id, pev_origin, fOrigin)
  636.     pev(id, pev_view_ofs, ViewOfs)
  637.     xs_vec_add(fOrigin, ViewOfs, fOrigin)
  638.    
  639.     pev(id, pev_angles, Angles)
  640.    
  641.     Angles[0]=vAngles[0]
  642.    
  643.     engfunc(EngFunc_MakeVectors, Angles)
  644.    
  645.     global_get(glb_v_forward, Forward)
  646.     global_get(glb_v_right, Right)
  647.     global_get(glb_v_up,  Up)
  648.    
  649.     xs_vec_mul_scalar(Forward, add_forward, Forward)
  650.     xs_vec_mul_scalar(Right, add_right, Right)
  651.     xs_vec_mul_scalar(Up, add_up, Up)
  652.    
  653.     fOrigin[0]=fOrigin[0]+Forward[0]+Right[0]+Up[0]
  654.     fOrigin[1]=fOrigin[1]+Forward[1]+Right[1]+Up[1]
  655.     fOrigin[2]=fOrigin[2]+Forward[2]+Right[2]+Up[2]
  656. }
  657.  
  658. stock playanim(player,anim)
  659. {
  660.     set_pev(player, pev_weaponanim, anim)
  661.     message_begin(MSG_ONE, SVC_WEAPONANIM, {0, 0, 0}, player)
  662.     write_byte(anim)
  663.     write_byte(pev(player, pev_body))
  664.     message_end()
  665. }
  666.  
  667. stock drop_weapons(id)
  668. {
  669.     static weapons[32], num, i, weaponid
  670.     num = 0
  671.     get_user_weapons(id, weapons, num)
  672.    
  673.     for (i = 0; i < num; i++)
  674.     {
  675.         weaponid = weapons[i]
  676.        
  677.         if ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)
  678.         {
  679.             static wname[32]
  680.            
  681.             get_weaponname(weaponid, wname, sizeof wname - 1)
  682.            
  683.             engclient_cmd(id, "drop", wname)
  684.         }
  685.     }
  686. }
  687.  
  688. stock fm_get_weapon_owner(weapon)
  689.     return get_pdata_cbase(weapon, 41, 4)
  690.  
  691.    
  692. stock Msg_CurWeapon(id, active, weapon, ammo)
  693. {
  694.     message_begin(MSG_ONE, gMsg_CurWeapon, {0,0,0}, id)
  695.     write_byte(active)
  696.     write_byte(weapon)
  697.     write_byte(ammo)
  698.     message_end()
  699. }
  700.  
  701. stock Msg_AmmoX(id, ammotype, num)
  702. {
  703.     message_begin(MSG_ONE, gMsg_AmmoX, {0,0,0}, id)
  704.     write_byte(ammotype)
  705.     write_byte(num)
  706.     message_end()      
  707. }
  708.  
  709. stock Msg_AmmoPickup(id, ammotype, num)
  710. {
  711.     message_begin(MSG_ONE, gMsg_AmmoPickup, {0,0,0}, id)
  712.     write_byte(ammotype)
  713.     write_byte(num)
  714.     message_end()      
  715. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement