Advertisement
Guest User

Knives Auto Respawn

a guest
May 15th, 2016
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.08 KB | None | 0 0
  1. /* AMXX Mod script.
  2. *
  3. * (c) Copyright 2004, developed by Geesu
  4. * This file is provided as is (no warranties).
  5. *
  6. * Changelog
  7. * 1.1:
  8. *   Added /respawn command to spawn a player if they're dead
  9. *   Added a public cvar
  10. * 1.0:
  11. *   Pistols are now given to players when they respawn
  12. *   sv_checkpistols cvar added, if this is set to 0, then players will always spawn with a pistol, otherwise they will only spawn with a pistol when it is not scoutzknivez and not a ka map
  13. *   sv_respawn cvar added, set this to 0 to disable the plugin
  14. */
  15.  
  16. new const VERSION[] =   "1.1"
  17.  
  18. #include <amxmodx>
  19. #include <fun>
  20. #include <cstrike>
  21.  
  22. #define DISABLE_CS 0
  23.  
  24. // team ids
  25. #define UNASSIGNED 0
  26. #define TS 1
  27. #define CTS 2
  28. #define AUTO_TEAM 5
  29.  
  30. new bool:g_PistolsDisabled = false
  31.  
  32. public plugin_init(){
  33.  
  34.     register_plugin("Respawn Forever", VERSION, "Pimp Daddy (OoTOAoO)")
  35.  
  36.     register_event("DeathMsg","on_Death","a")
  37.    
  38.     register_cvar("sv_checkpistols", "1")
  39.     register_cvar("sv_respawn", "1")
  40.     register_cvar("respawn_forever_version", VERSION, FCVAR_SERVER)
  41.  
  42.     register_clcmd("say","on_Chat")
  43.     register_clcmd("say_team","on_Chat")
  44. }
  45.  
  46. public on_Chat(id)
  47. {
  48.     if ( !get_cvar_num("sv_respawn") )
  49.     {
  50.         client_print(id, print_chat, "* Respawn plugin disabled")
  51.         return PLUGIN_CONTINUE
  52.     }
  53.  
  54.     new szSaid[32]
  55.     read_args(szSaid, 31)
  56.  
  57.     if (equali(szSaid,"^"/respawn^"") || equali(szSaid,"^"respawn^""))
  58.     {
  59.         spawn_func(id)
  60.     }
  61. }
  62.  
  63. public check_pistols()
  64. {
  65.     /* Determine if we should give players a pistol or not */
  66.     if ( get_cvar_num("sv_checkpistols") )
  67.     {
  68.         set_task(1.0, "check_pistols")
  69.         new mapname[32]
  70.         get_mapname(mapname,31)
  71.         if ( containi(mapname,"ka_")!=-1 || containi(mapname,"scoutzknivez")!=-1 )
  72.                 g_PistolsDisabled = true
  73.     }
  74. }
  75.  
  76. public spawn_func(id)
  77. {
  78.     new parm[1]
  79.     parm[0]=id
  80.    
  81.     /* Spawn the player twice to avoid the HL engine bug */
  82.     set_task(0.5,"player_spawn",72,parm,1)
  83.     set_task(0.7,"player_spawn",72,parm,1)
  84.  
  85.     /* Then give them a suit and a knife */
  86.     set_task(0.9,"player_giveitems",72,parm,1)
  87. }
  88.  
  89. public on_Death()
  90. {
  91.     if ( !get_cvar_num("sv_respawn") )
  92.         return PLUGIN_CONTINUE
  93.    
  94.     new victim_id = read_data(2)
  95.    
  96.     spawn_func( victim_id )
  97.  
  98.     return PLUGIN_CONTINUE
  99. }
  100.  
  101. public player_giveitems(parm[1])
  102. {
  103.     new id = parm[0]
  104.  
  105.     give_item(id, "item_suit")
  106.     give_item(id, "weapon_knife")
  107.  
  108.     /* Determines if a players should be given a pistol */
  109.     if ( !g_PistolsDisabled )
  110.     {
  111.         new wpnList[32] = 0, number = 0, bool:foundGlock = false, bool:foundUSP = false
  112.         get_user_weapons(id,wpnList,number)
  113.        
  114.         /* Determine if the player already has a pistol */
  115.         for (new i = 0;i < number;i++)
  116.         {
  117.             if (wpnList[i] == CSW_GLOCK18)
  118.                 foundGlock = true
  119.             if (wpnList[i] == CSW_USP)
  120.                 foundUSP = true
  121.         }
  122.        
  123.         /* Give a T his/her pistol */
  124.         if ( get_user_team(id)==TS && !foundGlock )
  125.         {
  126.                 give_item(id,"weapon_knife")
  127.         }
  128.         /* Give a CT his/her pistol */
  129.         else if ( get_user_team(id)==CTS && !foundUSP )
  130.         {
  131.                 give_item(id,"weapon_knife")
  132.         }
  133.     }
  134.  
  135.     return PLUGIN_CONTINUE
  136. }
  137.  
  138. public player_spawn(parm[1])
  139. {
  140.     spawn(parm[0])
  141. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement