Converted Guillotine

Zombies/Humans Extra-Items
Post Reply
johnnysins2000
Veteran Member
Veteran Member
Pakistan
Posts: 672
Joined: 1 Year Ago
Location: Lahore
Has thanked: 11 times
Been thanked: 10 times
Age: 22
Contact:

Guillotine

#1

Post by johnnysins2000 » 1 Year Ago

Guillotine

Description:
  • This is An CSO Human extra item. It is a type of A Blade which u can throw it towards Zombies and then it comes back Automatically after hitting the Blade To Zombies. You can increase the damage if u want to!


Installation & Instructions:
  • Simply install it like any plugin and Don't forget to copy Models In Zm_escape Folder, Sounds, Sprites.
Screenshots:
  • ImageImage
Downloads:
  • Guillotine.zip
    [ZE] Extra-Item: Guillotine
    (1.02 MiB) Downloaded 166 times
    Guillotine.zip
    [ZE] Extra-Item: Guillotine
    (1.02 MiB) Downloaded 166 times
Last edited by Raheem on 28 Jul 2017, 02:25, edited 1 time in total.
Reason: Updating to work with Zombie Escape v1.1
Nobody Is That Busy If They Make Time :roll:

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1723
Joined: 1 Year Ago
Location: Egypt
Has thanked: 28 times
Been thanked: 78 times
Age: 21
Contact:

#2

Post by Raheem » 1 Year Ago

Nice sharing Brother :D.
You don't know? Learn and you will know.

User avatar
Jack GamePlay
Mod Developer
Mod Developer
Egypt
Posts: 534
Joined: 1 Year Ago
Location: Egypt
Has thanked: 31 times
Been thanked: 42 times
Age: 19
Contact:

#3

Post by Jack GamePlay » 1 Year Ago

I like it! :)
Image

User avatar
Prekrasnoe Daleko
Member
Member
Russia
Posts: 32
Joined: 11 Months Ago
Location: Россия,Крым
Has thanked: 11 times
Been thanked: 1 time
Age: 20
Contact:

#4

Post by Prekrasnoe Daleko » 11 Months Ago

It would be nice to do this only for vip players

johnnysins2000
Veteran Member
Veteran Member
Pakistan
Posts: 672
Joined: 1 Year Ago
Location: Lahore
Has thanked: 11 times
Been thanked: 10 times
Age: 22
Contact:

#5

Post by johnnysins2000 » 11 Months Ago

Ayde12 wrote:
11 Months Ago
It would be nice to do this only for vip players
Just convert it to VIP extra Item If u want this for VIP
Nobody Is That Busy If They Make Time :roll:

Amine_escaper_dz
Member
Member
Algeria
Posts: 4
Joined: 3 Months Ago
Has thanked: 2 times
Been thanked: 0
Contact:

#6

Post by Amine_escaper_dz » 3 Months Ago

Can you change guillotine to knife like server zombie escape world war zombie ?

[ Post made via Android ]

shady101852
Member
Member
United States of America
Posts: 27
Joined: 3 Months Ago
Has thanked: 9 times
Been thanked: 2 times
Contact:

#7

Post by shady101852 » 3 Months Ago

this item goes right through the zombies & does not seem to be doing any damage, is it supposed to be this way?

User avatar
Mark
Senior Member
Senior Member
United States of America
Posts: 258
Joined: 5 Months Ago
Location: Des Moines/USA
Donation: 1x donated in total €10.00
Has thanked: 6 times
Been thanked: 19 times
Age: 33
Contact:

#8

Post by Mark » 3 Months Ago

