Advertisement
Adventx

Deathrun Respawn Time

Sep 20th, 2014
899
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.85 KB | None | 0 0
  1. /*    
  2.     Deathrun Respawn Time
  3.     Copyright (C) 2014  Adventx
  4.  
  5.     This program is free software: you can redistribute it and/or modify
  6.     it under the terms of the GNU General Public License as published by
  7.     the Free Software Foundation, either version 3 of the License, or
  8.     (at your option) any later version.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  17. */
  18.  
  19. #include <amxmodx>
  20. #include <amxmisc>
  21. #include <cstrike>
  22. #include <hamsandwich>
  23.  
  24. new const PLUGIN[] = "Deathrun Respawn Time";
  25. new const VERSION[] = "1.4";
  26.  
  27. #define RESPAWN_TASK   3462
  28.  
  29. // CVARs
  30. new cvar_respawn_toogle, cvar_respawn_time;
  31.  
  32. public plugin_init()
  33. {
  34.     register_plugin(PLUGIN, VERSION, "Adventx");
  35.    
  36.     // Logevent
  37.     register_logevent("event_Round_Start", 2, "1=Round_Start");
  38.    
  39.     // Ham Forwards
  40.     RegisterHam(Ham_Killed, "player", "fw_PlayerKilled", 0);
  41.    
  42.     // CVARs
  43.     cvar_respawn_toogle = register_cvar("deathrun_respawn_toogle", "1");
  44.     cvar_respawn_time = register_cvar("deathrun_respawn_time", "40");
  45.    
  46.     register_cvar("deathrun_respawn_time", VERSION, FCVAR_SERVER|FCVAR_SPONLY);
  47.     set_cvar_string("deathrun_respawn_time", VERSION);
  48. }
  49.  
  50. public event_Round_Start()
  51. {
  52.     if (!get_pcvar_num(cvar_respawn_toogle))
  53.         return PLUGIN_HANDLED;
  54.    
  55.     set_task(float(get_pcvar_num(cvar_respawn_time)), "TASK_Respawn", RESPAWN_TASK);
  56.     ChatColor(0, "!g[Deathrun] !nYou have !t%d !nseconds time respawn", get_pcvar_num(cvar_respawn_time));
  57.    
  58.     return PLUGIN_CONTINUE;
  59. }
  60.  
  61. public fw_PlayerKilled(id)
  62. {
  63.     if (cs_get_user_team(id) == CS_TEAM_CT && task_exists(RESPAWN_TASK))
  64.         ExecuteHamB(Ham_CS_RoundRespawn, id);
  65. }
  66.  
  67. public TASK_Respawn(id)
  68. {
  69.     ChatColor(id, "!g[Deathrun] !nYou do not have respawn");
  70.     remove_task(RESPAWN_TASK);
  71. }
  72.  
  73. stock ChatColor(const id, const input[], any:...)
  74. {
  75.     new count = 1, players[32];
  76.     static msg[191];
  77.     vformat(msg, 190, input, 3);
  78.    
  79.     replace_all(msg, 190, "!g", "^4"); // Green Color
  80.     replace_all(msg, 190, "!n", "^1"); // Default Color
  81.     replace_all(msg, 190, "!t", "^3"); // Team Color
  82.     replace_all(msg, 190, "!t2", "^0"); // Team2 Color
  83.    
  84.     if (id) players[0] = id; else get_players(players, count, "ch"); {
  85.         for (new i = 0; i < count; i++) {
  86.             if (is_user_connected(players[i])) {
  87.                 message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
  88.                 write_byte(players[i]);
  89.                 write_string(msg);
  90.                 message_end();
  91.             }
  92.         }
  93.     }
  94. }
  95.  
  96. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  97. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
  98. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement