Add GulliTon In Knife Menu

Unpaid Requests, Public Plugins
Post Reply
User avatar
VicKy
Mod Tester
Mod Tester
Pakistan
Posts: 87
Joined: 3 years ago
Contact:

Add GulliTon In Knife Menu

#1

Post by VicKy » 3 years ago

bro I want to add This Knife To knife Menu FOr Vip Only Flag c
Knife :-viewtopic.php?t=141

Knife Menu Code:-
  1. #include <zombie_escape>
  2.  
  3. // Models
  4. new const Compat_Models[][] =
  5. {
  6.     "models/zombie_escape/v_combat_knife.mdl",
  7.     "models/zombie_escape/p_combat_knife.mdl"
  8. }
  9.  
  10. new const Strong_Models[][] =
  11. {
  12.     "models/zombie_escape/v_strong_knife.mdl",
  13.     "models/zombie_escape/p_strong_knife.mdl"
  14. }
  15.  
  16. new const Katana_Models[][] =
  17. {
  18.     "models/zombie_escape/v_katana_knife.mdl",
  19.     "models/zombie_escape/p_katana_knife.mdl"
  20. }
  21.  
  22. new const Hammer_Models[][] =
  23. {
  24.     "models/zombie_escape/v_hammer_knife.mdl",
  25.     "models/zombie_escape/p_hammer_knife.mdl"
  26. }
  27.  
  28. // Sounds
  29. new const g_sound_knife[] = "items/gunpickup2.wav"
  30.  
  31. new const combat_sounds[][] =
  32. {
  33.     "zombie_escape/knife_menu/combat_deploy.wav",
  34.     "zombie_escape/knife_menu/combat_hit.wav",
  35.     "zombie_escape/knife_menu/combat_hit.wav",
  36.     "zombie_escape/knife_menu/combat_hit.wav",
  37.     "zombie_escape/knife_menu/combat_hit.wav",
  38.     "zombie_escape/knife_menu/combat_hitwall.wav",
  39.     "zombie_escape/knife_menu/combat_slash.wav",
  40.     "zombie_escape/knife_menu/combat_slash.wav",
  41.     "zombie_escape/knife_menu/combat_stab.wav"
  42. }
  43.  
  44. new const strong_sounds[][] =
  45. {
  46.     "zombie_escape/knife_menu/strong_deploy.wav",
  47.     "zombie_escape/knife_menu/strong_hit.wav",
  48.     "zombie_escape/knife_menu/strong_hit.wav",
  49.     "zombie_escape/knife_menu/strong_hit.wav",
  50.     "zombie_escape/knife_menu/strong_hit.wav",
  51.     "zombie_escape/knife_menu/strong_hitwall.wav",
  52.     "zombie_escape/knife_menu/strong_slash.wav",
  53.     "zombie_escape/knife_menu/strong_slash.wav",
  54.     "zombie_escape/knife_menu/strong_stab.wav"
  55. }
  56.  
  57. new const katana_sounds[][] =
  58. {
  59.     "zombie_escape/knife_menu/katana_deploy.wav",
  60.     "zombie_escape/knife_menu/katana_hit.wav",
  61.     "zombie_escape/knife_menu/katana_hit.wav",
  62.     "zombie_escape/knife_menu/katana_hit.wav",
  63.     "zombie_escape/knife_menu/katana_hit.wav",
  64.     "zombie_escape/knife_menu/katana_hitwall.wav",
  65.     "zombie_escape/knife_menu/katana_slash.wav",
  66.     "zombie_escape/knife_menu/katana_slash.wav",
  67.     "zombie_escape/knife_menu/katana_stab.wav"
  68. }
  69.  
  70. new const hammer_sounds[][] =
  71. {
  72.     "zombie_escape/knife_menu/hammer_deploy.wav",
  73.     "zombie_escape/knife_menu/hammer_hit.wav",
  74.     "zombie_escape/knife_menu/hammer_hit.wav",
  75.     "zombie_escape/knife_menu/hammer_hit.wav",
  76.     "zombie_escape/knife_menu/hammer_hit.wav",
  77.     "zombie_escape/knife_menu/hammer_hitwall.wav",
  78.     "zombie_escape/knife_menu/hammer_slash.wav",
  79.     "zombie_escape/knife_menu/hammer_slash.wav",
  80.     "zombie_escape/knife_menu/hammer_stab.wav"
  81. }
  82.  
  83. new const oldknife_sounds[][] =
  84. {
  85.     "weapons/knife_deploy1.wav",
  86.     "weapons/knife_hit1.wav",
  87.     "weapons/knife_hit2.wav",
  88.     "weapons/knife_hit3.wav",
  89.     "weapons/knife_hit4.wav",
  90.     "weapons/knife_hitwall1.wav",
  91.     "weapons/knife_slash1.wav",
  92.     "weapons/knife_slash2.wav",
  93.     "weapons/knife_stab.wav"
  94. }
  95.  
  96. new bool:g_bCompat[33], bool:g_bStrong[33], bool:g_bKatana[33], bool:g_bHammer[33],
  97. g_iUsedTimes[33], g_pCvarUseTimes
  98.  
  99. public plugin_precache()
  100. {
  101.     new i
  102.  
  103.     for (i = 0; i <= charsmax(Compat_Models); i++)
  104.         precache_model(Compat_Models[i])
  105.  
  106.     for (i = 0; i <= charsmax(Hammer_Models); i++)
  107.         precache_model(Hammer_Models[i])
  108.  
  109.     for (i = 0; i <= charsmax(Katana_Models); i++)
  110.         precache_model(Katana_Models[i])
  111.  
  112.     for (i = 0; i <= charsmax(Strong_Models); i++)
  113.         precache_model(Strong_Models[i])
  114.  
  115.     for (i = 0; i <= charsmax(combat_sounds); i++)
  116.         precache_sound(combat_sounds[i])
  117.  
  118.     for (i = 0; i <= charsmax(strong_sounds); i++)
  119.         precache_sound(strong_sounds[i])
  120.  
  121.     for (i = 0; i <= charsmax(katana_sounds); i++)
  122.         precache_sound(katana_sounds[i])
  123.  
  124.     for (i = 0; i <= charsmax(hammer_sounds); i++)
  125.         precache_sound(hammer_sounds[i])
  126.  
  127.     precache_sound(g_sound_knife)
  128. }
  129.  
  130. public plugin_natives()
  131. {
  132.     register_native("ze_open_knife_menu", "native_ze_open_knife_menu", 1)
  133. }
  134.  
  135. public plugin_init()
  136. {
  137.     register_plugin("[ZE] Addon: Knife Menu", "1.2", "Jack GamePlay")
  138.  
  139.     register_forward(FM_EmitSound, "fw_EmitSound")
  140.  
  141.     register_event("CurWeapon", "CurrentWeapon", "be", "1=1")
  142.  
  143.     g_pCvarUseTimes = register_cvar("ze_knife_menu_use_times", "4")
  144.  
  145.     register_message(get_user_msgid("DeathMsg"), "DeathMsg")
  146.  
  147.     register_clcmd("say /knife", "Show_Knife_Menu")
  148. }
  149.  
  150. public ze_user_humanized(id)
  151. {
  152.     g_iUsedTimes[id] = 0
  153. }
  154.  
  155. public ze_user_infected(Victim)
  156. {
  157.     g_bCompat[Victim] = false
  158.     g_bStrong[Victim] = false
  159.     g_bKatana[Victim] = false
  160.     g_bHammer[Victim] = false
  161.     g_iUsedTimes[Victim] = 0
  162. }
  163.  
  164. public client_putinserver(id)
  165. {
  166.     g_bCompat[id] = false
  167.     g_bStrong[id] = false
  168.     g_bKatana[id] = false
  169.     g_bHammer[id] = false
  170.     g_iUsedTimes[id] = 0
  171. }
  172.  
  173. public client_disconnected(id)
  174. {
  175.     g_bCompat[id] = false
  176.     g_bStrong[id] = false
  177.     g_bKatana[id] = false
  178.     g_bHammer[id] = false
  179.     g_iUsedTimes[id] = 0
  180. }
  181.  
  182. public Show_Knife_Menu(id)
  183. {
  184.     if (!is_user_connected(id))
  185.         return PLUGIN_CONTINUE
  186.  
  187.     if (ze_is_user_zombie(id))
  188.     {
  189.         ze_colored_print(id, "!tZombies can't open knife menu!y.")
  190.         return PLUGIN_HANDLED
  191.     }
  192.  
  193.     if (g_iUsedTimes[id] >= get_pcvar_num(g_pCvarUseTimes))
  194.     {
  195.         ze_colored_print(id, "!tMaximum have been reached !y[!g%d!y]!", get_pcvar_num(g_pCvarUseTimes))
  196.         return PLUGIN_HANDLED
  197.     }
  198.  
  199.     if (!is_user_alive(id))
  200.     {
  201.         ze_colored_print(id, "!tDead can't open knife menu!y.")
  202.         return PLUGIN_HANDLED
  203.     }
  204.  
  205.     Knife_Menu(id)
  206.     return PLUGIN_CONTINUE
  207. }
  208.  
  209. public Knife_Menu(id)
  210. {
  211.     new iMenu = menu_create("\rChoose Your Knife\w:", "Menu_Handler")
  212.     menu_additem(iMenu, "\yCombat", "", 0)
  213.     menu_additem(iMenu, "\yStrong", "", 0)
  214.     menu_additem(iMenu, "\yKatana", "", 0)
  215.     menu_additem(iMenu, "\yHammer", "", 0)
  216.     menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
  217.     menu_display(id, iMenu, 0)
  218. }
  219.  
  220. public Menu_Handler(id, iMenu, iKey)
  221. {
  222.     if(!is_user_alive(id) || ze_is_user_zombie(id))
  223.         return PLUGIN_HANDLED
  224.        
  225.     switch(iKey)
  226.     {
  227.         case 0: // Compat
  228.         {
  229.             g_bCompat[id] = true
  230.             g_bStrong[id] = false
  231.             g_bKatana[id] = false
  232.             g_bHammer[id] = false
  233.             /*rg_remove_item(id, "weapon_knife")
  234.             rg_give_item(id, "weapon_knife", GT_APPEND)
  235.             engclient_cmd(id, "weapon_knife")
  236.             g_iUsedTimes[id]++
  237.             emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  238.         }
  239.         case 1: // Strong
  240.         {
  241.             g_bCompat[id] = false
  242.             g_bStrong[id] = true
  243.             g_bKatana[id] = false
  244.             g_bHammer[id] = false
  245.             /*rg_remove_item(id, "weapon_knife")
  246.             rg_give_item(id, "weapon_knife", GT_APPEND)
  247.             engclient_cmd(id, "weapon_knife")
  248.             g_iUsedTimes[id]++
  249.             emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  250.         }
  251.         case 2: // Katana
  252.         {
  253.             g_bCompat[id] = false
  254.             g_bStrong[id] = false
  255.             g_bKatana[id] = true
  256.             g_bHammer[id] = false
  257.             /*rg_remove_item(id, "weapon_knife")
  258.             rg_give_item(id, "weapon_knife", GT_APPEND)
  259.             engclient_cmd(id, "weapon_knife")
  260.             g_iUsedTimes[id]++
  261.             emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  262.         }
  263.         case 3: // Hammer
  264.         {
  265.             g_bCompat[id] = false
  266.             g_bStrong[id] = false
  267.             g_bKatana[id] = false
  268.             g_bHammer[id] = true
  269.             g_iUsedTimes[id]++
  270.             /*rg_remove_item(id, "weapon_knife")
  271.             rg_give_item(id, "weapon_knife", GT_APPEND)
  272.             engclient_cmd(id, "weapon_knife")
  273.             g_iUsedTimes[id]++
  274.             emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  275.         }
  276.     }
  277.  
  278.     rg_remove_item(id, "weapon_knife")
  279.     rg_give_item(id, "weapon_knife", GT_APPEND)
  280.     engclient_cmd(id, "weapon_knife")
  281.     g_iUsedTimes[id]++
  282.     emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
  283.     menu_destroy(iMenu)
  284.     return PLUGIN_HANDLED
  285. }
  286.  
  287. public fw_EmitSound(id, channel, const sound[])
  288. {
  289.     if(!is_user_alive(id) || ze_is_user_zombie(id))
  290.         return FMRES_IGNORED
  291.        
  292.     new i
  293.     for (i = 0; i <= charsmax(combat_sounds); i++)
  294.     for (i = 0; i <= charsmax(strong_sounds); i++)
  295.     for (i = 0; i <= charsmax(katana_sounds); i++)
  296.     for (i = 0; i <= charsmax(hammer_sounds); i++)
  297.     {
  298.         if(equal(sound, oldknife_sounds[i]))
  299.         {
  300.             if (g_bCompat[id])
  301.             {
  302.                 emit_sound(id, channel, combat_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  303.                 return FMRES_SUPERCEDE
  304.             }
  305.             else if (g_bStrong[id])
  306.             {
  307.                 emit_sound(id, channel, strong_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  308.                 return FMRES_SUPERCEDE
  309.             }
  310.             else if (g_bKatana[id])
  311.             {
  312.                 emit_sound(id, channel, katana_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  313.                 return FMRES_SUPERCEDE
  314.             }
  315.             else if (g_bHammer[id])
  316.             {
  317.                 emit_sound(id, channel, hammer_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  318.                 return FMRES_SUPERCEDE
  319.             }
  320.             else if (!g_bCompat[id] || !g_bStrong[id] || !g_bKatana[id] || !g_bHammer[id])
  321.             {
  322.                 emit_sound(id, channel, oldknife_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  323.                 return FMRES_SUPERCEDE
  324.             }
  325.         }
  326.     }
  327.     return FMRES_IGNORED
  328. }
  329.  
  330. public CurrentWeapon(id)
  331. {
  332.     if(!is_user_alive(id) || ze_is_user_zombie(id))
  333.         return
  334.        
  335.     if(get_user_weapon(id) & CSW_KNIFE)
  336.     {
  337.         if(g_bCompat[id])
  338.         {
  339.             cs_set_player_view_model(id, CSW_KNIFE, Compat_Models[0])
  340.             cs_set_player_weap_model(id, CSW_KNIFE, Compat_Models[1])
  341.         }
  342.         else if(g_bStrong[id])
  343.         {
  344.             cs_set_player_view_model(id, CSW_KNIFE, Strong_Models[0])
  345.             cs_set_player_weap_model(id, CSW_KNIFE, Strong_Models[1])
  346.         }
  347.         else if(g_bKatana[id])
  348.         {
  349.             cs_set_player_view_model(id, CSW_KNIFE, Katana_Models[0])
  350.             cs_set_player_weap_model(id, CSW_KNIFE, Katana_Models[1])
  351.         }
  352.         else if(g_bHammer[id])
  353.         {
  354.             cs_set_player_view_model(id, CSW_KNIFE, Hammer_Models[0])
  355.             cs_set_player_weap_model(id, CSW_KNIFE, Hammer_Models[1])
  356.         }
  357.         else
  358.         {
  359.             cs_reset_player_view_model(id, CSW_KNIFE)
  360.             cs_reset_player_weap_model(id, CSW_KNIFE)
  361.         }
  362.     }
  363. }
  364.  
  365. public DeathMsg(msg_id, msg_dest, id)
  366. {
  367.     static szTruncatedWeapon[33], iAttacker
  368.     get_msg_arg_string(4, szTruncatedWeapon, charsmax(szTruncatedWeapon))
  369.     iAttacker = get_msg_arg_int(1)
  370.    
  371.     if(!is_user_alive(iAttacker) || iAttacker == get_msg_arg_int(2) || !is_user_alive(get_msg_arg_int(2))) // get_msg_arg_int(2) = iVictim
  372.         return
  373.    
  374.     if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iAttacker) & CSW_KNIFE)
  375.     {
  376.         if(g_bCompat[id])
  377.         {
  378.             set_msg_arg_string(4, "Combat knife")
  379.         }
  380.         else if(g_bStrong[id])
  381.         {
  382.             set_msg_arg_string(4, "Strong knife")
  383.         }
  384.         else if(g_bKatana[id])
  385.         {
  386.             set_msg_arg_string(4, "Katana knife")
  387.         }
  388.         else if(g_bHammer[id])
  389.         {
  390.             set_msg_arg_string(4, "Ice knife")
  391.         }
  392.     }
  393. }
  394.  
  395. public native_ze_open_knife_menu(id)
  396. {
  397.     Show_Knife_Menu(id)
  398. }
Vip SysTem:-
  1. #include <zombie_escape>
  2. #include <ze_vip>
  3.  
  4. // Defines - Comment MULTIJUMP or PARACHUTE, so you don't need to run multijump/parachute plugin.
  5. #define VIP_MESSAGES    VIP_A
  6. #define MULTIJUMP       VIP_B
  7. #define PARACHUTE       VIP_C
  8. #define SCOREBOARD      VIP_D
  9. #define DAMAGE          VIP_E
  10. #define NON_VIP         VIP_Z
  11.  
  12. #if defined PARACHUTE
  13.     #include <ze_parachute>
  14. #endif
  15.  
  16. #if defined MULTIJUMP
  17.     #include <ze_multijump>
  18. #endif
  19.  
  20. // Variables
  21. new g_szPasswordKey[65],
  22.     g_szPassword[65],
  23.     bool:g_bIsUserVIP[33],
  24.     bool:g_bSetVIP[33],
  25.     g_iFlags[33],
  26.     bool:g_bIsHappyHour,
  27.     g_iMaxPlayers
  28.  
  29. // Const.
  30. static const g_szLocalFile[] = "addons/amxmodx/configs/ze_vips.ini"
  31.  
  32. new const szCommands[][] =
  33. {
  34.     "say /vip",
  35.     "say /vips",
  36.     "say_team /vip",
  37.     "say_team /vips"
  38. }
  39.  
  40. // Cvars
  41. new g_pCvarVIPScoreboard,
  42.     g_pCvarConnectMessage,
  43.     g_pCvarAdminContact,
  44.     g_pCvarEnableHappyHours,
  45.     g_pCvarHappyHours,
  46.     g_pCvarHappyHoursFlags,
  47.     g_pCvarDamage
  48.  
  49. #if defined PARACHUTE
  50.     new g_pCvarParachute
  51. #endif
  52.  
  53. #if defined MULTIJUMP
  54.     new g_pCvarMultijump
  55. #endif
  56.  
  57. public plugin_natives()
  58. {
  59.     register_native("ze_get_vip_flags", "native_ze_get_vip_flags", 1)
  60.     register_native("ze_set_vip_flags", "native_ze_set_vip_flags", 1)
  61.     register_native("ze_is_user_vip", "native_ze_is_user_vip", 1)
  62. }
  63.  
  64. public plugin_init()
  65. {
  66.     register_plugin("[ZE] Zombie Escape VIP", VIP_VERSION, AUTHORS)
  67.    
  68.     // Hookchain
  69.     RegisterHookChain(RG_CBasePlayer_TakeDamage, "Fw_TakeDamage_Pre", 0)
  70.    
  71.     // Cvars
  72.     g_pCvarConnectMessage = register_cvar("ze_connect_message", "1")
  73.     g_pCvarAdminContact = register_cvar("ze_admin_contact", "Admin Name")
  74.     g_pCvarVIPScoreboard = register_cvar("ze_show_vip_scoreboard", "1")
  75.     g_pCvarEnableHappyHours = register_cvar("ze_enable_happy_hours", "1")
  76.     g_pCvarHappyHours = register_cvar("ze_vip_happy_hours", "9-12")
  77.     g_pCvarHappyHoursFlags = register_cvar("ze_happy_hours_vip_flags", "abcd")
  78.     g_pCvarDamage = register_cvar("ze_vip_multiply_damage", "1.2")
  79.     #if defined MULTIJUMP
  80.         g_pCvarMultijump = register_cvar("ze_give_vip_multijump", "1")
  81.     #endif
  82.     #if defined PARACHUTE
  83.         g_pCvarParachute = register_cvar("ze_give_vip_parachute", "1")
  84.     #endif
  85.    
  86.     register_cvar("ze_vip_version", VIP_VERSION, FCVAR_SERVER|FCVAR_SPONLY)
  87.     set_cvar_string("ze_vip_version", VIP_VERSION)
  88.    
  89.     // Commands
  90.     for (new i = 0; i < charsmax(szCommands); i++)
  91.         register_clcmd(szCommands[i], "CmdVIP")
  92.  
  93.     register_clcmd("say /getvip", "CmdMotd")
  94.     register_clcmd("say_team /getvip", "CmdMotd")
  95.    
  96.     // Get Password Key
  97.     get_cvar_string("amx_password_field", g_szPasswordKey, charsmax(g_szPasswordKey))
  98.    
  99.     // Initialize Arrays
  100.     arrayset(g_bIsUserVIP, false, 32)
  101.     arrayset(g_bSetVIP, false, 32)
  102.    
  103.     // Get max players
  104.     g_iMaxPlayers = get_member_game(m_nMaxPlayers)
  105. }
  106.  
  107. public plugin_cfg()
  108. {
  109.     // Get our configiration file and Execute it
  110.     new szCfgDir[64]
  111.     get_localinfo("amxx_configsdir", szCfgDir, charsmax(szCfgDir))
  112.     server_cmd("exec %s/ze_vip.cfg", szCfgDir)
  113. }
  114.  
  115. public Fw_TakeDamage_Pre(iVictim, iInflictor, iAttacker, Float:flDamage, bitsDamageType)
  116. {
  117.     if (!is_user_alive(iVictim) || !is_user_alive(iAttacker))
  118.         return HC_CONTINUE
  119.    
  120.     if (!(ze_get_vip_flags(iAttacker) & DAMAGE) || get_pcvar_num(g_pCvarDamage) == 0)
  121.         return HC_CONTINUE
  122.  
  123.     SetHookChainArg(4, ATYPE_FLOAT, flDamage * get_pcvar_float(g_pCvarDamage))
  124.    
  125.     return HC_CONTINUE
  126. }
  127.  
  128. public client_authorized(id)
  129. {
  130.     // Get password from Setinfo
  131.     new szPassword[65]
  132.     get_user_info(id, g_szPasswordKey, szPassword, charsmax(szPassword))
  133.    
  134.     // Player VIP?
  135.     ze_get_vip_flags(id)
  136.    
  137.     if (g_bIsUserVIP[id])
  138.     {
  139.         if (!equal(szPassword, g_szPassword))
  140.         {
  141.             // VIP and wrong Password? Kick him
  142.             client_cmd(id, "echo ^"* VIP Invalid Password!^"")
  143.             server_cmd("kick #%d ^"You have no entry to the server...^"", get_user_userid(id))
  144.         }
  145.         else
  146.         {
  147.             client_cmd(id, "echo ^"* VIP Password Accepted!^"")
  148.         }
  149.     }
  150. }
  151.  
  152. public client_putinserver(id)
  153. {
  154.     if (ze_get_vip_flags(id) & VIP_MESSAGES)
  155.     {
  156.         if (get_pcvar_num(g_pCvarConnectMessage) != 0)
  157.         {
  158.             new szName[32]
  159.             get_user_name(id, szName, charsmax(szName))
  160.             ze_colored_print(0, "!tVIP !g%s !thas connected to the server!y.", szName)
  161.         }
  162.     }
  163. }
  164.  
  165. public CmdMotd(id)
  166. {
  167.     show_motd(id, "ze_vip.txt", "Zombie Escape VIP")
  168. }
  169.  
  170. public CmdVIP(id)
  171. {
  172.     set_task(0.1, "Print_List")
  173. }
  174.  
  175. public Print_List()
  176. {
  177.     Print_VIP_List()
  178. }
  179.  
  180. public Print_VIP_List()
  181. {
  182.     new szVIPName[33][32], szMessage[700], szContact[256]
  183.    
  184.     new iPlayer, i, iVIPCount = 0, iLen = 0;
  185.    
  186.     for (iPlayer = 1; iPlayer <= g_iMaxPlayers; iPlayer++)
  187.     {
  188.         if (!is_user_connected(iPlayer))
  189.             continue
  190.        
  191.         if (ze_get_vip_flags(iPlayer) & VIP_MESSAGES)
  192.         {
  193.             get_user_name(iPlayer, szVIPName[iVIPCount], charsmax(szVIPName))
  194.             iVIPCount++
  195.         }
  196.     }
  197.    
  198.     iLen = formatex(szMessage, charsmax(szMessage), "^4VIPs ONLINE^1: ")
  199.    
  200.     if (iVIPCount > 0)
  201.     {
  202.         for (i = 0; i <= iVIPCount; i++)
  203.         {
  204.             iLen += formatex(szMessage[iLen], charsmax(szMessage) - iLen, "^3%s^1%s^3", szVIPName[i], (i < (iVIPCount - 1)) ? ", " : "")
  205.         }
  206.     }
  207.     else
  208.     {
  209.         szMessage = "^4No VIPs online^1."
  210.     }
  211.    
  212.     client_print_color(0, print_team_default, szMessage)
  213.    
  214.     get_pcvar_string(g_pCvarAdminContact, szContact, charsmax(szContact))
  215.    
  216.     if (szContact[0])
  217.     {
  218.         client_print_color(0, print_team_default, "^1- ^4Contact Server Admin ^1-- ^3%s", szContact)
  219.     }
  220. }
  221.  
  222. public ze_user_humanized(id)
  223. {
  224.     if (!is_user_alive(id))
  225.         return
  226.    
  227.     Happy_Hours()
  228.    
  229.     if (g_bIsHappyHour == true && get_pcvar_num(g_pCvarEnableHappyHours) != 0)
  230.     {
  231.         new szFlags[VIP_MAX_FLAGS]
  232.         get_pcvar_string(g_pCvarHappyHoursFlags, szFlags, charsmax(szFlags))
  233.         ze_set_vip_flags(id, read_flags(szFlags))
  234.     }
  235.    
  236.     // Get password from Setinfo
  237.     new szPassword[65]
  238.     get_user_info(id, g_szPasswordKey, szPassword, charsmax(szPassword))
  239.    
  240.     ze_get_vip_flags(id)
  241.    
  242.     if (g_bIsUserVIP[id])
  243.     {
  244.         if (!equal(szPassword, g_szPassword))
  245.         {
  246.             // VIP and wrong Password? Kick him
  247.             client_cmd(id, "echo ^"* VIP Invalid Password!^"")
  248.             server_cmd("kick #%d ^"You have no entry to the server...^"", get_user_userid(id))
  249.         }
  250.         else
  251.         {
  252.             client_cmd(id, "echo ^"* VIP Password Accepted!^"")
  253.         }
  254.     }
  255.    
  256.     #if defined MULTIJUMP
  257.         if (ze_get_vip_flags(id) & MULTIJUMP)
  258.         {
  259.             if (get_pcvar_num(g_pCvarMultijump) != 0)
  260.             {
  261.                 ze_give_user_multijump(id)
  262.             }
  263.         }
  264.     #endif
  265.    
  266.     #if defined PARACHUTE
  267.         if (ze_get_vip_flags(id) & PARACHUTE)
  268.         {
  269.             if (get_pcvar_num(g_pCvarParachute) != 0)
  270.             {
  271.                 ze_give_user_parachute(id)
  272.             }
  273.         }
  274.     #endif
  275.  
  276.     set_task(0.1, "Update_Attribute", id, _, _, "a", 10)
  277. }
  278.  
  279. public ze_roundend(WinTeam)
  280. {
  281.     for (new i = 0; i < get_member_game(m_nMaxPlayers); i++)
  282.     {
  283.         g_bSetVIP[i] = false
  284.     }
  285. }
  286.  
  287. public Update_Attribute(id)
  288. {
  289.     if ((ze_get_vip_flags(id) & SCOREBOARD) && get_pcvar_num(g_pCvarVIPScoreboard) != 0)
  290.     {
  291.         message_begin(MSG_ALL, get_user_msgid("ScoreAttrib"), {0, 0, 0}, id)
  292.         write_byte(id)
  293.         write_byte(4)
  294.         message_end()
  295.     }
  296. }
  297.  
  298. public native_ze_get_vip_flags(id)
  299. {
  300.     // Our file exists?
  301.     if (file_exists(g_szLocalFile))
  302.     {
  303.         /*
  304.         *   We can't use new file system here, because if file opened it can not be deleted.
  305.         *   Old system provide the suitable way for doing it simply. That's a reason.
  306.         */
  307.  
  308.         // Declare some useful variables
  309.         new iMaxLines, szLineToRead[129], szParse[4][65], szName[32], szSteamID[36], iTextLen
  310.        
  311.         // Get max lines number in the file
  312.         iMaxLines = file_size(g_szLocalFile, FSOPT_LINES_COUNT)
  313.        
  314.         // Get our player name and steamid
  315.         get_user_authid(id, szSteamID, charsmax(szSteamID))
  316.         get_user_name(id, szName, charsmax(szName))
  317.        
  318.         // Loop through the whole file
  319.         for (new iLine = 0; iLine < iMaxLines; iLine++)
  320.         {
  321.             // Read line by line
  322.             read_file(g_szLocalFile, iLine, szLineToRead, charsmax(szLineToRead), iTextLen)
  323.            
  324.             // Remove any space, useful to remove blank lines which only contain spaces
  325.             trim(szLineToRead)
  326.            
  327.             // Check if string empty or starting with ; or // ignore the line
  328.             if (strlen(szLineToRead) == 0 || szLineToRead[0] == ';' || (szLineToRead[0] == '/' && szLineToRead[1] == '/'))
  329.                 continue
  330.            
  331.             // Split our line by spaces to 4 parts: name or steam, password, flags, expire date
  332.             parse(szLineToRead, szParse[0], charsmax(szParse[]), szParse[1], charsmax(szParse[]), szParse[2], charsmax(szParse[]), szParse[3], charsmax(szParse[]))
  333.            
  334.             // Remove all "" from our 4 parts
  335.             remove_quotes(szParse[0])
  336.             remove_quotes(szParse[1])
  337.             remove_quotes(szParse[2])
  338.             remove_quotes(szParse[3])
  339.            
  340.             // Check expire date for this steam/name (Steam/Name unique to check with)
  341.             CheckDate(szParse[3], szParse[0])
  342.            
  343.             // Check if user in file is same who we check
  344.             if (equali(szSteamID, szParse[0]) || equali(szName, szParse[0]))
  345.             {
  346.                 // Player exists in the file, this means he is VIP
  347.                 g_bIsUserVIP[id] = true
  348.                 copy(g_szPassword, charsmax(g_szPassword), szParse[1])
  349.                
  350.                 // Return his flags
  351.                 return read_flags(szParse[2])
  352.             }
  353.         }
  354.     }
  355.     else
  356.     {
  357.         // File not exists, then create it (Here we can use new file system without problems)
  358.         new iFileHandler = fopen(g_szLocalFile, "wt")
  359.        
  360.         fputs(iFileHandler, "; Zombie Escape VIP^n^n")
  361.         fputs(iFileHandler, ";Flags:^n^n")
  362.         fputs(iFileHandler, "; a -- Connect Message and VIP List^n")
  363.         fputs(iFileHandler, "; b -- Multi-Jump^n")
  364.         fputs(iFileHandler, "; c -- Parachute^n")
  365.         fputs(iFileHandler, "; d -- Scoreboard Attrib.^n")
  366.         fputs(iFileHandler, "; e -- VIP Damage^n^n")
  367.         fputs(iFileHandler, ";Usage Example:^n^n")
  368.         fputs(iFileHandler, "; ^"Steam/Nick^" ^"Password^" ^"Flags^" ^"ExpireDate^"")
  369.  
  370.         fclose(iFileHandler)
  371.     }
  372.    
  373.     g_bIsUserVIP[id] = false
  374.    
  375.     if (g_bSetVIP[id] == true)
  376.     {
  377.         return g_iFlags[id]
  378.     }
  379.     else
  380.     {
  381.         return NON_VIP
  382.     }
  383. }
  384.  
  385. public native_ze_set_vip_flags(id, Flags)
  386. {
  387.     g_bSetVIP[id] = true
  388.     g_iFlags[id] = Flags
  389.     ze_get_vip_flags(id)
  390. }
  391.  
  392. public native_ze_is_user_vip(id)
  393. {
  394.     if (ze_get_vip_flags(id) & VIP_Z)
  395.         return false
  396.    
  397.     return true
  398. }
  399.  
  400. /*
  401. *   Dedicated stock for our plugin, to delete expired lines.
  402. *   You should give it the expire date, and key.
  403. *   Key should be unique like steam or name, so we can in another stock detect this line and delete it.
  404. */
  405. stock CheckDate(const szEndDate[], const szKey[])
  406. {
  407.     new szCurrentDate[64],
  408.         szFormatedEndDate[64],
  409.         szCurrentDay[32],
  410.         szCurrentMonth[32],
  411.         szCurrentYear[32],
  412.         szEndDay[32],
  413.         szEndMonth[32],
  414.         szEndYear[32]
  415.        
  416.     copy(szFormatedEndDate, charsmax(szFormatedEndDate), szEndDate)
  417.     get_time("%d-%m-%Y", szCurrentDate, charsmax(szCurrentDate))
  418.    
  419.     for (new ch = 0; ch <= charsmax(szFormatedEndDate); ch++)
  420.     {
  421.         if (szFormatedEndDate[ch] == '-')
  422.             szFormatedEndDate[ch] = ' '
  423.     }
  424.    
  425.     for (new ch = 0; ch <= charsmax(szCurrentDate); ch++)
  426.     {
  427.         if (szCurrentDate[ch] == '-')
  428.             szCurrentDate[ch] = ' '
  429.     }
  430.  
  431.     parse(szCurrentDate, szCurrentDay, charsmax(szCurrentDay), szCurrentMonth, charsmax(szCurrentMonth), szCurrentYear, charsmax(szCurrentYear))
  432.     parse(szFormatedEndDate, szEndDay, charsmax(szEndDay), szEndMonth, charsmax(szEndMonth), szEndYear, charsmax(szEndYear))
  433.    
  434.     if (str_to_num(szFormatedEndDate) == 0)
  435.         return
  436.    
  437.     new iCurrentDay,
  438.         iCurrentMonth,
  439.         iCurrentYear,
  440.         iEndDay,
  441.         iEndMonth,
  442.         iEndYear
  443.    
  444.     iCurrentDay   = str_to_num(szCurrentDay)
  445.     iCurrentMonth = str_to_num(szCurrentMonth)
  446.     iCurrentYear  = str_to_num(szCurrentYear)
  447.    
  448.     iEndDay   = str_to_num(szEndDay)
  449.     iEndMonth = str_to_num(szEndMonth)
  450.     iEndYear  = str_to_num(szEndYear)
  451.    
  452.     // Just a check, maybe useless
  453.     if ((!iCurrentDay && !iCurrentMonth && !iCurrentYear) || (!iEndDay && !iEndMonth && !iEndYear))
  454.         return
  455.    
  456.     /*
  457.     *   Check expire date algorithm idea:
  458.     *  
  459.     *   If current year > Expire year -- This means it's already expired so delete this line.
  460.     *
  461.     *   If Same year then check by month:
  462.     *   If current month > expire month -- Expired delete the line.
  463.     *
  464.     *   If same month then check by day:
  465.     *   If current day > expire date -- Expired detete the line.
  466.     */
  467.    
  468.     if (iEndYear < iCurrentYear)
  469.     {
  470.         Delete_Line(g_szLocalFile, szKey)
  471.     }
  472.     else if (iEndYear == iCurrentYear)
  473.     {
  474.         if (iEndMonth < iCurrentMonth)
  475.         {
  476.             Delete_Line(g_szLocalFile, szKey)
  477.         }
  478.         else if (iEndMonth == iCurrentMonth)
  479.         {
  480.             if (iEndDay < iCurrentDay)
  481.             {
  482.                 Delete_Line(g_szLocalFile, szKey)
  483.             }
  484.         }
  485.     }
  486. }
  487.  
  488. /*
  489. *   Stock used to delete line in file, based on key.
  490. *   Key is steamid or name.
  491. *   For some purposes we can't use new file system here.
  492. */
  493. stock Delete_Line(const szFile[], const szKey[])
  494. {
  495.     // Check if file there or not
  496.     if (file_exists(szFile))
  497.     {
  498.         // Get max lines in the file
  499.         new iMaxLines = file_size(szFile, FSOPT_LINES_COUNT)
  500.        
  501.         // Some variables
  502.         new Array:szFileLines, szLineToRead[400], iTextLen, szParse[4][65]
  503.        
  504.         // Create dynamic array to handle all lines in our file (every line will be in element)
  505.         szFileLines = ArrayCreate(400)
  506.        
  507.         // Loop through whole file
  508.         for (new iLine = 0; iLine < iMaxLines; iLine++)
  509.         {
  510.             // Read line by line
  511.             read_file(szFile, iLine, szLineToRead, charsmax(szLineToRead), iTextLen)
  512.            
  513.             // Just split our line so we get the steamid or name and compare with key
  514.             parse(szLineToRead, szParse[0], charsmax(szParse[]), szParse[1], charsmax(szParse[]), szParse[2], charsmax(szParse[]), szParse[3], charsmax(szParse[]))
  515.            
  516.             // Remove any ""
  517.             remove_quotes(szParse[0])
  518.             remove_quotes(szParse[1])
  519.             remove_quotes(szParse[2])
  520.             remove_quotes(szParse[3])
  521.            
  522.             // If steamid or name is same as one we need to delete, then don't copy to our array
  523.             if (equal(szParse[0], szKey))
  524.                 continue
  525.            
  526.             // Push all lines to our array except one we need to delete
  527.             ArrayPushString(szFileLines, szLineToRead)
  528.         }
  529.        
  530.         // Delete the file
  531.         delete_file(szFile)
  532.        
  533.         // Recreate the file and print all data to it
  534.         for (new iLine = 0; iLine < ArraySize(szFileLines); iLine++)
  535.         {
  536.             // Get strings in our array
  537.             ArrayGetString(szFileLines, iLine, szLineToRead, charsmax(szLineToRead))
  538.            
  539.             // Write them to our file
  540.             write_file(szFile, szLineToRead)
  541.         }
  542.        
  543.         // Destroy this array and free it's memory
  544.         ArrayDestroy(szFileLines)
  545.     }
  546. }
  547.  
  548. stock Happy_Hours()
  549. {
  550.     new szTime[3], szHappyHours[32], szHappyHours_Start[32], szHappyHours_End[32]
  551.     get_time("%H", szTime, charsmax(szTime))
  552.    
  553.     get_pcvar_string(g_pCvarHappyHours, szHappyHours, charsmax(szHappyHours))
  554.    
  555.     for (new ch = 0; ch <= charsmax(szHappyHours); ch++)
  556.     {
  557.         if (szHappyHours[ch] == '-')
  558.             szHappyHours[ch] = ' '
  559.     }
  560.    
  561.     parse(szHappyHours, szHappyHours_Start, charsmax(szHappyHours_Start), szHappyHours_End, charsmax(szHappyHours_End))
  562.    
  563.     new iTime, iHappyHourStart, iHappyHourEnd
  564.    
  565.     iTime = str_to_num(szTime)
  566.     iHappyHourStart = str_to_num(szHappyHours_Start)
  567.     iHappyHourEnd = str_to_num(szHappyHours_End)
  568.    
  569.     if(iHappyHourEnd > iTime >= iHappyHourStart)
  570.     {
  571.         g_bIsHappyHour = true
  572.     }
  573.     else
  574.     {
  575.         g_bIsHappyHour = false
  576.     }
  577. }
Image

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

#2

Post by Raheem » 3 years ago

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

User avatar
VicKy
Mod Tester
Mod Tester
Pakistan
Posts: 87
Joined: 3 years ago
Contact:

#3

Post by VicKy » 3 years ago

its Working BUt When I Choose This Knife The Previous GUn That I had is Dropped
ANd Blood Dripen No Damage
ANd No KNochback
please Fix It Its Have TO Make Damage And Knockback Normal And No Drop previous GUn Auto
Image

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

#4

Post by Raheem » 3 years ago

This from the weapon itself then, try find fixed version.
He who fails to plan is planning to fail

User avatar
VicKy
Mod Tester
Mod Tester
Pakistan
Posts: 87
Joined: 3 years ago
Contact:

#5

Post by VicKy » 3 years ago

I Can't Find Fixed Version :(
Image

User avatar
VicKy
Mod Tester
Mod Tester
Pakistan
Posts: 87
Joined: 3 years ago
Contact:

#6

Post by VicKy » 3 years ago

Try This Raheem It Will Work?
  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.  
Image

Post Reply

Create an account or sign in to join the discussion

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

Create an account

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

Register

Sign in

Who is online

Users browsing this forum: No registered users and 3 guests