shady101852 wrote:
3 Months Ago
this item goes right through the zombies & does not seem to be doing any damage, is it supposed to be this way?
Fixed to make damage on zombie
  1. #include <zombie_escape>
  2. #include <engine>
  3. #include <fakemeta_util>
  4. #include <cstrike>
  5. #include <fun>
  6.  
  7. #define PLUGIN "Blood-Dripper"
  8. #define VERSION "1.0"
  9. #define AUTHOR "m4m3ts"
  10.  
  11. #define CSW_BDRIPPER CSW_MAC10
  12. #define weapon_guillotine "weapon_mac10"
  13. #define old_event "events/mac10.sc"
  14. #define old_w_model "models/w_mac10.mdl"
  15. #define WEAPON_SECRETCODE 1329419
  16.  
  17.  
  18. #define DEFAULT_AMMO 10
  19. #define DAMAGE 200
  20. #define BDRIP_CLASSNAME "Blood Dripper"
  21. #define WEAPON_ANIMEXT "knife"
  22.  
  23. #define Get_Ent_Data(%1,%2) get_pdata_int(%1,%2,4)
  24. #define Set_Ent_Data(%1,%2,%3) set_pdata_int(%1,%2,%3,4)
  25.  
  26. const PDATA_SAFE = 2
  27. const OFFSET_LINUX_WEAPONS = 4
  28. const OFFSET_WEAPONOWNER = 41
  29.  
  30. new const v_model[] = "models/zombie_escape/v_guillotine.mdl"
  31. new const p_model[] = "models/zombie_escape/p_guillotine.mdl"
  32. new const w_model[] = "models/zombie_escape/w_guillotine.mdl"
  33. new const KNIFE_MODEL[] = "models/zombie_escape/guillotine_projectile.mdl"
  34. new const PECAH_MODEL[] = "models/zombie_escape/gibs_guilotine.mdl"
  35. new const hit_wall[] = "weapons/janus9_stone1.wav"
  36. new const hit_wall2[] = "weapons/janus9_stone2.wav"
  37. new const weapon_sound[6][] =
  38. {
  39.     "weapons/guillotine_catch2.wav",
  40.     "weapons/guillotine_draw.wav",
  41.     "weapons/guillotine_draw_empty.wav",
  42.     "weapons/guillotine_explode.wav",
  43.     "weapons/guillotine_red.wav",
  44.     "weapons/guillotine-1.wav"
  45. }
  46.  
  47.  
  48. new const WeaponResource[3][] =
  49. {
  50.     "sprites/weapon_guillotine.txt",
  51.     "sprites/640hud120.spr",
  52.     "sprites/guillotine_lost.spr"
  53. }
  54.  
  55. enum
  56. {
  57.     ANIM_IDLE = 0,
  58.     ANIM_IDLE_EMPTY,
  59.     ANIM_SHOOT,
  60.     ANIM_DRAW,
  61.     ANIM_DRAW_EMPTY,
  62.     ANIM_IDLE_SHOOT,
  63.     ANIM_IDLE_SHOOT2,
  64.     ANIM_CATCH,
  65.     ANIM_LOST
  66. }
  67.  
  68. new g_MsgDeathMsg
  69.  
  70. new g_had_guillotine[33], g_guillotine_ammo[33], shoot_mode[33], shoot_ent_mode[33], g_pecah, headshot_mode[33], ent_sentuh[33], ent_sentuh_balik[33]
  71. new g_old_weapon[33], g_smokepuff_id, m_iBlood[2], guillotine_korban[33], headshot_korban[33], gmsgScoreInfo
  72. new g_iItemID
  73.  
  74. const PRIMARY_WEAPONS_BIT_SUM =
  75. (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<<
  76. 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)
  77.  
  78. public plugin_init()
  79. {
  80.     register_plugin(PLUGIN, VERSION, AUTHOR)
  81.     register_cvar("guillotine_version", "m4m3ts", FCVAR_SERVER|FCVAR_SPONLY)
  82.     register_forward(FM_CmdStart, "fw_CmdStart")
  83.     register_forward(FM_SetModel, "fw_SetModel")
  84.     register_think(BDRIP_CLASSNAME, "fw_Think")
  85.     register_touch(BDRIP_CLASSNAME, "*", "fw_touch")
  86.     register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1)
  87.     register_forward(FM_TraceLine, "fw_traceline", 1)
  88.     register_forward(FM_AddToFullPack, "fm_addtofullpack_post", 1)
  89.     RegisterHam(Ham_Weapon_WeaponIdle, weapon_guillotine, "fw_guillotineidleanim", 1)
  90.     RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
  91.     RegisterHam(Ham_Item_AddToPlayer, weapon_guillotine, "fw_AddToPlayer_Post", 1)
  92.     register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")
  93.    
  94.     g_iItemID = ze_register_item("Blood Dripper", 20, 0)
  95.    
  96.     register_clcmd("weapon_guillotine", "hook_weapon")
  97.    
  98.     g_MsgDeathMsg = get_user_msgid("DeathMsg")
  99.     gmsgScoreInfo = get_user_msgid("ScoreInfo")
  100. }
  101.  
  102.  
  103. public plugin_precache()
  104. {
  105.     precache_model(v_model)
  106.     precache_model(p_model)
  107.     precache_model(w_model)
  108.     precache_model(KNIFE_MODEL)
  109.     g_pecah = precache_model(PECAH_MODEL)
  110.     precache_sound(hit_wall)
  111.     precache_sound(hit_wall2)
  112.    
  113.     for(new i = 0; i < sizeof(weapon_sound); i++)
  114.         precache_sound(weapon_sound[i])
  115.    
  116.     for(new i = 1; i < sizeof(WeaponResource); i++)
  117.         precache_model(WeaponResource[i])
  118.    
  119.     g_smokepuff_id = engfunc(EngFunc_PrecacheModel, WeaponResource[2])
  120.     m_iBlood[0] = precache_model("sprites/blood.spr")
  121.     m_iBlood[1] = precache_model("sprites/bloodspray.spr") 
  122. }
  123.  
  124. public ze_user_infected(id)
  125. {
  126.     remove_guillotine(id)
  127. }
  128.  
  129. public fw_PlayerKilled(id)
  130. {
  131.     remove_guillotine(id)
  132. }
  133.  
  134. public hook_weapon(id)
  135. {
  136.     engclient_cmd(id, weapon_guillotine)
  137.     return
  138. }
  139.  
  140. public ze_select_item_pre(id, itemid)
  141. {
  142.     // This not our item?
  143.     if (itemid != g_iItemID)
  144.         return ZE_ITEM_AVAILABLE
  145.    
  146.     // Available for Humans only, So don't show it for zombies
  147.     if (ze_is_user_zombie(id))
  148.         return ZE_ITEM_DONT_SHOW
  149.    
  150.     // Finally return that it's available
  151.     return ZE_ITEM_AVAILABLE
  152. }
  153.  
  154. public ze_select_item_post(id, itemid)
  155. {
  156.     // This is not our item, Block it here and don't execute the blew code
  157.     if (itemid != g_iItemID)
  158.         return
  159.    
  160.     get_guillotine(id)
  161. }
  162.  
  163. public get_guillotine(id)
  164. {
  165.     if(!is_user_alive(id))
  166.         return
  167.     drop_weapons(id, 1)
  168.     g_had_guillotine[id] = 1
  169.     g_guillotine_ammo[id] = DEFAULT_AMMO
  170.    
  171.     give_item(id, weapon_guillotine)
  172.     update_ammo(id)
  173.    
  174.     static weapon_ent; weapon_ent = fm_find_ent_by_owner(-1, weapon_guillotine, id)
  175.     if(pev_valid(weapon_ent)) cs_set_weapon_ammo(weapon_ent, 1)
  176. }
  177.  
  178. public remove_guillotine(id)
  179. {
  180.     g_had_guillotine[id] = 0
  181. }
  182.  
  183. public refill_guillotine(id)
  184. {  
  185.     if(g_had_guillotine[id]) g_guillotine_ammo[id] = 15
  186.    
  187.     if(get_user_weapon(id) == CSW_BDRIPPER && g_had_guillotine[id]) update_ammo(id)
  188. }
  189.    
  190. public fw_UpdateClientData_Post(id, sendweapons, cd_handle)
  191. {
  192.     if(!is_user_alive(id) || !is_user_connected(id))
  193.         return FMRES_IGNORED   
  194.     if(get_user_weapon(id) == CSW_BDRIPPER && g_had_guillotine[id])
  195.         set_cd(cd_handle, CD_flNextAttack, get_gametime() + 0.001)
  196.    
  197.     return FMRES_HANDLED
  198. }
  199.  
  200. public Event_CurWeapon(id)
  201. {
  202.     if(!is_user_alive(id))
  203.         return
  204.        
  205.     if(get_user_weapon(id) == CSW_BDRIPPER && g_had_guillotine[id])
  206.     {
  207.         set_pev(id, pev_viewmodel2, v_model)
  208.         set_pev(id, pev_weaponmodel2, p_model)
  209.         set_pdata_string(id, 492 * 4, WEAPON_ANIMEXT, -1 , 20)
  210.         if(g_old_weapon[id] != CSW_BDRIPPER && g_guillotine_ammo[id] >= 1) set_weapon_anim(id, ANIM_DRAW)
  211.         if(g_old_weapon[id] != CSW_BDRIPPER && g_guillotine_ammo[id] == 0) set_weapon_anim(id, ANIM_DRAW_EMPTY)
  212.         update_ammo(id)
  213.     }
  214.    
  215.     g_old_weapon[id] = get_user_weapon(id)
  216. }
  217.  
  218. public fw_guillotineidleanim(Weapon)
  219. {
  220.     new id = get_pdata_cbase(Weapon, 41, 4)
  221.  
  222.     if(!is_user_alive(id) || ze_is_user_zombie(id) || !g_had_guillotine[id] || get_user_weapon(id) != CSW_BDRIPPER)
  223.         return HAM_IGNORED;
  224.    
  225.     if(shoot_mode[id] == 0 && g_guillotine_ammo[id] >= 1)
  226.         return HAM_SUPERCEDE;
  227.    
  228.     if(headshot_mode[id] == 0 && shoot_mode[id] == 1 && get_pdata_float(Weapon, 48, 4) <= 0.25)
  229.     {
  230.         set_weapon_anim(id, ANIM_IDLE_SHOOT)
  231.         set_pdata_float(Weapon, 48, 20.0, 4)
  232.         return HAM_SUPERCEDE;
  233.     }
  234.    
  235.     if(headshot_mode[id] == 1 && shoot_mode[id] == 1 && get_pdata_float(Weapon, 48, 4) <= 0.25)
  236.     {
  237.         set_weapon_anim(id, ANIM_IDLE_SHOOT2)
  238.         set_pdata_float(Weapon, 48, 20.0, 4)
  239.         return HAM_SUPERCEDE;
  240.     }
  241.    
  242.     if(g_guillotine_ammo[id] == 0 && get_pdata_float(Weapon, 48, 4) <= 0.25)
  243.     {
  244.         set_weapon_anim(id, ANIM_IDLE_EMPTY)
  245.         set_pdata_float(Weapon, 48, 20.0, 4)
  246.         return HAM_SUPERCEDE;
  247.     }
  248.  
  249.     return HAM_IGNORED;
  250. }
  251.  
  252. public fw_CmdStart(id, uc_handle, seed)
  253. {
  254.     if(!is_user_alive(id) || !is_user_connected(id))
  255.         return
  256.     if(get_user_weapon(id) != CSW_BDRIPPER || !g_had_guillotine[id])
  257.         return
  258.    
  259.     static ent; ent = fm_get_user_weapon_entity(id, CSW_BDRIPPER)
  260.     if(!pev_valid(ent))
  261.         return
  262.     if(get_pdata_float(ent, 46, OFFSET_LINUX_WEAPONS) > 0.0 || get_pdata_float(ent, 47, OFFSET_LINUX_WEAPONS) > 0.0)
  263.         return
  264.    
  265.     static CurButton
  266.     CurButton = get_uc(uc_handle, UC_Buttons)
  267.    
  268.     if(CurButton & IN_ATTACK)
  269.     {
  270.         CurButton &= ~IN_ATTACK
  271.         set_uc(uc_handle, UC_Buttons, CurButton)
  272.        
  273.         if(g_guillotine_ammo[id] == 0)
  274.             return
  275.         if(shoot_mode[id] == 0 && get_pdata_float(id, 83, 5) <= 0.0)
  276.         {
  277.             g_guillotine_ammo[id]--
  278.             update_ammo(id)
  279.             shoot_mode[id] = 1
  280.             FireKnife(id)
  281.             set_weapon_anim(id, ANIM_SHOOT)
  282.             emit_sound(id, CHAN_WEAPON, weapon_sound[5], 1.0, ATTN_NORM, 0, PITCH_NORM)
  283.             set_weapons_timeidle(id, CSW_BDRIPPER, 0.7)
  284.             set_player_nextattackx(id, 0.7)
  285.         }
  286.     }
  287. }
  288.  
  289. public FireKnife(id)
  290. {
  291.     static Float:StartOrigin[3], Float:velocity[3], Float:angles[3], Float:anglestrue[3], Float:jarak_max[3]
  292.     get_position(id, 2.0, 0.0, 0.0, StartOrigin)
  293.     get_position(id, 700.0, 0.0, 0.0, jarak_max)
  294.    
  295.     pev(id,pev_v_angle,angles)
  296.     static Ent; Ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
  297.     if(!pev_valid(Ent)) return
  298.     anglestrue[0] = 360.0 - angles[0]
  299.     anglestrue[1] = angles[1]
  300.     anglestrue[2] = angles[2]
  301.    
  302.     // Set info for ent
  303.     set_pev(Ent, pev_movetype, MOVETYPE_FLY)
  304.     set_pev(Ent, pev_owner, id)
  305.     set_pev(Ent, pev_iuser1, id)
  306.     set_pev(Ent, pev_fuser1, get_gametime() + 4.0)
  307.     set_pev(Ent, pev_nextthink, halflife_time() + 0.01)
  308.    
  309.     entity_set_string(Ent, EV_SZ_classname, BDRIP_CLASSNAME)
  310.     engfunc(EngFunc_SetModel, Ent, KNIFE_MODEL)
  311.     set_pev(Ent, pev_mins, Float:{-1.0, -1.0, -1.0})
  312.     set_pev(Ent, pev_maxs, Float:{1.0, 1.0, 1.0})
  313.     set_pev(Ent, pev_origin, StartOrigin)
  314.     set_pev(Ent, pev_angles, anglestrue)
  315.     set_pev(Ent, pev_gravity, 0.01)
  316.     set_pev(Ent, pev_solid, SOLID_BBOX)
  317.     set_pev(Ent, pev_frame, 1.0)
  318.     set_pev(Ent, pev_framerate, 30.0)
  319.     set_pev(Ent, pev_sequence, 0)
  320.    
  321.     velocity_by_aim( id, 1100, velocity )
  322.     set_pev( Ent, pev_velocity, velocity )
  323.     set_pev(Ent, pev_vuser1, velocity)
  324.     set_pev(Ent, pev_vuser2, jarak_max)
  325.     shoot_ent_mode[id] = 0
  326.     ent_sentuh[id] = 1
  327.     ent_sentuh_balik[id] = 0
  328. }
  329.  
  330. public fm_addtofullpack_post(es, e, user, host, host_flags, player, p_set)
  331. {
  332.     if(!player)
  333.         return FMRES_IGNORED
  334.        
  335.     if(!is_user_connected(host) || !is_user_alive(user))
  336.         return FMRES_IGNORED
  337.        
  338.     if(!ze_is_user_zombie(user) || headshot_korban[user] != 1)
  339.         return FMRES_IGNORED
  340.        
  341.     if(host == user)
  342.         return FMRES_IGNORED
  343.    
  344.     new Float:PlayerOrigin[3], Float:anglesss[3]
  345.     pev(user, pev_origin, PlayerOrigin)
  346.    
  347.     engfunc(EngFunc_GetBonePosition, user, 8, PlayerOrigin, anglesss)
  348.                        
  349.     engfunc(EngFunc_SetOrigin, guillotine_korban[user], PlayerOrigin)
  350.     engfunc(EngFunc_SetOrigin, guillotine_korban[user], PlayerOrigin)
  351.  
  352.     return FMRES_HANDLED
  353. }
  354.  
  355. public fw_Think(Ent)
  356. {
  357.     if(!pev_valid(Ent))
  358.         return
  359.    
  360.     static Float:pulang[3], Float:StartOriginz[3], pemilix, Float:brangkat[3], Float:jarak_max[3], Float:origin_asli[3], korban
  361.     pemilix = pev(Ent, pev_iuser1)
  362.     pev(Ent, pev_origin, StartOriginz)
  363.     korban = pev(Ent, pev_iuser2)
  364.    
  365.     if(headshot_korban[korban] == 1)
  366.     {
  367.         if(get_gametime() - 0.2 > pev(Ent, pev_fuser3))
  368.         {
  369.             Damage_guillotine(Ent, korban)
  370.             set_pev(Ent, pev_fuser3, get_gametime())
  371.         }
  372.     }
  373.    
  374.     if(ent_sentuh_balik[pemilix] == 0 && shoot_ent_mode[pemilix] == 1)
  375.     {
  376.         ent_sentuh_balik[pemilix] = 1
  377.         pev(pemilix, pev_origin, origin_asli)
  378.         origin_asli[2] += 7.5
  379.     }
  380.    
  381.     if(ent_sentuh[pemilix] == 1)
  382.     {
  383.         ent_sentuh[pemilix] = 0
  384.         pev(Ent, pev_vuser2, jarak_max)
  385.         pev(Ent, pev_vuser1, brangkat)
  386.         get_speed_vector(StartOriginz, origin_asli, 1100.0, pulang)
  387.                    
  388.         if(shoot_ent_mode[pemilix] == 1)
  389.         {
  390.             set_pev(Ent, pev_velocity, pulang)
  391.         }
  392.         else set_pev(Ent, pev_velocity, brangkat)
  393.     }
  394.    
  395.     if(shoot_ent_mode[pemilix] == 0 && get_distance_f(StartOriginz, jarak_max) <= 10.0)
  396.     {
  397.         shoot_ent_mode[pemilix] = 1
  398.         ent_sentuh[pemilix] = 1
  399.         set_pev(Ent, pev_owner, 0)
  400.     }
  401.    
  402.     if(shoot_ent_mode[pemilix] == 1 && get_distance_f(StartOriginz, origin_asli) <= 10.0)
  403.     {
  404.         if(is_user_alive(pemilix) && is_user_connected(pemilix) && get_user_weapon(pemilix) == CSW_BDRIPPER && g_had_guillotine[pemilix]) balik(Ent)
  405.         else ancur(Ent)
  406.     }
  407.     else if(headshot_korban[korban] == 1) set_pev(Ent, pev_nextthink, get_gametime() + 0.2)
  408.     else set_pev(Ent, pev_nextthink, halflife_time() + 0.01)
  409. }
  410.  
  411. public fw_touch(Ent, Id)
  412. {
  413.     // If ent is valid
  414.     if(!pev_valid(Ent))
  415.         return
  416.     if(pev(Ent, pev_movetype) == MOVETYPE_NONE)
  417.         return
  418.     static classnameptd[32]
  419.     pev(Id, pev_classname, classnameptd, 31)
  420.     if (equali(classnameptd, "func_breakable")) ExecuteHamB( Ham_TakeDamage, Id, 0, 0, 80.0, DMG_GENERIC )
  421.    
  422.     // Get it's origin
  423.     new Float:originF[3], pemilix
  424.     pemilix = pev(Ent, pev_iuser1)
  425.     pev(Ent, pev_origin, originF)
  426.     // Alive...
  427.    
  428.     if(is_user_alive(Id) && ze_is_user_zombie(Id))
  429.     {
  430.         Damage_guillotine(Ent, Id)
  431.         set_pev(Ent, pev_owner, Id)
  432.         ent_sentuh[pemilix] = 1
  433.         create_blood(originF)
  434.         create_blood(originF)
  435.     }
  436.    
  437.     else if(shoot_ent_mode[pemilix] == 1 && Id == pemilix)
  438.     {
  439.         if(is_user_alive(pemilix) && is_user_connected(pemilix) && get_user_weapon(pemilix) == CSW_BDRIPPER && g_had_guillotine[pemilix]) balik(Ent)
  440.         else ancur(Ent)
  441.     }
  442.    
  443.     else if(is_user_alive(Id) && !ze_is_user_zombie(Id))
  444.     {
  445.         set_pev(Ent, pev_owner, Id)
  446.         ent_sentuh[pemilix] = 1
  447.     }
  448.    
  449.     else
  450.     {
  451.         set_pev(Ent, pev_owner, 0)
  452.  
  453.         if(shoot_ent_mode[pemilix] == 0)
  454.         {
  455.             shoot_ent_mode[pemilix] = 1
  456.             engfunc(EngFunc_EmitSound, Ent, CHAN_WEAPON, hit_wall, 1.0, ATTN_STATIC, 0, PITCH_NORM)
  457.             ent_sentuh[pemilix] = 1
  458.         }
  459.         else ancur(Ent)
  460.     }
  461. }
  462.  
  463. public ancur(Ent)
  464. {
  465.     if(!pev_valid(Ent))
  466.         return
  467.     static Float:origin2[3], pemilix, Float:origin3[3]
  468.     pemilix = pev(Ent, pev_iuser1)
  469.     entity_get_vector(Ent, EV_VEC_origin, origin2)
  470.     pev(Ent, pev_origin, origin3)
  471.    
  472.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin2, 0)
  473.     write_byte(TE_BREAKMODEL)
  474.     engfunc(EngFunc_WriteCoord, origin2[0])
  475.     engfunc(EngFunc_WriteCoord, origin2[1])
  476.     engfunc(EngFunc_WriteCoord, origin2[2])
  477.     engfunc(EngFunc_WriteCoord, 25)
  478.     engfunc(EngFunc_WriteCoord, 25)
  479.     engfunc(EngFunc_WriteCoord, 25)
  480.     engfunc(EngFunc_WriteCoord, random_num(-25, 25))
  481.     engfunc(EngFunc_WriteCoord, random_num(-25, 25))
  482.     engfunc(EngFunc_WriteCoord, 5)
  483.     write_byte(5)
  484.     write_short(g_pecah)
  485.     write_byte(10)
  486.     write_byte(17)
  487.     write_byte(0x00)
  488.     message_end()
  489.    
  490.     fake_smokes(origin3)
  491.     engfunc(EngFunc_EmitSound, Ent, CHAN_WEAPON, hit_wall2, 1.0, ATTN_STATIC, 0, PITCH_NORM)
  492.     shoot_mode[pemilix] = 0
  493.     remove_entity(Ent)
  494.    
  495.     if(!is_user_alive(pemilix) || !is_user_connected(pemilix) || get_user_weapon(pemilix) != CSW_BDRIPPER || !g_had_guillotine[pemilix])
  496.         return
  497.    
  498.     set_weapon_anim(pemilix, ANIM_LOST)
  499.     set_weapons_timeidle(pemilix, CSW_BDRIPPER, 2.5)
  500.     set_player_nextattackx(pemilix, 2.5)
  501.     set_task(1.3, "reload2", pemilix)
  502.     set_task(1.4, "reload", pemilix)
  503. }
  504.  
  505. public reload(id)
  506. {
  507.     if(!is_user_alive(id) || !is_user_connected(id) || get_user_weapon(id) != CSW_BDRIPPER || !g_had_guillotine[id] || g_guillotine_ammo[id] == 0)
  508.         return
  509.    
  510.     set_weapon_anim(id, ANIM_DRAW)
  511. }
  512.  
  513. public reload2(id)
  514. {
  515.     if(!is_user_alive(id) || !is_user_connected(id) || get_user_weapon(id) != CSW_BDRIPPER || !g_had_guillotine[id] || g_guillotine_ammo[id] == 0)
  516.         return
  517.    
  518.     set_weapon_anim(id, ANIM_IDLE_SHOOT2)
  519. }
  520.  
  521. public balik(Ent)
  522. {
  523.     if(!pev_valid(Ent))
  524.         return
  525.     static id
  526.     id = pev(Ent, pev_iuser1)
  527.     set_weapon_anim(id, ANIM_CATCH)
  528.     emit_sound(id, CHAN_WEAPON, weapon_sound[0], 1.0, ATTN_NORM, 0, PITCH_NORM)
  529.     set_weapons_timeidle(id, CSW_BDRIPPER, 1.0)
  530.     set_player_nextattackx(id, 1.0)
  531.     shoot_mode[id] = 0
  532.     g_guillotine_ammo[id]++
  533.     update_ammo(id)
  534.    
  535.     remove_entity(Ent)
  536. }
  537.  
  538. public Damage_guillotine(Ent, Id)
  539. {
  540.     static Owner; Owner = pev(Ent, pev_iuser1)
  541.     static Attacker;
  542.     if(!is_user_alive(Owner))
  543.     {
  544.         Attacker = 0
  545.         return
  546.     } else Attacker = Owner
  547.  
  548.     new bool:bIsHeadShot; // never make that one static
  549.     new Float:flAdjustedDamage, bool:death
  550.        
  551.     switch( Get_MissileWeaponHitGroup(Ent) )
  552.     {
  553.         case HIT_GENERIC: flAdjustedDamage = DAMAGE * 1.0
  554.         case HIT_STOMACH: flAdjustedDamage = DAMAGE * 1.2
  555.         case HIT_LEFTLEG, HIT_RIGHTLEG: flAdjustedDamage = DAMAGE * 1.0
  556.         case HIT_LEFTARM, HIT_RIGHTARM: flAdjustedDamage = DAMAGE * 1.0
  557.         case HIT_HEAD, HIT_CHEST:
  558.         {
  559.             flAdjustedDamage = DAMAGE * 3.0
  560.             bIsHeadShot = true
  561.             if(headshot_mode[Owner] == 0) set_task(2.0, "balik_bro", Ent+1858941 )
  562.             headshot_mode[Owner] = 1
  563.             headshot_korban[Id] = 1
  564.             guillotine_korban[Id] = Ent
  565.             set_pev(Ent, pev_iuser2, Id)
  566.             set_pev(Ent, pev_sequence, 1)
  567.             set_pev(Ent, pev_solid, SOLID_NOT)
  568.             set_pev(Ent, pev_fuser3, 0.0)
  569.         }
  570.     }
  571.     if(pev(Id, pev_health) <= flAdjustedDamage) death = true
  572.    
  573.     if(is_user_alive(Id))
  574.     {
  575.         if( bIsHeadShot && death)
  576.         {
  577.             if(task_exists( Ent+1858941 )) remove_task( Ent + 1858941 )
  578.             set_pev(Ent, pev_sequence, 0)
  579.             headshot_korban[pev(Ent, pev_iuser2)] = 0
  580.             headshot_mode[Owner] = 0
  581.             shoot_ent_mode[Owner] = 1
  582.             ent_sentuh[Owner] = 1
  583.             ent_sentuh_balik[Owner] = 0
  584.             set_pev(Ent, pev_solid, SOLID_BBOX)
  585.             set_pev(Ent, pev_nextthink, halflife_time() + 0.01)
  586.    
  587.             kill(Attacker, Id, 1)
  588.            
  589.             death = false          
  590.         }
  591.         if(death)
  592.         {
  593.             kill(Attacker, Id, 0)
  594.            
  595.             death = false          
  596.         }
  597.         else ExecuteHamB(Ham_TakeDamage, Id, Ent, Attacker, flAdjustedDamage, DMG_BULLET)
  598.     }
  599. }
  600.  
  601. public balik_bro(Ent)
  602. {
  603.     Ent -= 1858941
  604.    
  605.     if(!pev_valid(Ent))
  606.         return
  607.    
  608.     static pemilix; pemilix = pev(Ent, pev_iuser1)
  609.     set_pev(Ent, pev_sequence, 0)
  610.     headshot_korban[pev(Ent, pev_iuser2)] = 0
  611.     headshot_mode[pemilix] = 0
  612.     shoot_ent_mode[pemilix] = 1
  613.     ent_sentuh[pemilix] = 1
  614.     ent_sentuh_balik[pemilix] = 0
  615.     set_pev(Ent, pev_solid, SOLID_BBOX)
  616.     set_pev(Ent, pev_nextthink, halflife_time() + 0.01)
  617. }
  618.  
  619. public fw_SetModel(entity, model[])
  620. {
  621.     if(!pev_valid(entity))
  622.         return FMRES_IGNORED
  623.    
  624.     static Classname[64]
  625.     pev(entity, pev_classname, Classname, sizeof(Classname))
  626.    
  627.     if(!equal(Classname, "weaponbox"))
  628.         return FMRES_IGNORED
  629.    
  630.     static id
  631.     id = pev(entity, pev_owner)
  632.    
  633.     if(equal(model, old_w_model))
  634.     {
  635.         static weapon
  636.         weapon = fm_get_user_weapon_entity(entity, CSW_BDRIPPER)
  637.        
  638.         if(!pev_valid(weapon))
  639.             return FMRES_IGNORED
  640.        
  641.         if(g_had_guillotine[id])
  642.         {
  643.             set_pev(weapon, pev_impulse, WEAPON_SECRETCODE)
  644.             set_pev(weapon, pev_iuser4, g_guillotine_ammo[id])
  645.             engfunc(EngFunc_SetModel, entity, w_model)
  646.            
  647.             g_had_guillotine[id] = 0
  648.             g_guillotine_ammo[id] = 0
  649.            
  650.             return FMRES_SUPERCEDE
  651.         }
  652.     }
  653.  
  654.     return FMRES_IGNORED;
  655. }
  656.  
  657. public fw_AddToPlayer_Post(ent, id)
  658. {
  659.     if(pev(ent, pev_impulse) == WEAPON_SECRETCODE)
  660.     {
  661.         g_had_guillotine[id] = 1
  662.         g_guillotine_ammo[id] = pev(ent, pev_iuser4)
  663.        
  664.         set_pev(ent, pev_impulse, 0)
  665.     }          
  666.    
  667.     message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("WeaponList"), _, id)
  668.     write_string((g_had_guillotine[id] == 1 ? "weapon_guillotine" : "weapon_mac10"))
  669.     write_byte(6)
  670.     write_byte(100)
  671.     write_byte(-1)
  672.     write_byte(-1)
  673.     write_byte(0)
  674.     write_byte(13)
  675.     write_byte(CSW_BDRIPPER)
  676.     write_byte(0)
  677.     message_end()
  678. }
  679.  
  680. public update_ammo(id)
  681. {
  682.     if(!is_user_alive(id))
  683.         return
  684.  
  685.     static weapon_ent; weapon_ent = fm_get_user_weapon_entity(id, CSW_BDRIPPER)
  686.     if(!pev_valid(weapon_ent)) return
  687.    
  688.     cs_set_weapon_ammo(weapon_ent, g_guillotine_ammo[id])  
  689.     cs_set_user_bpammo(id, CSW_BDRIPPER, g_guillotine_ammo[id])
  690.    
  691.     engfunc(EngFunc_MessageBegin, MSG_ONE_UNRELIABLE, get_user_msgid("CurWeapon"), {0, 0, 0}, id)
  692.     write_byte(1)
  693.     write_byte(CSW_BDRIPPER)
  694.     write_byte(-1)
  695.     message_end()
  696.    
  697.     message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("AmmoX"), _, id)
  698.     write_byte(1)
  699.     write_byte(g_guillotine_ammo[id])
  700.     message_end()
  701. }
  702.  
  703. public fw_traceline(Float:v1[3],Float:v2[3],noMonsters,id,ptr)
  704. {
  705.     if(!is_user_alive(id))
  706.         return HAM_IGNORED 
  707.     if(get_user_weapon(id) != CSW_BDRIPPER || !g_had_guillotine[id])
  708.         return HAM_IGNORED
  709.  
  710.     // get crosshair aim
  711.     static Float:aim[3];
  712.     get_aim(id,v1,aim);
  713.    
  714.     // do another trace to this spot
  715.     new trace = create_tr2();
  716.     engfunc(EngFunc_TraceLine,v1,aim,noMonsters,id,trace);
  717.    
  718.     // copy ints
  719.     set_tr2(ptr,TR_AllSolid,get_tr2(trace,TR_AllSolid));
  720.     set_tr2(ptr,TR_StartSolid,get_tr2(trace,TR_StartSolid));
  721.     set_tr2(ptr,TR_InOpen,get_tr2(trace,TR_InOpen));
  722.     set_tr2(ptr,TR_InWater,get_tr2(trace,TR_InWater));
  723.     set_tr2(ptr,TR_pHit,get_tr2(trace,TR_pHit));
  724.     set_tr2(ptr,TR_iHitgroup,get_tr2(trace,TR_iHitgroup));
  725.  
  726.     // copy floats
  727.     get_tr2(trace,TR_flFraction,aim[0]);
  728.     set_tr2(ptr,TR_flFraction,aim[0]);
  729.     get_tr2(trace,TR_flPlaneDist,aim[0]);
  730.     set_tr2(ptr,TR_flPlaneDist,aim[0]);
  731.    
  732.     // copy vecs
  733.     get_tr2(trace,TR_vecEndPos,aim);
  734.     set_tr2(ptr,TR_vecEndPos,aim);
  735.     get_tr2(trace,TR_vecPlaneNormal,aim);
  736.     set_tr2(ptr,TR_vecPlaneNormal,aim);
  737.  
  738.     // get rid of new trace
  739.     free_tr2(trace);
  740.  
  741.     return FMRES_IGNORED;
  742. }
  743.  
  744. get_aim(id,Float:source[3],Float:ret[3])
  745. {
  746.     static Float:vAngle[3], Float:pAngle[3], Float:dir[3], Float:temp[3];
  747.  
  748.     // get aiming direction from forward global based on view angle and punch angle
  749.     pev(id,pev_v_angle,vAngle);
  750.     pev(id,pev_punchangle,pAngle);
  751.     xs_vec_add(vAngle,pAngle,temp);
  752.     engfunc(EngFunc_MakeVectors,temp);
  753.     global_get(glb_v_forward,dir);
  754.    
  755.     /* vecEnd = vecSrc + vecDir * flDistance; */
  756.     xs_vec_mul_scalar(dir,8192.0,temp);
  757.     xs_vec_add(source,temp,ret);
  758. }
  759.  
  760. public fake_smokes(Float:Origin[3])
  761. {
  762.     static TE_FLAG
  763.    
  764.     TE_FLAG |= TE_EXPLFLAG_NODLIGHTS
  765.     TE_FLAG |= TE_EXPLFLAG_NOSOUND
  766.     TE_FLAG |= TE_EXPLFLAG_NOPARTICLES
  767.    
  768.     engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, Origin, 0)
  769.     write_byte(TE_EXPLOSION)
  770.     engfunc(EngFunc_WriteCoord, Origin[0])
  771.     engfunc(EngFunc_WriteCoord, Origin[1])
  772.     engfunc(EngFunc_WriteCoord, Origin[2])
  773.     write_short(g_smokepuff_id)
  774.     write_byte(6)
  775.     write_byte(25)
  776.     write_byte(TE_FLAG)
  777.     message_end()
  778. }
  779.  
  780. stock set_weapon_anim(id, anim)
  781. {
  782.     if(!is_user_alive(id))
  783.         return
  784.    
  785.     set_pev(id, pev_weaponanim, anim)
  786.    
  787.     message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, {0, 0, 0}, id)
  788.     write_byte(anim)
  789.     write_byte(pev(id, pev_body))
  790.     message_end()
  791. }
  792.  
  793. stock kill(k, v, headshot)
  794. {
  795.     cs_set_user_money(k, cs_get_user_money(k) + 500)
  796.    
  797.     set_user_frags(k, get_user_frags(k) + 1)
  798.    
  799.     set_msg_block(g_MsgDeathMsg,BLOCK_ONCE)
  800.     set_msg_block(gmsgScoreInfo,BLOCK_ONCE)
  801.     user_kill(v,1)
  802.    
  803.     new kteam = get_user_team(k);
  804.     new vteam = get_user_team(v);
  805.    
  806.     new kfrags = get_user_frags(k);
  807.     new kdeaths = get_user_deaths(k);
  808.    
  809.     new vfrags = get_user_frags(v);
  810.     new vdeaths = get_user_deaths(v);
  811.    
  812.     emessage_begin(MSG_ALL, gmsgScoreInfo);
  813.     ewrite_byte(k);
  814.     ewrite_short(kfrags);
  815.     ewrite_short(kdeaths);
  816.     ewrite_short(0);
  817.     ewrite_short(kteam);
  818.     emessage_end();
  819.    
  820.     emessage_begin(MSG_ALL, gmsgScoreInfo);
  821.     ewrite_byte(v);
  822.     ewrite_short(vfrags);
  823.     ewrite_short(vdeaths);
  824.     ewrite_short(0);
  825.     ewrite_short(vteam);
  826.     emessage_end();
  827.    
  828.     emessage_begin(MSG_BROADCAST, g_MsgDeathMsg)
  829.     ewrite_byte(k)
  830.     ewrite_byte(v)
  831.     ewrite_byte(headshot)
  832.     ewrite_string("Blood Dripper")
  833.     emessage_end()
  834. }
  835.  
  836.  
  837. stock create_blood(const Float:origin[3])
  838. {
  839.     // Show some blood :)
  840.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  841.     write_byte(TE_BLOODSPRITE)
  842.     engfunc(EngFunc_WriteCoord, origin[0])
  843.     engfunc(EngFunc_WriteCoord, origin[1])
  844.     engfunc(EngFunc_WriteCoord, origin[2])
  845.     write_short(m_iBlood[1])
  846.     write_short(m_iBlood[0])
  847.     write_byte(75)
  848.     write_byte(8)
  849.     message_end()
  850. }
  851.  
  852. stock drop_weapons(id, dropwhat)
  853. {
  854.     static weapons[32], num, i, weaponid
  855.     num = 0
  856.     get_user_weapons(id, weapons, num)
  857.      
  858.     for (i = 0; i < num; i++)
  859.     {
  860.         weaponid = weapons[i]
  861.          
  862.         if (dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM))
  863.         {
  864.             static wname[32]
  865.             get_weaponname(weaponid, wname, sizeof wname - 1)
  866.             engclient_cmd(id, "drop", wname)
  867.         }
  868.     }
  869. }
  870.  
  871. stock Get_MissileWeaponHitGroup( iEnt )
  872. {
  873.     new Float:flStart[ 3 ], Float:flEnd[ 3 ];
  874.    
  875.     pev( iEnt, pev_origin, flStart );
  876.     pev( iEnt, pev_velocity, flEnd );
  877.     xs_vec_add( flStart, flEnd, flEnd );
  878.    
  879.     new ptr = create_tr2();
  880.     engfunc( EngFunc_TraceLine, flStart, flEnd, 0, iEnt, ptr );
  881.    
  882.     new iHitGroup, Owner, nOhead, head
  883.     Owner = pev(iEnt, pev_iuser1)
  884.     nOhead = get_tr2( ptr, TR_iHitgroup )
  885.     head = set_tr2( ptr, TR_iHitgroup, HIT_HEAD )
  886.    
  887.     iHitGroup = headshot_mode[Owner] ? head : nOhead
  888.    
  889.     free_tr2( ptr );
  890.    
  891.     return iHitGroup;
  892. }
  893.  
  894. stock get_speed_vector(const Float:origin1[3],const Float:origin2[3],Float:speed, Float:new_velocity[3])
  895. {
  896.     new_velocity[0] = origin2[0] - origin1[0]
  897.     new_velocity[1] = origin2[1] - origin1[1]
  898.     new_velocity[2] = origin2[2] - origin1[2]
  899.     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]))
  900.     new_velocity[0] *= num
  901.     new_velocity[1] *= num
  902.     new_velocity[2] *= num
  903.    
  904.     return 1;
  905. }
  906.  
  907. stock get_position(id,Float:forw, Float:right, Float:up, Float:vStart[])
  908. {
  909.     static Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
  910.    
  911.     pev(id, pev_origin, vOrigin)
  912.     pev(id, pev_view_ofs, vUp) //for player
  913.     xs_vec_add(vOrigin, vUp, vOrigin)
  914.     pev(id, pev_v_angle, vAngle) // if normal entity ,use pev_angles
  915.    
  916.     angle_vector(vAngle, ANGLEVECTOR_FORWARD, vForward) //or use EngFunc_AngleVectors
  917.     angle_vector(vAngle, ANGLEVECTOR_RIGHT, vRight)
  918.     angle_vector(vAngle, ANGLEVECTOR_UP, vUp)
  919.    
  920.     vStart[0] = vOrigin[0] + vForward[0] * forw + vRight[0] * right + vUp[0] * up
  921.     vStart[1] = vOrigin[1] + vForward[1] * forw + vRight[1] * right + vUp[1] * up
  922.     vStart[2] = vOrigin[2] + vForward[2] * forw + vRight[2] * right + vUp[2] * up
  923. }
  924.  
  925. stock set_weapons_timeidle(id, WeaponId ,Float:TimeIdle)
  926. {
  927.     if(!is_user_alive(id))
  928.         return
  929.        
  930.     static entwpn; entwpn = fm_get_user_weapon_entity(id, WeaponId)
  931.     if(!pev_valid(entwpn))
  932.         return
  933.        
  934.     set_pdata_float(entwpn, 48, TimeIdle + 0.2, OFFSET_LINUX_WEAPONS)
  935. }
  936.  
  937. stock set_player_nextattackx(id, Float:nexttime)
  938. {
  939.     if(!is_user_alive(id))
  940.         return
  941.        
  942.     set_pdata_float(id, 83, nexttime, 5)
  943. }
  944.  

shady101852
Member
Member
United States of America
Posts: 27
Joined: 3 Months Ago
Has thanked: 9 times
Been thanked: 2 times
Contact:

#9

Post by shady101852 » 3 Months Ago

Mark wrote:
3 Months Ago
shady101852 wrote:
3 Months Ago
this item goes right through the zombies & does not seem to be doing any damage, is it supposed to be this way?
Fixed to make damage on zombie
  1. #include <zombie_escape>
  2. #include <engine>
  3. #include <fakemeta_util>
  4. #include <cstrike>
  5. #include <fun>
  6.  
  7. #define PLUGIN "Blood-Dripper"
  8. #define VERSION "1.0"
  9. #define AUTHOR "m4m3ts"
  10.  
  11. #define CSW_BDRIPPER CSW_MAC10
  12. #define weapon_guillotine "weapon_mac10"
  13. #define old_event "events/mac10.sc"
  14. #define old_w_model "models/w_mac10.mdl"
  15. #define WEAPON_SECRETCODE 1329419
  16.  
  17.  
  18. #define DEFAULT_AMMO 10
  19. #define DAMAGE 200
  20. #define BDRIP_CLASSNAME "Blood Dripper"
  21. #define WEAPON_ANIMEXT "knife"
  22.  
  23. #define Get_Ent_Data(%1,%2) get_pdata_int(%1,%2,4)
  24. #define Set_Ent_Data(%1,%2,%3) set_pdata_int(%1,%2,%3,4)
  25.  
  26. const PDATA_SAFE = 2
  27. const OFFSET_LINUX_WEAPONS = 4
  28. const OFFSET_WEAPONOWNER = 41
  29.  
  30. new const v_model[] = "models/zombie_escape/v_guillotine.mdl"
  31. new const p_model[] = "models/zombie_escape/p_guillotine.mdl"
  32. new const w_model[] = "models/zombie_escape/w_guillotine.mdl"
  33. new const KNIFE_MODEL[] = "models/zombie_escape/guillotine_projectile.mdl"
  34. new const PECAH_MODEL[] = "models/zombie_escape/gibs_guilotine.mdl"
  35. new const hit_wall[] = "weapons/janus9_stone1.wav"
  36. new const hit_wall2[] = "weapons/janus9_stone2.wav"
  37. new const weapon_sound[6][] =
  38. {
  39.     "weapons/guillotine_catch2.wav",
  40.     "weapons/guillotine_draw.wav",
  41.     "weapons/guillotine_draw_empty.wav",
  42.     "weapons/guillotine_explode.wav",
  43.     "weapons/guillotine_red.wav",
  44.     "weapons/guillotine-1.wav"
  45. }
  46.  
  47.  
  48. new const WeaponResource[3][] =
  49. {
  50.     "sprites/weapon_guillotine.txt",
  51.     "sprites/640hud120.spr",
  52.     "sprites/guillotine_lost.spr"
  53. }
  54.  
  55. enum
  56. {
  57.     ANIM_IDLE = 0,
  58.     ANIM_IDLE_EMPTY,
  59.     ANIM_SHOOT,
  60.     ANIM_DRAW,
  61.     ANIM_DRAW_EMPTY,
  62.     ANIM_IDLE_SHOOT,
  63.     ANIM_IDLE_SHOOT2,
  64.     ANIM_CATCH,
  65.     ANIM_LOST
  66. }
  67.  
  68. new g_MsgDeathMsg
  69.  
  70. new g_had_guillotine[33], g_guillotine_ammo[33], shoot_mode[33], shoot_ent_mode[33], g_pecah, headshot_mode[33], ent_sentuh[33], ent_sentuh_balik[33]
  71. new g_old_weapon[33], g_smokepuff_id, m_iBlood[2], guillotine_korban[33], headshot_korban[33], gmsgScoreInfo
  72. new g_iItemID
  73.  
  74. const PRIMARY_WEAPONS_BIT_SUM =
  75. (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<<
  76. 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)
  77.  
  78. public plugin_init()
  79. {
  80.     register_plugin(PLUGIN, VERSION, AUTHOR)
  81.     register_cvar("guillotine_version", "m4m3ts", FCVAR_SERVER|FCVAR_SPONLY)
  82.     register_forward(FM_CmdStart, "fw_CmdStart")
  83.     register_forward(FM_SetModel, "fw_SetModel")
  84.     register_think(BDRIP_CLASSNAME, "fw_Think")
  85.     register_touch(BDRIP_CLASSNAME, "*", "fw_touch")
  86.     register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1)
  87.     register_forward(FM_TraceLine, "fw_traceline", 1)
  88.     register_forward(FM_AddToFullPack, "fm_addtofullpack_post", 1)
  89.     RegisterHam(Ham_Weapon_WeaponIdle, weapon_guillotine, "fw_guillotineidleanim", 1)
  90.     RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
  91.     RegisterHam(Ham_Item_AddToPlayer, weapon_guillotine, "fw_AddToPlayer_Post", 1)
  92.     register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")
  93.    
  94.     g_iItemID = ze_register_item("Blood Dripper", 20, 0)
  95.    
  96.     register_clcmd("weapon_guillotine", "hook_weapon")
  97.    
  98.     g_MsgDeathMsg = get_user_msgid("DeathMsg")
  99.     gmsgScoreInfo = get_user_msgid("ScoreInfo")
  100. }
  101.  
  102.  
  103. public plugin_precache()
  104. {
  105.     precache_model(v_model)
  106.     precache_model(p_model)
  107.     precache_model(w_model)
  108.     precache_model(KNIFE_MODEL)
  109.     g_pecah = precache_model(PECAH_MODEL)
  110.     precache_sound(hit_wall)
  111.     precache_sound(hit_wall2)
  112.    
  113.     for(new i = 0; i < sizeof(weapon_sound); i++)
  114.         precache_sound(weapon_sound[i])
  115.    
  116.     for(new i = 1; i < sizeof(WeaponResource); i++)
  117.         precache_model(WeaponResource[i])
  118.    
  119.     g_smokepuff_id = engfunc(EngFunc_PrecacheModel, WeaponResource[2])
  120.     m_iBlood[0] = precache_model("sprites/blood.spr")
  121.     m_iBlood[1] = precache_model("sprites/bloodspray.spr") 
  122. }
  123.  
  124. public ze_user_infected(id)
  125. {
  126.     remove_guillotine(id)
  127. }
  128.  
  129. public fw_PlayerKilled(id)
  130. {
  131.     remove_guillotine(id)
  132. }
  133.  
  134. public hook_weapon(id)
  135. {
  136.     engclient_cmd(id, weapon_guillotine)
  137.     return
  138. }
  139.  
  140. public ze_select_item_pre(id, itemid)
  141. {
  142.     // This not our item?
  143.     if (itemid != g_iItemID)
  144.         return ZE_ITEM_AVAILABLE
  145.    
  146.     // Available for Humans only, So don't show it for zombies
  147.     if (ze_is_user_zombie(id))
  148.         return ZE_ITEM_DONT_SHOW
  149.    
  150.     // Finally return that it's available
  151.     return ZE_ITEM_AVAILABLE
  152. }
  153.  
  154. public ze_select_item_post(id, itemid)
  155. {
  156.     // This is not our item, Block it here and don't execute the blew code
  157.     if (itemid != g_iItemID)
  158.         return
  159.    
  160.     get_guillotine(id)
  161. }
  162.  
  163. public get_guillotine(id)
  164. {
  165.     if(!is_user_alive(id))
  166.         return
  167.     drop_weapons(id, 1)
  168.     g_had_guillotine[id] = 1
  169.     g_guillotine_ammo[id] = DEFAULT_AMMO
  170.    
  171.     give_item(id, weapon_guillotine)
  172.     update_ammo(id)
  173.    
  174.     static weapon_ent; weapon_ent = fm_find_ent_by_owner(-1, weapon_guillotine, id)
  175.     if(pev_valid(weapon_ent)) cs_set_weapon_ammo(weapon_ent, 1)
  176. }
  177.  
  178. public remove_guillotine(id)
  179. {
  180.     g_had_guillotine[id] = 0
  181. }
  182.  
  183. public refill_guillotine(id)
  184. {  
  185.     if(g_had_guillotine[id]) g_guillotine_ammo[id] = 15
  186.    
  187.     if(get_user_weapon(id) == CSW_BDRIPPER && g_had_guillotine[id]) update_ammo(id)
  188. }
  189.    
  190. public fw_UpdateClientData_Post(id, sendweapons, cd_handle)
  191. {
  192.     if(!is_user_alive(id) || !is_user_connected(id))
  193.         return FMRES_IGNORED   
  194.     if(get_user_weapon(id) == CSW_BDRIPPER && g_had_guillotine[id])
  195.         set_cd(cd_handle, CD_flNextAttack, get_gametime() + 0.001)
  196.    
  197.     return FMRES_HANDLED
  198. }
  199.  
  200. public Event_CurWeapon(id)
  201. {
  202.     if(!is_user_alive(id))
  203.         return
  204.        
  205.     if(get_user_weapon(id) == CSW_BDRIPPER && g_had_guillotine[id])
  206.     {
  207.         set_pev(id, pev_viewmodel2, v_model)
  208.         set_pev(id, pev_weaponmodel2, p_model)
  209.         set_pdata_string(id, 492 * 4, WEAPON_ANIMEXT, -1 , 20)
  210.         if(g_old_weapon[id] != CSW_BDRIPPER && g_guillotine_ammo[id] >= 1) set_weapon_anim(id, ANIM_DRAW)
  211.         if(g_old_weapon[id] != CSW_BDRIPPER && g_guillotine_ammo[id] == 0) set_weapon_anim(id, ANIM_DRAW_EMPTY)
  212.         update_ammo(id)
  213.     }
  214.    
  215.     g_old_weapon[id] = get_user_weapon(id)
  216. }
  217.  
  218. public fw_guillotineidleanim(Weapon)
  219. {
  220.     new id = get_pdata_cbase(Weapon, 41, 4)
  221.  
  222.     if(!is_user_alive(id) || ze_is_user_zombie(id) || !g_had_guillotine[id] || get_user_weapon(id) != CSW_BDRIPPER)
  223.         return HAM_IGNORED;
  224.    
  225.     if(shoot_mode[id] == 0 && g_guillotine_ammo[id] >= 1)
  226.         return HAM_SUPERCEDE;
  227.    
  228.     if(headshot_mode[id] == 0 && shoot_mode[id] == 1 && get_pdata_float(Weapon, 48, 4) <= 0.25)
  229.     {
  230.         set_weapon_anim(id, ANIM_IDLE_SHOOT)
  231.         set_pdata_float(Weapon, 48, 20.0, 4)
  232.         return HAM_SUPERCEDE;
  233.     }
  234.    
  235.     if(headshot_mode[id] == 1 && shoot_mode[id] == 1 && get_pdata_float(Weapon, 48, 4) <= 0.25)
  236.     {
  237.         set_weapon_anim(id, ANIM_IDLE_SHOOT2)
  238.         set_pdata_float(Weapon, 48, 20.0, 4)
  239.         return HAM_SUPERCEDE;
  240.     }
  241.    
  242.     if(g_guillotine_ammo[id] == 0 && get_pdata_float(Weapon, 48, 4) <= 0.25)
  243.     {
  244.         set_weapon_anim(id, ANIM_IDLE_EMPTY)
  245.         set_pdata_float(Weapon, 48, 20.0, 4)
  246.         return HAM_SUPERCEDE;
  247.     }
  248.  
  249.     return HAM_IGNORED;
  250. }
  251.  
  252. public fw_CmdStart(id, uc_handle, seed)
  253. {
  254.     if(!is_user_alive(id) || !is_user_connected(id))
  255.         return
  256.     if(get_user_weapon(id) != CSW_BDRIPPER || !g_had_guillotine[id])
  257.         return
  258.    
  259.     static ent; ent = fm_get_user_weapon_entity(id, CSW_BDRIPPER)
  260.     if(!pev_valid(ent))
  261.         return
  262.     if(get_pdata_float(ent, 46, OFFSET_LINUX_WEAPONS) > 0.0 || get_pdata_float(ent, 47, OFFSET_LINUX_WEAPONS) > 0.0)
  263.         return
  264.    
  265.     static CurButton
  266.     CurButton = get_uc(uc_handle, UC_Buttons)
  267.    
  268.     if(CurButton & IN_ATTACK)
  269.     {
  270.         CurButton &= ~IN_ATTACK
  271.         set_uc(uc_handle, UC_Buttons, CurButton)
  272.        
  273.         if(g_guillotine_ammo[id] == 0)
  274.             return
  275.         if(shoot_mode[id] == 0 && get_pdata_float(id, 83, 5) <= 0.0)
  276.         {
  277.             g_guillotine_ammo[id]--
  278.             update_ammo(id)
  279.             shoot_mode[id] = 1
  280.             FireKnife(id)
  281.             set_weapon_anim(id, ANIM_SHOOT)
  282.             emit_sound(id, CHAN_WEAPON, weapon_sound[5], 1.0, ATTN_NORM, 0, PITCH_NORM)
  283.             set_weapons_timeidle(id, CSW_BDRIPPER, 0.7)
  284.             set_player_nextattackx(id, 0.7)
  285.         }
  286.     }
  287. }
  288.  
  289. public FireKnife(id)
  290. {
  291.     static Float:StartOrigin[3], Float:velocity[3], Float:angles[3], Float:anglestrue[3], Float:jarak_max[3]
  292.     get_position(id, 2.0, 0.0, 0.0, StartOrigin)
  293.     get_position(id, 700.0, 0.0, 0.0, jarak_max)
  294.    
  295.     pev(id,pev_v_angle,angles)
  296.     static Ent; Ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
  297.     if(!pev_valid(Ent)) return
  298.     anglestrue[0] = 360.0 - angles[0]
  299.     anglestrue[1] = angles[1]
  300.     anglestrue[2] = angles[2]
  301.    
  302.     // Set info for ent
  303.     set_pev(Ent, pev_movetype, MOVETYPE_FLY)
  304.     set_pev(Ent, pev_owner, id)
  305.     set_pev(Ent, pev_iuser1, id)
  306.     set_pev(Ent, pev_fuser1, get_gametime() + 4.0)
  307.     set_pev(Ent, pev_nextthink, halflife_time() + 0.01)
  308.    
  309.     entity_set_string(Ent, EV_SZ_classname, BDRIP_CLASSNAME)
  310.     engfunc(EngFunc_SetModel, Ent, KNIFE_MODEL)
  311.     set_pev(Ent, pev_mins, Float:{-1.0, -1.0, -1.0})
  312.     set_pev(Ent, pev_maxs, Float:{1.0, 1.0, 1.0})
  313.     set_pev(Ent, pev_origin, StartOrigin)
  314.     set_pev(Ent, pev_angles, anglestrue)
  315.     set_pev(Ent, pev_gravity, 0.01)
  316.     set_pev(Ent, pev_solid, SOLID_BBOX)
  317.     set_pev(Ent, pev_frame, 1.0)
  318.     set_pev(Ent, pev_framerate, 30.0)
  319.     set_pev(Ent, pev_sequence, 0)
  320.    
  321.     velocity_by_aim( id, 1100, velocity )
  322.     set_pev( Ent, pev_velocity, velocity )
  323.     set_pev(Ent, pev_vuser1, velocity)
  324.     set_pev(Ent, pev_vuser2, jarak_max)
  325.     shoot_ent_mode[id] = 0
  326.     ent_sentuh[id] = 1
  327.     ent_sentuh_balik[id] = 0
  328. }
  329.  
  330. public fm_addtofullpack_post(es, e, user, host, host_flags, player, p_set)
  331. {
  332.     if(!player)
  333.         return FMRES_IGNORED
  334.        
  335.     if(!is_user_connected(host) || !is_user_alive(user))
  336.         return FMRES_IGNORED
  337.        
  338.     if(!ze_is_user_zombie(user) || headshot_korban[user] != 1)
  339.         return FMRES_IGNORED
  340.        
  341.     if(host == user)
  342.         return FMRES_IGNORED
  343.    
  344.     new Float:PlayerOrigin[3], Float:anglesss[3]
  345.     pev(user, pev_origin, PlayerOrigin)
  346.    
  347.     engfunc(EngFunc_GetBonePosition, user, 8, PlayerOrigin, anglesss)
  348.                        
  349.     engfunc(EngFunc_SetOrigin, guillotine_korban[user], PlayerOrigin)
  350.     engfunc(EngFunc_SetOrigin, guillotine_korban[user], PlayerOrigin)
  351.  
  352.     return FMRES_HANDLED
  353. }
  354.  
  355. public fw_Think(Ent)
  356. {
  357.     if(!pev_valid(Ent))
  358.         return
  359.    
  360.     static Float:pulang[3], Float:StartOriginz[3], pemilix, Float:brangkat[3], Float:jarak_max[3], Float:origin_asli[3], korban
  361.     pemilix = pev(Ent, pev_iuser1)
  362.     pev(Ent, pev_origin, StartOriginz)
  363.     korban = pev(Ent, pev_iuser2)
  364.    
  365.     if(headshot_korban[korban] == 1)
  366.     {
  367.         if(get_gametime() - 0.2 > pev(Ent, pev_fuser3))
  368.         {
  369.             Damage_guillotine(Ent, korban)
  370.             set_pev(Ent, pev_fuser3, get_gametime())
  371.         }
  372.     }
  373.    
  374.     if(ent_sentuh_balik[pemilix] == 0 && shoot_ent_mode[pemilix] == 1)
  375.     {
  376.         ent_sentuh_balik[pemilix] = 1
  377.         pev(pemilix, pev_origin, origin_asli)
  378.         origin_asli[2] += 7.5
  379.     }
  380.    
  381.     if(ent_sentuh[pemilix] == 1)
  382.     {
  383.         ent_sentuh[pemilix] = 0
  384.         pev(Ent, pev_vuser2, jarak_max)
  385.         pev(Ent, pev_vuser1, brangkat)
  386.         get_speed_vector(StartOriginz, origin_asli, 1100.0, pulang)
  387.                    
  388.         if(shoot_ent_mode[pemilix] == 1)
  389.         {
  390.             set_pev(Ent, pev_velocity, pulang)
  391.         }
  392.         else set_pev(Ent, pev_velocity, brangkat)
  393.     }
  394.    
  395.     if(shoot_ent_mode[pemilix] == 0 && get_distance_f(StartOriginz, jarak_max) <= 10.0)
  396.     {
  397.         shoot_ent_mode[pemilix] = 1
  398.         ent_sentuh[pemilix] = 1
  399.         set_pev(Ent, pev_owner, 0)
  400.     }
  401.    
  402.     if(shoot_ent_mode[pemilix] == 1 && get_distance_f(StartOriginz, origin_asli) <= 10.0)
  403.     {
  404.         if(is_user_alive(pemilix) && is_user_connected(pemilix) && get_user_weapon(pemilix) == CSW_BDRIPPER && g_had_guillotine[pemilix]) balik(Ent)
  405.         else ancur(Ent)
  406.     }
  407.     else if(headshot_korban[korban] == 1) set_pev(Ent, pev_nextthink, get_gametime() + 0.2)
  408.     else set_pev(Ent, pev_nextthink, halflife_time() + 0.01)
  409. }
  410.  
  411. public fw_touch(Ent, Id)
  412. {
  413.     // If ent is valid
  414.     if(!pev_valid(Ent))
  415.         return
  416.     if(pev(Ent, pev_movetype) == MOVETYPE_NONE)
  417.         return
  418.     static classnameptd[32]
  419.     pev(Id, pev_classname, classnameptd, 31)
  420.     if (equali(classnameptd, "func_breakable")) ExecuteHamB( Ham_TakeDamage, Id, 0, 0, 80.0, DMG_GENERIC )
  421.    
  422.     // Get it's origin
  423.     new Float:originF[3], pemilix
  424.     pemilix = pev(Ent, pev_iuser1)
  425.     pev(Ent, pev_origin, originF)
  426.     // Alive...
  427.    
  428.     if(is_user_alive(Id) && ze_is_user_zombie(Id))
  429.     {
  430.         Damage_guillotine(Ent, Id)
  431.         set_pev(Ent, pev_owner, Id)
  432.         ent_sentuh[pemilix] = 1
  433.         create_blood(originF)
  434.         create_blood(originF)
  435.     }
  436.    
  437.     else if(shoot_ent_mode[pemilix] == 1 && Id == pemilix)
  438.     {
  439.         if(is_user_alive(pemilix) && is_user_connected(pemilix) && get_user_weapon(pemilix) == CSW_BDRIPPER && g_had_guillotine[pemilix]) balik(Ent)
  440.         else ancur(Ent)
  441.     }
  442.    
  443.     else if(is_user_alive(Id) && !ze_is_user_zombie(Id))
  444.     {
  445.         set_pev(Ent, pev_owner, Id)
  446.         ent_sentuh[pemilix] = 1
  447.     }
  448.    
  449.     else
  450.     {
  451.         set_pev(Ent, pev_owner, 0)
  452.  
  453.         if(shoot_ent_mode[pemilix] == 0)
  454.         {
  455.             shoot_ent_mode[pemilix] = 1
  456.             engfunc(EngFunc_EmitSound, Ent, CHAN_WEAPON, hit_wall, 1.0, ATTN_STATIC, 0, PITCH_NORM)
  457.             ent_sentuh[pemilix] = 1
  458.         }
  459.         else ancur(Ent)
  460.     }
  461. }
  462.  
  463. public ancur(Ent)
  464. {
  465.     if(!pev_valid(Ent))
  466.         return
  467.     static Float:origin2[3], pemilix, Float:origin3[3]
  468.     pemilix = pev(Ent, pev_iuser1)
  469.     entity_get_vector(Ent, EV_VEC_origin, origin2)
  470.     pev(Ent, pev_origin, origin3)
  471.    
  472.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin2, 0)
  473.     write_byte(TE_BREAKMODEL)
  474.     engfunc(EngFunc_WriteCoord, origin2[0])
  475.     engfunc(EngFunc_WriteCoord, origin2[1])
  476.     engfunc(EngFunc_WriteCoord, origin2[2])
  477.     engfunc(EngFunc_WriteCoord, 25)
  478.     engfunc(EngFunc_WriteCoord, 25)
  479.     engfunc(EngFunc_WriteCoord, 25)
  480.     engfunc(EngFunc_WriteCoord, random_num(-25, 25))
  481.     engfunc(EngFunc_WriteCoord, random_num(-25, 25))
  482.     engfunc(EngFunc_WriteCoord, 5)
  483.     write_byte(5)
  484.     write_short(g_pecah)
  485.     write_byte(10)
  486.     write_byte(17)
  487.     write_byte(0x00)
  488.     message_end()
  489.    
  490.     fake_smokes(origin3)
  491.     engfunc(EngFunc_EmitSound, Ent, CHAN_WEAPON, hit_wall2, 1.0, ATTN_STATIC, 0, PITCH_NORM)
  492.     shoot_mode[pemilix] = 0
  493.     remove_entity(Ent)
  494.    
  495.     if(!is_user_alive(pemilix) || !is_user_connected(pemilix) || get_user_weapon(pemilix) != CSW_BDRIPPER || !g_had_guillotine[pemilix])
  496.         return
  497.    
  498.     set_weapon_anim(pemilix, ANIM_LOST)
  499.     set_weapons_timeidle(pemilix, CSW_BDRIPPER, 2.5)
  500.     set_player_nextattackx(pemilix, 2.5)
  501.     set_task(1.3, "reload2", pemilix)
  502.     set_task(1.4, "reload", pemilix)
  503. }
  504.  
  505. public reload(id)
  506. {
  507.     if(!is_user_alive(id) || !is_user_connected(id) || get_user_weapon(id) != CSW_BDRIPPER || !g_had_guillotine[id] || g_guillotine_ammo[id] == 0)
  508.         return
  509.    
  510.     set_weapon_anim(id, ANIM_DRAW)
  511. }
  512.  
  513. public reload2(id)
  514. {
  515.     if(!is_user_alive(id) || !is_user_connected(id) || get_user_weapon(id) != CSW_BDRIPPER || !g_had_guillotine[id] || g_guillotine_ammo[id] == 0)
  516.         return
  517.    
  518.     set_weapon_anim(id, ANIM_IDLE_SHOOT2)
  519. }
  520.  
  521. public balik(Ent)
  522. {
  523.     if(!pev_valid(Ent))
  524.         return
  525.     static id
  526.     id = pev(Ent, pev_iuser1)
  527.     set_weapon_anim(id, ANIM_CATCH)
  528.     emit_sound(id, CHAN_WEAPON, weapon_sound[0], 1.0, ATTN_NORM, 0, PITCH_NORM)
  529.     set_weapons_timeidle(id, CSW_BDRIPPER, 1.0)
  530.     set_player_nextattackx(id, 1.0)
  531.     shoot_mode[id] = 0
  532.     g_guillotine_ammo[id]++
  533.     update_ammo(id)
  534.    
  535.     remove_entity(Ent)
  536. }
  537.  
  538. public Damage_guillotine(Ent, Id)
  539. {
  540.     static Owner; Owner = pev(Ent, pev_iuser1)
  541.     static Attacker;
  542.     if(!is_user_alive(Owner))
  543.     {
  544.         Attacker = 0
  545.         return
  546.     } else Attacker = Owner
  547.  
  548.     new bool:bIsHeadShot; // never make that one static
  549.     new Float:flAdjustedDamage, bool:death
  550.        
  551.     switch( Get_MissileWeaponHitGroup(Ent) )
  552.     {
  553.         case HIT_GENERIC: flAdjustedDamage = DAMAGE * 1.0
  554.         case HIT_STOMACH: flAdjustedDamage = DAMAGE * 1.2
  555.         case HIT_LEFTLEG, HIT_RIGHTLEG: flAdjustedDamage = DAMAGE * 1.0
  556.         case HIT_LEFTARM, HIT_RIGHTARM: flAdjustedDamage = DAMAGE * 1.0
  557.         case HIT_HEAD, HIT_CHEST:
  558.         {
  559.             flAdjustedDamage = DAMAGE * 3.0
  560.             bIsHeadShot = true
  561.             if(headshot_mode[Owner] == 0) set_task(2.0, "balik_bro", Ent+1858941 )
  562.             headshot_mode[Owner] = 1
  563.             headshot_korban[Id] = 1
  564.             guillotine_korban[Id] = Ent
  565.             set_pev(Ent, pev_iuser2, Id)
  566.             set_pev(Ent, pev_sequence, 1)
  567.             set_pev(Ent, pev_solid, SOLID_NOT)
  568.             set_pev(Ent, pev_fuser3, 0.0)
  569.         }
  570.     }
  571.     if(pev(Id, pev_health) <= flAdjustedDamage) death = true
  572.    
  573.     if(is_user_alive(Id))
  574.     {
  575.         if( bIsHeadShot && death)
  576.         {
  577.             if(task_exists( Ent+1858941 )) remove_task( Ent + 1858941 )
  578.             set_pev(Ent, pev_sequence, 0)
  579.             headshot_korban[pev(Ent, pev_iuser2)] = 0
  580.             headshot_mode[Owner] = 0
  581.             shoot_ent_mode[Owner] = 1
  582.             ent_sentuh[Owner] = 1
  583.             ent_sentuh_balik[Owner] = 0
  584.             set_pev(Ent, pev_solid, SOLID_BBOX)
  585.             set_pev(Ent, pev_nextthink, halflife_time() + 0.01)
  586.    
  587.             kill(Attacker, Id, 1)
  588.            
  589.             death = false          
  590.         }
  591.         if(death)
  592.         {
  593.             kill(Attacker, Id, 0)
  594.            
  595.             death = false          
  596.         }
  597.         else ExecuteHamB(Ham_TakeDamage, Id, Ent, Attacker, flAdjustedDamage, DMG_BULLET)
  598.     }
  599. }
  600.  
  601. public balik_bro(Ent)
  602. {
  603.     Ent -= 1858941
  604.    
  605.     if(!pev_valid(Ent))
  606.         return
  607.    
  608.     static pemilix; pemilix = pev(Ent, pev_iuser1)
  609.     set_pev(Ent, pev_sequence, 0)
  610.     headshot_korban[pev(Ent, pev_iuser2)] = 0
  611.     headshot_mode[pemilix] = 0
  612.     shoot_ent_mode[pemilix] = 1
  613.     ent_sentuh[pemilix] = 1
  614.     ent_sentuh_balik[pemilix] = 0
  615.     set_pev(Ent, pev_solid, SOLID_BBOX)
  616.     set_pev(Ent, pev_nextthink, halflife_time() + 0.01)
  617. }
  618.  
  619. public fw_SetModel(entity, model[])
  620. {
  621.     if(!pev_valid(entity))
  622.         return FMRES_IGNORED
  623.    
  624.     static Classname[64]
  625.     pev(entity, pev_classname, Classname, sizeof(Classname))
  626.    
  627.     if(!equal(Classname, "weaponbox"))
  628.         return FMRES_IGNORED
  629.    
  630.     static id
  631.     id = pev(entity, pev_owner)
  632.    
  633.     if(equal(model, old_w_model))
  634.     {
  635.         static weapon
  636.         weapon = fm_get_user_weapon_entity(entity, CSW_BDRIPPER)
  637.        
  638.         if(!pev_valid(weapon))
  639.             return FMRES_IGNORED
  640.        
  641.         if(g_had_guillotine[id])
  642.         {
  643.             set_pev(weapon, pev_impulse, WEAPON_SECRETCODE)
  644.             set_pev(weapon, pev_iuser4, g_guillotine_ammo[id])
  645.             engfunc(EngFunc_SetModel, entity, w_model)
  646.            
  647.             g_had_guillotine[id] = 0
  648.             g_guillotine_ammo[id] = 0
  649.            
  650.             return FMRES_SUPERCEDE
  651.         }
  652.     }
  653.  
  654.     return FMRES_IGNORED;
  655. }
  656.  
  657. public fw_AddToPlayer_Post(ent, id)
  658. {
  659.     if(pev(ent, pev_impulse) == WEAPON_SECRETCODE)
  660.     {
  661.         g_had_guillotine[id] = 1
  662.         g_guillotine_ammo[id] = pev(ent, pev_iuser4)
  663.        
  664.         set_pev(ent, pev_impulse, 0)
  665.     }          
  666.    
  667.     message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("WeaponList"), _, id)
  668.     write_string((g_had_guillotine[id] == 1 ? "weapon_guillotine" : "weapon_mac10"))
  669.     write_byte(6)
  670.     write_byte(100)
  671.     write_byte(-1)
  672.     write_byte(-1)
  673.     write_byte(0)
  674.     write_byte(13)
  675.     write_byte(CSW_BDRIPPER)
  676.     write_byte(0)
  677.     message_end()
  678. }
  679.  
  680. public update_ammo(id)
  681. {
  682.     if(!is_user_alive(id))
  683.         return
  684.  
  685.     static weapon_ent; weapon_ent = fm_get_user_weapon_entity(id, CSW_BDRIPPER)
  686.     if(!pev_valid(weapon_ent)) return
  687.    
  688.     cs_set_weapon_ammo(weapon_ent, g_guillotine_ammo[id])  
  689.     cs_set_user_bpammo(id, CSW_BDRIPPER, g_guillotine_ammo[id])
  690.    
  691.     engfunc(EngFunc_MessageBegin, MSG_ONE_UNRELIABLE, get_user_msgid("CurWeapon"), {0, 0, 0}, id)
  692.     write_byte(1)
  693.     write_byte(CSW_BDRIPPER)
  694.     write_byte(-1)
  695.     message_end()
  696.    
  697.     message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("AmmoX"), _, id)
  698.     write_byte(1)
  699.     write_byte(g_guillotine_ammo[id])
  700.     message_end()
  701. }
  702.  
  703. public fw_traceline(Float:v1[3],Float:v2[3],noMonsters,id,ptr)
  704. {
  705.     if(!is_user_alive(id))
  706.         return HAM_IGNORED 
  707.     if(get_user_weapon(id) != CSW_BDRIPPER || !g_had_guillotine[id])
  708.         return HAM_IGNORED
  709.  
  710.     // get crosshair aim
  711.     static Float:aim[3];
  712.     get_aim(id,v1,aim);
  713.    
  714.     // do another trace to this spot
  715.     new trace = create_tr2();
  716.     engfunc(EngFunc_TraceLine,v1,aim,noMonsters,id,trace);
  717.    
  718.     // copy ints
  719.     set_tr2(ptr,TR_AllSolid,get_tr2(trace,TR_AllSolid));
  720.     set_tr2(ptr,TR_StartSolid,get_tr2(trace,TR_StartSolid));
  721.     set_tr2(ptr,TR_InOpen,get_tr2(trace,TR_InOpen));
  722.     set_tr2(ptr,TR_InWater,get_tr2(trace,TR_InWater));
  723.     set_tr2(ptr,TR_pHit,get_tr2(trace,TR_pHit));
  724.     set_tr2(ptr,TR_iHitgroup,get_tr2(trace,TR_iHitgroup));
  725.  
  726.     // copy floats
  727.     get_tr2(trace,TR_flFraction,aim[0]);
  728.     set_tr2(ptr,TR_flFraction,aim[0]);
  729.     get_tr2(trace,TR_flPlaneDist,aim[0]);
  730.     set_tr2(ptr,TR_flPlaneDist,aim[0]);
  731.    
  732.     // copy vecs
  733.     get_tr2(trace,TR_vecEndPos,aim);
  734.     set_tr2(ptr,TR_vecEndPos,aim);
  735.     get_tr2(trace,TR_vecPlaneNormal,aim);
  736.     set_tr2(ptr,TR_vecPlaneNormal,aim);
  737.  
  738.     // get rid of new trace
  739.     free_tr2(trace);
  740.  
  741.     return FMRES_IGNORED;
  742. }
  743.  
  744. get_aim(id,Float:source[3],Float:ret[3])
  745. {
  746.     static Float:vAngle[3], Float:pAngle[3], Float:dir[3], Float:temp[3];
  747.  
  748.     // get aiming direction from forward global based on view angle and punch angle
  749.     pev(id,pev_v_angle,vAngle);
  750.     pev(id,pev_punchangle,pAngle);
  751.     xs_vec_add(vAngle,pAngle,temp);
  752.     engfunc(EngFunc_MakeVectors,temp);
  753.     global_get(glb_v_forward,dir);
  754.    
  755.     /* vecEnd = vecSrc + vecDir * flDistance; */
  756.     xs_vec_mul_scalar(dir,8192.0,temp);
  757.     xs_vec_add(source,temp,ret);
  758. }
  759.  
  760. public fake_smokes(Float:Origin[3])
  761. {
  762.     static TE_FLAG
  763.    
  764.     TE_FLAG |= TE_EXPLFLAG_NODLIGHTS
  765.     TE_FLAG |= TE_EXPLFLAG_NOSOUND
  766.     TE_FLAG |= TE_EXPLFLAG_NOPARTICLES
  767.    
  768.     engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, Origin, 0)
  769.     write_byte(TE_EXPLOSION)
  770.     engfunc(EngFunc_WriteCoord, Origin[0])
  771.     engfunc(EngFunc_WriteCoord, Origin[1])
  772.     engfunc(EngFunc_WriteCoord, Origin[2])
  773.     write_short(g_smokepuff_id)
  774.     write_byte(6)
  775.     write_byte(25)
  776.     write_byte(TE_FLAG)
  777.     message_end()
  778. }
  779.  
  780. stock set_weapon_anim(id, anim)
  781. {
  782.     if(!is_user_alive(id))
  783.         return
  784.    
  785.     set_pev(id, pev_weaponanim, anim)
  786.    
  787.     message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, {0, 0, 0}, id)
  788.     write_byte(anim)
  789.     write_byte(pev(id, pev_body))
  790.     message_end()
  791. }
  792.  
  793. stock kill(k, v, headshot)
  794. {
  795.     cs_set_user_money(k, cs_get_user_money(k) + 500)
  796.    
  797.     set_user_frags(k, get_user_frags(k) + 1)
  798.    
  799.     set_msg_block(g_MsgDeathMsg,BLOCK_ONCE)
  800.     set_msg_block(gmsgScoreInfo,BLOCK_ONCE)
  801.     user_kill(v,1)
  802.    
  803.     new kteam = get_user_team(k);
  804.     new vteam = get_user_team(v);
  805.    
  806.     new kfrags = get_user_frags(k);
  807.     new kdeaths = get_user_deaths(k);
  808.    
  809.     new vfrags = get_user_frags(v);
  810.     new vdeaths = get_user_deaths(v);
  811.    
  812.     emessage_begin(MSG_ALL, gmsgScoreInfo);
  813.     ewrite_byte(k);
  814.     ewrite_short(kfrags);
  815.     ewrite_short(kdeaths);
  816.     ewrite_short(0);
  817.     ewrite_short(kteam);
  818.     emessage_end();
  819.    
  820.     emessage_begin(MSG_ALL, gmsgScoreInfo);
  821.     ewrite_byte(v);
  822.     ewrite_short(vfrags);
  823.     ewrite_short(vdeaths);
  824.     ewrite_short(0);
  825.     ewrite_short(vteam);
  826.     emessage_end();
  827.    
  828.     emessage_begin(MSG_BROADCAST, g_MsgDeathMsg)
  829.     ewrite_byte(k)
  830.     ewrite_byte(v)
  831.     ewrite_byte(headshot)
  832.     ewrite_string("Blood Dripper")
  833.     emessage_end()
  834. }
  835.  
  836.  
  837. stock create_blood(const Float:origin[3])
  838. {
  839.     // Show some blood :)
  840.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  841.     write_byte(TE_BLOODSPRITE)
  842.     engfunc(EngFunc_WriteCoord, origin[0])
  843.     engfunc(EngFunc_WriteCoord, origin[1])
  844.     engfunc(EngFunc_WriteCoord, origin[2])
  845.     write_short(m_iBlood[1])
  846.     write_short(m_iBlood[0])
  847.     write_byte(75)
  848.     write_byte(8)
  849.     message_end()
  850. }
  851.  
  852. stock drop_weapons(id, dropwhat)
  853. {
  854.     static weapons[32], num, i, weaponid
  855.     num = 0
  856.     get_user_weapons(id, weapons, num)
  857.      
  858.     for (i = 0; i < num; i++)
  859.     {
  860.         weaponid = weapons[i]
  861.          
  862.         if (dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM))
  863.         {
  864.             static wname[32]
  865.             get_weaponname(weaponid, wname, sizeof wname - 1)
  866.             engclient_cmd(id, "drop", wname)
  867.         }
  868.     }
  869. }
  870.  
  871. stock Get_MissileWeaponHitGroup( iEnt )
  872. {
  873.     new Float:flStart[ 3 ], Float:flEnd[ 3 ];
  874.    
  875.     pev( iEnt, pev_origin, flStart );
  876.     pev( iEnt, pev_velocity, flEnd );
  877.     xs_vec_add( flStart, flEnd, flEnd );
  878.    
  879.     new ptr = create_tr2();
  880.     engfunc( EngFunc_TraceLine, flStart, flEnd, 0, iEnt, ptr );
  881.    
  882.     new iHitGroup, Owner, nOhead, head
  883.     Owner = pev(iEnt, pev_iuser1)
  884.     nOhead = get_tr2( ptr, TR_iHitgroup )
  885.     head = set_tr2( ptr, TR_iHitgroup, HIT_HEAD )
  886.    
  887.     iHitGroup = headshot_mode[Owner] ? head : nOhead
  888.    
  889.     free_tr2( ptr );
  890.    
  891.     return iHitGroup;
  892. }
  893.  
  894. stock get_speed_vector(const Float:origin1[3],const Float:origin2[3],Float:speed, Float:new_velocity[3])
  895. {
  896.     new_velocity[0] = origin2[0] - origin1[0]
  897.     new_velocity[1] = origin2[1] - origin1[1]
  898.     new_velocity[2] = origin2[2] - origin1[2]
  899.     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]))
  900.     new_velocity[0] *= num
  901.     new_velocity[1] *= num
  902.     new_velocity[2] *= num
  903.    
  904.     return 1;
  905. }
  906.  
  907. stock get_position(id,Float:forw, Float:right, Float:up, Float:vStart[])
  908. {
  909.     static Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
  910.    
  911.     pev(id, pev_origin, vOrigin)
  912.     pev(id, pev_view_ofs, vUp) //for player
  913.     xs_vec_add(vOrigin, vUp, vOrigin)
  914.     pev(id, pev_v_angle, vAngle) // if normal entity ,use pev_angles
  915.    
  916.     angle_vector(vAngle, ANGLEVECTOR_FORWARD, vForward) //or use EngFunc_AngleVectors
  917.     angle_vector(vAngle, ANGLEVECTOR_RIGHT, vRight)
  918.     angle_vector(vAngle, ANGLEVECTOR_UP, vUp)
  919.    
  920.     vStart[0] = vOrigin[0] + vForward[0] * forw + vRight[0] * right + vUp[0] * up
  921.     vStart[1] = vOrigin[1] + vForward[1] * forw + vRight[1] * right + vUp[1] * up
  922.     vStart[2] = vOrigin[2] + vForward[2] * forw + vRight[2] * right + vUp[2] * up
  923. }
  924.  
  925. stock set_weapons_timeidle(id, WeaponId ,Float:TimeIdle)
  926. {
  927.     if(!is_user_alive(id))
  928.         return
  929.        
  930.     static entwpn; entwpn = fm_get_user_weapon_entity(id, WeaponId)
  931.     if(!pev_valid(entwpn))
  932.         return
  933.        
  934.     set_pdata_float(entwpn, 48, TimeIdle + 0.2, OFFSET_LINUX_WEAPONS)
  935. }
  936.  
  937. stock set_player_nextattackx(id, Float:nexttime)
  938. {
  939.     if(!is_user_alive(id))
  940.         return
  941.        
  942.     set_pdata_float(id, 83, nexttime, 5)
  943. }
  944.  
thanks works good

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest