1.I want a plugin to execute a command every x seconds (set by a cvar)
2.
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <fun>
#define RED random(255)
#define GREEN random(255)
#define BLUE random(255)
new RespawnerInterval, MaxPlayers;
new pCvarMoney, pCvarMoneyAmount;
new CountDown;
public plugin_init()
{
register_plugin("Timed Respawner", "1.1", "hleV");
RespawnerInterval = register_cvar("respawner_interval", "60");
MaxPlayers = get_maxplayers();
pCvarMoney = register_cvar ( "bonus_money", "1" )
pCvarMoneyAmount = register_cvar ( "bonus_moneyamount", "1000" )
RegisterHam ( Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1 )
CountDown = get_pcvar_num(RespawnerInterval);
set_task(1.0, "RespawnPlayers", _, _,_, "b");
}
public fwHamPlayerSpawnPost ( id )
{
if ( ( get_pcvar_num ( pCvarMoney ) == 1 ) && ( is_user_alive(id) ) )
{
cs_set_user_money ( id, cs_get_user_money ( id ) + get_pcvar_num ( pCvarMoneyAmount ) )
}
}
public RespawnPlayers()
{
--CountDown;
for (new Cl = 1; Cl <= MaxPlayers; Cl++)
{
if (cs_get_user_team(Cl) == CS_TEAM_SPECTATOR)
return;
else
if (!is_user_connected(Cl) || is_user_alive(Cl))
continue;
if( CountDown == 0 )
ExecuteHamB(Ham_CS_RoundRespawn, Cl);
else
{
set_hudmessage(RED, GREEN, BLUE, -1.0, 0.8, 0, 0.0, 1.1, 0.0, 0.0, -1);
show_hudmessage(Cl, "You will respawn in %i second%s", CountDown, CountDown == 1 ? "" : "s");
}
}
if( CountDown == 0 )
CountDown =
and modify this plugin to respawn every 10 seconds the player (respawn_interval cvar)
__________________