hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.04.28. 09:58



Jelenlévő felhasználók

Jelenleg 536 felhasználó van jelen :: 2 regisztrált, 0 rejtett és 534 vendég

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

Regisztrált felhasználók: Bing [Bot], Google [Bot] az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása  Hozzászólás a témához  [ 1 hozzászólás ] 
Szerző Üzenet
HozzászólásElküldve: 2016.03.03. 09:44 
Offline
Jómunkásember
Avatar

Csatlakozott: 2013.08.10. 12:20
Hozzászólások: 340
Megköszönt másnak: 24 alkalommal
Megköszönték neki: 18 alkalommal
Valaki segítene? Ebből a speargun pluginból ezeket vettem ki és ha lövök a lövedék belém ragad és felrobbanok
5let?Én már tényleg nem értem... :/

  1. #include <zombieplague>
  2. --------------------------------------
  3.     item_spear = zp_register_extra_item("Spear Gun", 30, ZP_TEAM_HUMAN)
  4. ----------------------------
  5. public zp_user_infected_post(id)
  6. {
  7.     remove_speargun(id)
  8. }
  9. ---------------
  10. public zp_extra_item_selected(id, itemid)
  11. {
  12.     if(itemid == item_spear) get_speargun(id)
  13. }


Ebből csak ezt:|| zp_get_user_zombie(id)
  1. if(!is_user_alive(id) || zp_get_user_zombie(id) || !g_had_speargun[id] || get_user_weapon(id) != CSW_GALIL)
  2.         return HAM_IGNORED;

Ebből csak ezt: && zp_get_user_zombie(Id)
  1. if(is_user_alive(Id) && zp_get_user_zombie(Id))
  2.     {
  3.         set_pev(Ent, pev_movetype, MOVETYPE_FOLLOW)
  4.         set_pev(Ent, pev_solid, SOLID_NOT)
  5.         set_pev(Ent, pev_aiment, Id)
  6.         create_blood(originF)
  7.         create_blood(originF)
  8.         set_task(1.0, "explode", Ent)
  9.         engfunc(EngFunc_EmitSound, Ent, CHAN_WEAPON, speargun_hit, 1.0, ATTN_STATIC, 0, PITCH_NORM)
  10.        
  11.         static Float:MyOrigin[3]
  12.         pev(Owner, pev_origin, MyOrigin)
  13.        
  14.         hook_ent2(Id, MyOrigin, 500.0, 2)
  15.     }
  16.    
  17.     else if(!is_user_alive(Id))
  18.     {
  19.         engfunc(EngFunc_EmitSound, Ent, CHAN_WEAPON, speargun_wall, 1.0, ATTN_STATIC, 0, PITCH_NORM)
  20.         set_pev(Ent, pev_movetype, MOVETYPE_NONE)
  21.         set_pev(Ent, pev_solid, SOLID_NOT)
  22.         make_bullet(Owner, originF)
  23.         fake_smokes(Owner, originF)
  24.         set_task(1.0, "explode", Ent)
  25.     }
  26. }

És ebből:if(!zp_get_user_zombie(i))
continue
  1. public Damage_spear(Ent)
  2. {
  3.     static Owner; Owner = pev(Ent, pev_owner)
  4.     static Attacker
  5.     if(!is_user_alive(Owner))
  6.     {
  7.         Attacker = 0
  8.         return
  9.     } else Attacker = Owner
  10.        
  11.     for(new i = 0; i < g_MaxPlayers; i++)
  12.     {
  13.         if(!is_user_alive(i))
  14.             continue
  15.         if(entity_range(i, Ent) > 100.0)
  16.             continue
  17.         if(!zp_get_user_zombie(i))
  18.             continue

Alap zm plugin
  1. #include <amxmodx>
  2. #include <engine>
  3. #include <fakemeta>
  4. #include <fakemeta_util>
  5. #include <hamsandwich>
  6. #include <cstrike>
  7. #include <fun>
  8. #include <zombieplague>
  9.  
  10. #define PLUGIN "Spear Gun"
  11. #define VERSION "1.0"
  12. #define AUTHOR "m4m3ts"
  13.  
  14. const PDATA_SAFE = 2
  15. const OFFSET_LINUX_WEAPONS = 4
  16. const OFFSET_WEAPONOWNER = 41
  17. const m_flNextAttack = 83
  18. const m_szAnimExtention = 492
  19.  
  20. new const v_model[] = "models/v_speargun.mdl"
  21. new const p_model[] = "models/p_speargun.mdl"
  22. new const w_model[] = "models/w_speargun.mdl"
  23. new const ARROW_MODEL[] = "models/spear.mdl"
  24. new const GRENADE_EXPLOSION[] = "sprites/fexplo.spr"
  25. new const speargun_wall[] = "weapons/speargun_metal2.wav"
  26. new const speargun_hit[] = "weapons/speargun_stone1.wav"
  27. new const sound[3][] =
  28. {
  29.     "weapons/speargun-1.wav",
  30.     "weapons/speargun_clipin.wav",
  31.     "weapons/speargun_draw.wav"
  32. }
  33.  
  34.  
  35. new const sprite[3][] =
  36. {
  37.     "sprites/weapon_speargun.txt",
  38.     "sprites/640hud103.spr",
  39.     "sprites/640hud400.spr"
  40. }
  41.  
  42. enum
  43. {
  44.     IDLE = 0,
  45.     SHOOT,
  46.     RELOAD,
  47.     DRAW,
  48.     DRAW_EMPTY,
  49.     IDLE_EMPTY
  50. }
  51.  
  52. new sExplo, g_MaxPlayers, Ent, g_ready, g_rightclick
  53. new g_had_speargun[33], g_speargun_ammo[33]
  54. new g_old_weapon[33], g_smokepuff_id, m_iBlood[2]
  55. new sTrail, item_spear, cvar_dmg1_spear, cvar_dmg2_spear, cvar_ammo_spear
  56.  
  57. const PRIMARY_WEAPONS_BIT_SUM =
  58. (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<<
  59. 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)
  60.  
  61. public plugin_init()
  62. {
  63.     register_plugin(PLUGIN, VERSION, AUTHOR)
  64.     register_cvar("spear_version", "m4m3ts", FCVAR_SERVER|FCVAR_SPONLY)
  65.     register_forward(FM_CmdStart, "fw_CmdStart")
  66.     register_message(get_user_msgid("DeathMsg"), "message_DeathMsg")
  67.     register_forward(FM_SetModel, "fw_SetModel")
  68.     register_touch("spear_arrow", "*", "fw_touch2")
  69.     register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1)
  70.     register_forward(FM_TraceLine,"fw_traceline",1)
  71.     RegisterHam(Ham_Weapon_WeaponIdle, "weapon_galil", "fw_speargunidleanim", 1)
  72.     RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
  73.     RegisterHam(Ham_Item_AddToPlayer, "weapon_galil", "fw_AddToPlayer_Post", 1)
  74.     register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")
  75.    
  76.     cvar_dmg1_spear = register_cvar("zp_dmg1_spear", "400.0")
  77.     cvar_dmg2_spear = register_cvar("zp_dmg2_spear", "600.0")
  78.     cvar_ammo_spear = register_cvar("zp_spear_ammo", "40")
  79.    
  80.     item_spear = zp_register_extra_item("Spear Gun", 30, ZP_TEAM_HUMAN)
  81.    
  82.     register_clcmd("weapon_speargun", "hook_weapon")
  83.     register_clcmd("qwe2", "get_speargun")
  84.    
  85.     g_MaxPlayers = get_maxplayers()
  86. }
  87.  
  88.  
  89. public plugin_precache()
  90. {
  91.     precache_model(v_model)
  92.     precache_model(p_model)
  93.     precache_model(w_model)
  94.     precache_model(ARROW_MODEL)
  95.     precache_sound(speargun_wall)
  96.     precache_sound(speargun_hit)
  97.    
  98.     for(new i = 0; i < sizeof(sound); i++)
  99.         precache_sound(sound[i])
  100.        
  101.     for(new i = 1; i < sizeof(sprite); i++)
  102.         precache_model(sprite[i])
  103.    
  104.     g_smokepuff_id = engfunc(EngFunc_PrecacheModel, "sprites/wall_puff1.spr")
  105.     m_iBlood[0] = precache_model("sprites/blood.spr")
  106.     m_iBlood[1] = precache_model("sprites/bloodspray.spr")
  107.     sExplo = precache_model(GRENADE_EXPLOSION)
  108.     sTrail = precache_model("sprites/laserbeam.spr")
  109. }
  110.  
  111. public zp_user_infected_post(id)
  112. {
  113.     remove_speargun(id)
  114. }
  115.  
  116. public fw_PlayerKilled(id)
  117. {
  118.     remove_speargun(id)
  119. }
  120.  
  121. public hook_weapon(id)
  122. {
  123.     engclient_cmd(id, "weapon_galil")
  124.     return
  125. }
  126.  
  127. public zp_extra_item_selected(id, itemid)
  128. {
  129.     if(itemid == item_spear) get_speargun(id)
  130. }
  131.  
  132. public get_speargun(id)
  133. {
  134.     if(!is_user_alive(id))
  135.         return
  136.     drop_weapons(id, 1)
  137.     g_had_speargun[id] = 1
  138.     g_ready = 0
  139.     g_rightclick = 0
  140.     g_speargun_ammo[id] = get_pcvar_num(cvar_ammo_spear)
  141.    
  142.     fm_give_item(id, "weapon_galil")
  143.     update_ammo(id)
  144.    
  145.     static weapon_ent; weapon_ent = fm_find_ent_by_owner(-1, "weapon_galil", id)
  146.     if(pev_valid(weapon_ent)) cs_set_weapon_ammo(weapon_ent, 1)
  147. }
  148.  
  149. public message_DeathMsg(msg_id, msg_dest, id)
  150. {
  151.     static szTruncatedWeapon[33], iAttacker, iVictim
  152.        
  153.     get_msg_arg_string(4, szTruncatedWeapon, charsmax(szTruncatedWeapon))
  154.        
  155.     iAttacker = get_msg_arg_int(1)
  156.     iVictim = get_msg_arg_int(2)
  157.        
  158.     if(!is_user_connected(iAttacker) || iAttacker == iVictim) return PLUGIN_CONTINUE
  159.        
  160.     if(get_user_weapon(iAttacker) == CSW_GALIL)
  161.     {
  162.         if(g_had_speargun[iAttacker])
  163.             set_msg_arg_string(4, "Spear Gun")
  164.     }
  165.                
  166.     return PLUGIN_CONTINUE
  167. }
  168.  
  169. public remove_speargun(id)
  170. {
  171.     g_had_speargun[id] = 0
  172.     g_speargun_ammo[id] = 0
  173. }
  174.    
  175. public fw_UpdateClientData_Post(id, sendweapons, cd_handle)
  176. {
  177.     if(!is_user_alive(id) || !is_user_connected(id))
  178.         return FMRES_IGNORED   
  179.     if(get_user_weapon(id) == CSW_GALIL && g_had_speargun[id])
  180.         set_cd(cd_handle, CD_flNextAttack, get_gametime() + 0.001)
  181.    
  182.     return FMRES_HANDLED
  183. }
  184.  
  185. public Event_CurWeapon(id)
  186. {
  187.     if(!is_user_alive(id))
  188.         return
  189.        
  190.     if(get_user_weapon(id) == CSW_GALIL && g_had_speargun[id])
  191.     {
  192.         set_pev(id, pev_viewmodel2, v_model)
  193.         set_pev(id, pev_weaponmodel2, p_model)
  194.         remove_task(id)
  195.         if(g_old_weapon[id] != CSW_GALIL && g_speargun_ammo[id] >= 1) set_weapon_anim(id, DRAW)
  196.         if(g_old_weapon[id] != CSW_GALIL && g_speargun_ammo[id] == 0) set_weapon_anim(id, DRAW_EMPTY)
  197.         update_ammo(id)
  198.     }
  199.    
  200.     g_old_weapon[id] = get_user_weapon(id)
  201. }
  202.  
  203. public fw_speargunidleanim(Weapon)
  204. {
  205.     new id = get_pdata_cbase(Weapon, 41, 4)
  206.  
  207.     if(!is_user_alive(id) || zp_get_user_zombie(id) || !g_had_speargun[id] || get_user_weapon(id) != CSW_GALIL)
  208.         return HAM_IGNORED;
  209.  
  210.     if(g_speargun_ammo[id] >= 1)
  211.         return HAM_SUPERCEDE;
  212.    
  213.     if(g_speargun_ammo[id] == 0 && get_pdata_float(Weapon, 48, 4) <= 0.25)
  214.     {
  215.         set_weapon_anim(id, IDLE_EMPTY)
  216.         set_pdata_float(Weapon, 48, 20.0, 4)
  217.         return HAM_SUPERCEDE;
  218.     }
  219.  
  220.     return HAM_IGNORED;
  221. }
  222.  
  223. public fw_CmdStart(id, uc_handle, seed)
  224. {
  225.     if(!is_user_alive(id) || !is_user_connected(id))
  226.         return
  227.     if(get_user_weapon(id) != CSW_GALIL || !g_had_speargun[id])
  228.         return
  229.    
  230.     static ent; ent = fm_get_user_weapon_entity(id, CSW_GALIL)
  231.     if(!pev_valid(ent))
  232.         return
  233.    
  234.     static CurButton
  235.     CurButton = get_uc(uc_handle, UC_Buttons)
  236.    
  237.     if(CurButton & IN_ATTACK && get_pdata_float(id, 83, 5) <= 0.0)
  238.     {
  239.         if(get_pdata_float(ent, 46, OFFSET_LINUX_WEAPONS) > 0.0 || get_pdata_float(ent, 47, OFFSET_LINUX_WEAPONS) > 0.0)
  240.             return
  241.            
  242.         CurButton &= ~IN_ATTACK
  243.         set_uc(uc_handle, UC_Buttons, CurButton)
  244.        
  245.         if(g_speargun_ammo[id] == 0)
  246.             return
  247.         if(get_pdata_float(id, 83, 5) <= 0.0)
  248.         {
  249.             FireArrow_Charge(id)
  250.             g_ready = 1
  251.             g_speargun_ammo[id]--
  252.             update_ammo(id)
  253.             set_weapons_timeidle(id, CSW_GALIL, 2.2)
  254.             set_player_nextattackx(id, 2.2)
  255.             if(g_speargun_ammo[id] >= 1)
  256.             {
  257.                 set_weapon_anim(id, SHOOT)
  258.                 emit_sound(id, CHAN_WEAPON, sound[0], 1.0, ATTN_NORM, 0, PITCH_NORM)
  259.                 set_task(1.0, "reloadspear", id)
  260.             }
  261.             else
  262.             {
  263.                 set_weapon_anim(id, SHOOT)
  264.                 emit_sound(id, CHAN_WEAPON, sound[0], 1.0, ATTN_NORM, 0, PITCH_NORM)
  265.             }
  266.         }
  267.     }
  268.     else if(CurButton & IN_ATTACK2)
  269.     {
  270.         if(g_ready)
  271.         {
  272.             CurButton &= ~IN_ATTACK2
  273.             set_uc(uc_handle, UC_Buttons, CurButton)
  274.        
  275.             remove_task(Ent)
  276.             g_rightclick = 1
  277.             explode(Ent)
  278.         }
  279.     }
  280. }
  281.  
  282.  
  283. public reloadspear(id)
  284. {
  285.     if(get_user_weapon(id) != CSW_GALIL || !g_had_speargun[id])
  286.         return
  287.    
  288.     set_weapon_anim(id, RELOAD)
  289. }
  290.  
  291. public FireArrow_Charge(id)
  292. {
  293.     static Float:StartOrigin[3], Float:TargetOrigin[3], Float:angles[3], Float:angles_fix[3]
  294.     get_position(id, 2.0, 0.0, 0.0, StartOrigin)
  295.  
  296.     pev(id,pev_v_angle,angles)
  297.     Ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
  298.     if(!pev_valid(Ent)) return
  299.     angles_fix[0] = 360.0 - angles[0]
  300.     angles_fix[1] = angles[1]
  301.     angles_fix[2] = angles[2]
  302.     set_pev(Ent, pev_movetype, MOVETYPE_TOSS)
  303.     set_pev(Ent, pev_owner, id)
  304.    
  305.     entity_set_string(Ent, EV_SZ_classname, "spear_arrow")
  306.     engfunc(EngFunc_SetModel, Ent, ARROW_MODEL)
  307.     set_pev(Ent, pev_mins,{ -0.1, -0.1, -0.1 })
  308.     set_pev(Ent, pev_maxs,{ 0.1, 0.1, 0.1 })
  309.     set_pev(Ent, pev_origin, StartOrigin)
  310.     set_pev(Ent, pev_angles, angles_fix)
  311.     set_pev(Ent, pev_gravity, 0.01)
  312.     set_pev(Ent, pev_solid, SOLID_TRIGGER)
  313.     set_pev(Ent, pev_frame, 0.0)
  314.    
  315.     static Float:Velocity[3]
  316.     fm_get_aim_origin(id, TargetOrigin)
  317.     get_speed_vector(StartOrigin, TargetOrigin, 1500.0, Velocity)
  318.     set_pev(Ent, pev_velocity, Velocity)
  319.    
  320.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  321.     write_byte(TE_BEAMFOLLOW) // Temporary entity ID
  322.     write_short(Ent) // Entity
  323.     write_short(sTrail) // Sprite index
  324.     write_byte(7) // Life
  325.     write_byte(1) // Line width
  326.     write_byte(10)
  327.     write_byte(229)
  328.     write_byte(255)
  329.     write_byte(100) // Alpha
  330.     message_end()
  331. }
  332.  
  333. public fw_touch2(Ent, Id)
  334. {
  335.     // If ent is valid
  336.     if(!pev_valid(Ent))
  337.         return
  338.     if(pev(Ent, pev_movetype) == MOVETYPE_NONE)
  339.         return
  340.        
  341.     static Owner; Owner = pev(Ent, pev_owner)
  342.    
  343.     static classnameptd[32]
  344.     pev(Id, pev_classname, classnameptd, 31)
  345.     if (equali(classnameptd, "func_breakable")) ExecuteHamB( Ham_TakeDamage, Id, 0, 0, 300.0, DMG_GENERIC )
  346.    
  347.     // Get it's origin
  348.     new Float:originF[3]
  349.     pev(Ent, pev_origin, originF)
  350.     // Alive...
  351.    
  352.     if(is_user_alive(Id) && zp_get_user_zombie(Id))
  353.     {
  354.         set_pev(Ent, pev_movetype, MOVETYPE_FOLLOW)
  355.         set_pev(Ent, pev_solid, SOLID_NOT)
  356.         set_pev(Ent, pev_aiment, Id)
  357.         create_blood(originF)
  358.         create_blood(originF)
  359.         set_task(1.0, "explode", Ent)
  360.         engfunc(EngFunc_EmitSound, Ent, CHAN_WEAPON, speargun_hit, 1.0, ATTN_STATIC, 0, PITCH_NORM)
  361.        
  362.         static Float:MyOrigin[3]
  363.         pev(Owner, pev_origin, MyOrigin)
  364.        
  365.         hook_ent2(Id, MyOrigin, 500.0, 2)
  366.     }
  367.    
  368.     else if(!is_user_alive(Id))
  369.     {
  370.         engfunc(EngFunc_EmitSound, Ent, CHAN_WEAPON, speargun_wall, 1.0, ATTN_STATIC, 0, PITCH_NORM)
  371.         set_pev(Ent, pev_movetype, MOVETYPE_NONE)
  372.         set_pev(Ent, pev_solid, SOLID_NOT)
  373.         make_bullet(Owner, originF)
  374.         fake_smokes(Owner, originF)
  375.         set_task(1.0, "explode", Ent)
  376.     }
  377. }
  378.  
  379. public explode(Ent)
  380. {
  381.     new Float:originZ[3], Float:originX[3]
  382.     pev(Ent, pev_origin, originX)
  383.     entity_get_vector(Ent, EV_VEC_origin, originZ)
  384.     // Draw explosion
  385.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  386.     write_byte(TE_EXPLOSION) // Temporary entity ID
  387.     engfunc(EngFunc_WriteCoord, originX[0]) // engfunc because float
  388.     engfunc(EngFunc_WriteCoord, originX[1])
  389.     engfunc(EngFunc_WriteCoord, originX[2]+30.0)
  390.     write_short(sExplo) // Sprite index
  391.     write_byte(20) // Scale
  392.     write_byte(200) // Framerate
  393.     write_byte(0) // Flags
  394.     message_end()
  395.    
  396.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originZ, 0)
  397.     write_byte(TE_PARTICLEBURST) // TE id
  398.     engfunc(EngFunc_WriteCoord, originZ[0]) // x
  399.     engfunc(EngFunc_WriteCoord, originZ[1]) // y
  400.     engfunc(EngFunc_WriteCoord, originZ[2]) // z
  401.     write_short(30) // radius
  402.     write_byte(0) // color
  403.     write_byte(1) // duration (will be randomized a bit)
  404.     message_end()
  405.    
  406.     Damage_spear(Ent)
  407.            
  408.     remove_entity(Ent)
  409.    
  410.     g_ready = 0
  411. }
  412.  
  413. public Damage_spear(Ent)
  414. {
  415.     static Owner; Owner = pev(Ent, pev_owner)
  416.     static Attacker
  417.     if(!is_user_alive(Owner))
  418.     {
  419.         Attacker = 0
  420.         return
  421.     } else Attacker = Owner
  422.        
  423.     for(new i = 0; i < g_MaxPlayers; i++)
  424.     {
  425.         if(!is_user_alive(i))
  426.             continue
  427.         if(entity_range(i, Ent) > 100.0)
  428.             continue
  429.         if(!zp_get_user_zombie(i))
  430.             continue
  431.            
  432.         if(!g_rightclick) ExecuteHamB(Ham_TakeDamage, i, 0, Attacker, get_pcvar_float(cvar_dmg1_spear), DMG_BULLET)
  433.         else ExecuteHamB(Ham_TakeDamage, i, 0, Attacker, get_pcvar_float(cvar_dmg2_spear), DMG_BULLET)
  434.        
  435.         static Float:v_Velocity[3], Float:ori_Velocity[3]
  436.         pev(i, pev_velocity, ori_Velocity)
  437.         v_Velocity[0] = ori_Velocity[0]
  438.         v_Velocity[1] = ori_Velocity[1]
  439.         v_Velocity[2] = 230.0
  440.         entity_set_vector(i, EV_VEC_velocity, v_Velocity)
  441.         g_rightclick = 0
  442.     }
  443.    
  444.     for(new i = 0; i < g_MaxPlayers; i++)
  445.     {
  446.         if(!is_user_alive(i))
  447.             continue
  448.         if(entity_range(i, Ent) > 200.0)
  449.             continue
  450.         if(!g_had_speargun[i])
  451.             continue
  452.         if(i != Owner)
  453.             continue
  454.            
  455.         static Float:v_Velocity[3], Float:ori_Velocity[3]
  456.         pev(i, pev_velocity, ori_Velocity)
  457.         v_Velocity[0] = ori_Velocity[0]
  458.         v_Velocity[1] = ori_Velocity[1]
  459.         v_Velocity[2] = 250.0
  460.         entity_set_vector(i, EV_VEC_velocity, v_Velocity)
  461.     }
  462. }
  463.  
  464. public fw_SetModel(entity, model[])
  465. {
  466.     if(!pev_valid(entity))
  467.         return FMRES_IGNORED
  468.    
  469.     static Classname[64]
  470.     pev(entity, pev_classname, Classname, sizeof(Classname))
  471.    
  472.     if(!equal(Classname, "weaponbox"))
  473.         return FMRES_IGNORED
  474.    
  475.     static id
  476.     id = pev(entity, pev_owner)
  477.    
  478.     if(equal(model, "models/w_galil.mdl"))
  479.     {
  480.         static weapon
  481.         weapon = fm_get_user_weapon_entity(entity, CSW_GALIL)
  482.        
  483.         if(!pev_valid(weapon))
  484.             return FMRES_IGNORED
  485.        
  486.         if(g_had_speargun[id])
  487.         {
  488.             set_pev(weapon, pev_impulse, 19391)
  489.             set_pev(weapon, pev_iuser4, g_speargun_ammo[id])
  490.             engfunc(EngFunc_SetModel, entity, w_model)
  491.            
  492.             g_had_speargun[id] = 0
  493.             g_speargun_ammo[id] = 0
  494.            
  495.             return FMRES_SUPERCEDE
  496.         }
  497.     }
  498.  
  499.     return FMRES_IGNORED;
  500. }
  501.  
  502. public fw_AddToPlayer_Post(ent, id)
  503. {
  504.     if(pev(ent, pev_impulse) == 19391)
  505.     {
  506.         g_had_speargun[id] = 1
  507.         g_speargun_ammo[id] = pev(ent, pev_iuser4)
  508.        
  509.         set_pev(ent, pev_impulse, 0)
  510.     }          
  511.    
  512.     message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("WeaponList"), _, id)
  513.     write_string((g_had_speargun[id] == 1 ? "weapon_speargun" : "weapon_galil"))
  514.     write_byte(1)
  515.     write_byte(90)
  516.     write_byte(-1)
  517.     write_byte(-1)
  518.     write_byte(0)
  519.     write_byte(17)
  520.     write_byte(CSW_GALIL)
  521.     write_byte(0)
  522.     message_end()
  523. }
  524.  
  525. public update_ammo(id)
  526. {
  527.     if(!is_user_alive(id))
  528.         return
  529.    
  530.     static weapon_ent; weapon_ent = fm_find_ent_by_owner(-1, "weapon_galil", id)
  531.     if(pev_valid(weapon_ent)) cs_set_weapon_ammo(weapon_ent, 1)
  532.    
  533.     cs_set_user_bpammo(id, CSW_GALIL, 0)
  534.    
  535.     engfunc(EngFunc_MessageBegin, MSG_ONE_UNRELIABLE, get_user_msgid("CurWeapon"), {0, 0, 0}, id)
  536.     write_byte(1)
  537.     write_byte(CSW_GALIL)
  538.     write_byte(-1)
  539.     message_end()
  540.    
  541.     message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("AmmoX"), _, id)
  542.     write_byte(1)
  543.     write_byte(g_speargun_ammo[id])
  544.     message_end()
  545. }
  546.  
  547. public fw_traceline(Float:v1[3],Float:v2[3],noMonsters,id,ptr)
  548. {
  549.     if(!is_user_alive(id))
  550.         return HAM_IGNORED 
  551.     if(get_user_weapon(id) != CSW_GALIL || !g_had_speargun[id])
  552.         return HAM_IGNORED
  553.  
  554.     // get crosshair aim
  555.     static Float:aim[3];
  556.     get_aim(id,v1,aim);
  557.    
  558.     // do another trace to this spot
  559.     new trace = create_tr2();
  560.     engfunc(EngFunc_TraceLine,v1,aim,noMonsters,id,trace);
  561.    
  562.     // copy ints
  563.     set_tr2(ptr,TR_AllSolid,get_tr2(trace,TR_AllSolid));
  564.     set_tr2(ptr,TR_StartSolid,get_tr2(trace,TR_StartSolid));
  565.     set_tr2(ptr,TR_InOpen,get_tr2(trace,TR_InOpen));
  566.     set_tr2(ptr,TR_InWater,get_tr2(trace,TR_InWater));
  567.     set_tr2(ptr,TR_pHit,get_tr2(trace,TR_pHit));
  568.     set_tr2(ptr,TR_iHitgroup,get_tr2(trace,TR_iHitgroup));
  569.  
  570.     // copy floats
  571.     get_tr2(trace,TR_flFraction,aim[0]);
  572.     set_tr2(ptr,TR_flFraction,aim[0]);
  573.     get_tr2(trace,TR_flPlaneDist,aim[0]);
  574.     set_tr2(ptr,TR_flPlaneDist,aim[0]);
  575.    
  576.     // copy vecs
  577.     get_tr2(trace,TR_vecEndPos,aim);
  578.     set_tr2(ptr,TR_vecEndPos,aim);
  579.     get_tr2(trace,TR_vecPlaneNormal,aim);
  580.     set_tr2(ptr,TR_vecPlaneNormal,aim);
  581.  
  582.     // get rid of new trace
  583.     free_tr2(trace);
  584.  
  585.     return FMRES_IGNORED;
  586. }
  587.  
  588. get_aim(id,Float:source[3],Float:ret[3])
  589. {
  590.     static Float:vAngle[3], Float:pAngle[3], Float:dir[3], Float:temp[3];
  591.  
  592.     // get aiming direction from forward global based on view angle and punch angle
  593.     pev(id,pev_v_angle,vAngle);
  594.     pev(id,pev_punchangle,pAngle);
  595.     xs_vec_add(vAngle,pAngle,temp);
  596.     engfunc(EngFunc_MakeVectors,temp);
  597.     global_get(glb_v_forward,dir);
  598.    
  599.     /* vecEnd = vecSrc + vecDir * flDistance; */
  600.     xs_vec_mul_scalar(dir,8192.0,temp);
  601.     xs_vec_add(source,temp,ret);
  602. }
  603.  
  604. stock make_bullet(id, Float:Origin[3])
  605. {
  606.     // Find target
  607.     new decal = random_num(41, 45)
  608.     const loop_time = 2
  609.    
  610.     static Body, Target
  611.     get_user_aiming(id, Target, Body, 999999)
  612.    
  613.     if(is_user_connected(Target))
  614.         return
  615.    
  616.     for(new i = 0; i < loop_time; i++)
  617.     {
  618.         // Put decal on "world" (a wall)
  619.         message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  620.         write_byte(TE_WORLDDECAL)
  621.         engfunc(EngFunc_WriteCoord, Origin[0])
  622.         engfunc(EngFunc_WriteCoord, Origin[1])
  623.         engfunc(EngFunc_WriteCoord, Origin[2])
  624.         write_byte(decal)
  625.         message_end()
  626.     }
  627. }
  628.  
  629. public fake_smokes(id, Float:Origin[3])
  630. {
  631.     static TE_FLAG
  632.    
  633.     TE_FLAG |= TE_EXPLFLAG_NODLIGHTS
  634.     TE_FLAG |= TE_EXPLFLAG_NOSOUND
  635.     TE_FLAG |= TE_EXPLFLAG_NOPARTICLES
  636.    
  637.     engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, Origin, 0)
  638.     write_byte(TE_EXPLOSION)
  639.     engfunc(EngFunc_WriteCoord, Origin[0])
  640.     engfunc(EngFunc_WriteCoord, Origin[1])
  641.     engfunc(EngFunc_WriteCoord, Origin[2] - 10.0)
  642.     write_short(g_smokepuff_id)
  643.     write_byte(2)
  644.     write_byte(80)
  645.     write_byte(TE_FLAG)
  646.     message_end()
  647. }
  648.  
  649. stock set_weapon_anim(id, anim)
  650. {
  651.     if(!is_user_alive(id))
  652.         return
  653.    
  654.     set_pev(id, pev_weaponanim, anim)
  655.    
  656.     message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, {0, 0, 0}, id)
  657.     write_byte(anim)
  658.     write_byte(pev(id, pev_body))
  659.     message_end()
  660. }
  661.  
  662. stock create_blood(const Float:origin[3])
  663. {
  664.     // Show some blood :)
  665.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  666.     write_byte(TE_BLOODSPRITE)
  667.     engfunc(EngFunc_WriteCoord, origin[0])
  668.     engfunc(EngFunc_WriteCoord, origin[1])
  669.     engfunc(EngFunc_WriteCoord, origin[2])
  670.     write_short(m_iBlood[1])
  671.     write_short(m_iBlood[0])
  672.     write_byte(75)
  673.     write_byte(8)
  674.     message_end()
  675. }
  676.  
  677. stock drop_weapons(id, dropwhat)
  678. {
  679.     static weapons[32], num, i, weaponid
  680.     num = 0
  681.     get_user_weapons(id, weapons, num)
  682.      
  683.     for (i = 0; i < num; i++)
  684.     {
  685.         weaponid = weapons[i]
  686.          
  687.         if (dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM))
  688.         {
  689.             static wname[32]
  690.             get_weaponname(weaponid, wname, sizeof wname - 1)
  691.             engclient_cmd(id, "drop", wname)
  692.         }
  693.     }
  694. }
  695.  
  696. stock get_speed_vector(const Float:origin1[3],const Float:origin2[3],Float:speed, Float:new_velocity[3])
  697. {
  698.     new_velocity[0] = origin2[0] - origin1[0]
  699.     new_velocity[1] = origin2[1] - origin1[1]
  700.     new_velocity[2] = origin2[2] - origin1[2]
  701.     static Float:num; num = floatsqroot(speed*speed / (new_velocity[0]*new_velocity[0] + new_velocity[1]*new_velocity[1] + new_velocity[2]*new_velocity[2]))
  702.     new_velocity[0] *= num
  703.     new_velocity[1] *= num
  704.     new_velocity[2] *= num
  705.    
  706.     return 1;
  707. }
  708.  
  709. stock get_position(id,Float:forw, Float:right, Float:up, Float:vStart[])
  710. {
  711.     static Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
  712.    
  713.     pev(id, pev_origin, vOrigin)
  714.     pev(id, pev_view_ofs, vUp) //for player
  715.     xs_vec_add(vOrigin, vUp, vOrigin)
  716.     pev(id, pev_v_angle, vAngle) // if normal entity ,use pev_angles
  717.    
  718.     angle_vector(vAngle, ANGLEVECTOR_FORWARD, vForward) //or use EngFunc_AngleVectors
  719.     angle_vector(vAngle, ANGLEVECTOR_RIGHT, vRight)
  720.     angle_vector(vAngle, ANGLEVECTOR_UP, vUp)
  721.    
  722.     vStart[0] = vOrigin[0] + vForward[0] * forw + vRight[0] * right + vUp[0] * up
  723.     vStart[1] = vOrigin[1] + vForward[1] * forw + vRight[1] * right + vUp[1] * up
  724.     vStart[2] = vOrigin[2] + vForward[2] * forw + vRight[2] * right + vUp[2] * up
  725. }
  726.  
  727. stock hook_ent2(ent, Float:VicOrigin[3], Float:speed, type)
  728. {
  729.     static Float:fl_Velocity[3]
  730.     static Float:EntOrigin[3]
  731.    
  732.     pev(ent, pev_origin, EntOrigin)
  733.     static Float:distance_f
  734.     distance_f = 100.0
  735.    
  736.     new Float:fl_Time = distance_f / speed
  737.    
  738.     if(type == 1)
  739.     {
  740.         fl_Velocity[0] = ((VicOrigin[0] - EntOrigin[0]) / fl_Time) * 1.5
  741.         fl_Velocity[1] = ((VicOrigin[1] - EntOrigin[1]) / fl_Time) * 1.5
  742.         fl_Velocity[2] = (VicOrigin[2] - EntOrigin[2]) / fl_Time       
  743.         } else if(type == 2) {
  744.         fl_Velocity[0] = ((EntOrigin[0] - VicOrigin[0]) / fl_Time) * 1.5
  745.         fl_Velocity[1] = ((EntOrigin[1] - VicOrigin[1]) / fl_Time) * 1.5
  746.         fl_Velocity[2] = (EntOrigin[2] - VicOrigin[2]) / fl_Time
  747.     }
  748.    
  749.     entity_set_vector(ent, EV_VEC_velocity, fl_Velocity)
  750. }
  751.  
  752. stock set_weapons_timeidle(id, WeaponId ,Float:TimeIdle)
  753. {
  754.     if(!is_user_alive(id))
  755.         return
  756.        
  757.     static entwpn; entwpn = fm_get_user_weapon_entity(id, WeaponId)
  758.     if(!pev_valid(entwpn))
  759.         return
  760.        
  761.     set_pdata_float(entwpn, 46, TimeIdle, OFFSET_LINUX_WEAPONS)
  762.     set_pdata_float(entwpn, 47, TimeIdle, OFFSET_LINUX_WEAPONS)
  763.     set_pdata_float(entwpn, 48, TimeIdle + 0.5, OFFSET_LINUX_WEAPONS)
  764. }
  765.  
  766. stock set_player_nextattackx(id, Float:nexttime)
  767. {
  768.     if(!is_user_alive(id))
  769.         return
  770.        
  771.     set_pdata_float(id, m_flNextAttack, nexttime, 5)
  772. }
  773. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  774. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
  775. */

_________________
KÖSZÖNÖM GOMB! <-- Ez nem LIKE gomb!Ha segítettem,nyomd meg nyugodtan!

Ők köszönték meg HTML nek ezt a hozzászólást: cEsZaR (2016.03.03. 09:46)
  Népszerűség: 2.27%


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése:  Rendezés  
Új téma nyitása  Hozzászólás a témához  [ 1 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 48 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole