/*
Deathrun Respawn Time
Copyright (C) 2014 Adventx
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <
http://www.gnu.org/licenses/>.
*/
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
new const PLUGIN[] = "Deathrun Respawn Time";
new const VERSION[] = "1.4";
#define RESPAWN_TASK 3462
// CVARs
new cvar_respawn_toogle, cvar_respawn_time;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, "Adventx");
// Logevent
register_logevent("event_Round_Start", 2, "1=Round_Start");
// Ham Forwards
RegisterHam(Ham_Killed, "player", "fw_PlayerKilled", 0);
// CVARs
cvar_respawn_toogle = register_cvar("deathrun_respawn_toogle", "1");
cvar_respawn_time = register_cvar("deathrun_respawn_time", "40");
register_cvar("deathrun_respawn_time", VERSION, FCVAR_SERVER|FCVAR_SPONLY);
set_cvar_string("deathrun_respawn_time", VERSION);
}
public event_Round_Start()
{
if (!get_pcvar_num(cvar_respawn_toogle))
return PLUGIN_HANDLED;
set_task(float(get_pcvar_num(cvar_respawn_time)), "TASK_Respawn", RESPAWN_TASK);
ChatColor(0, "!g[Deathrun] !nYou have !t%d !nseconds time respawn", get_pcvar_num(cvar_respawn_time));
return PLUGIN_CONTINUE;
}
public fw_PlayerKilled(id)
{
if (cs_get_user_team(id) == CS_TEAM_CT && task_exists(RESPAWN_TASK))
ExecuteHamB(Ham_CS_RoundRespawn, id);
}
public TASK_Respawn(id)
{
ChatColor(id, "!g[Deathrun] !nYou do not have respawn");
remove_task(RESPAWN_TASK);
}
stock ChatColor(const id, const input[], any:...)
{
new count = 1, players[32];
static msg[191];
vformat(msg, 190, input, 3);
replace_all(msg, 190, "!g", "^4"); // Green Color
replace_all(msg, 190, "!n", "^1"); // Default Color
replace_all(msg, 190, "!t", "^3"); // Team Color
replace_all(msg, 190, "!t2", "^0"); // Team2 Color
if (id) players[0] = id; else get_players(players, count, "ch"); {
for (new i = 0; i < count; i++) {
if (is_user_connected(players[i])) {
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/