Quote:
Originally Posted by trickgod
|
Not tested:
PHP Code:
#include <sourcemod>
bool g_bStarted;
bool g_bImmune[MAXPLAYERS + 1];
ConVar g_cSeconds;
float g_fSeconds;
public void OnPluginStart()
{
AddCommandListener(Cmd_Redie, "sm_redie");
HookEvent("round_start", Event_Start);
HookEvent("round_end", Event_End);
HookEvent("player_team", Event_Team);
g_cSeconds = CreateConVar("sm_seconds", "15.0", "Choose the desired ammount of seconds, before spawning is disallowed.");
AutoExecConfig(true, "SomeRandomCfg");
}
public Action Cmd_Redie(int iClient, const char[] sCommand, int iArgs)
{
g_bImmune[iClient] = true;
}
public Action Event_Start(Event hEvent, const char[] sName, bool bDontBroadcast)
{
g_fSeconds = GetConVarFloat(g_cSeconds);
CreateTimer(g_fSeconds, Timer_Disallow);
}
public Action Event_End(Event hEvent, const char[] sName, bool bDontBroadcast)
{
int iClient = GetClientOfUserId(hEvent.GetInt("userid"));
g_bStarted = false;
g_bImmune[iClient] = false;
}
public Action Event_Team(Event hEvent, const char[] sName, bool bDontBroadcast)
{
int iClient = GetClientOfUserId(hEvent.GetInt("userid"));
if (g_bStarted)
{
if (IsClientInGame(iClient))
{
if (IsPlayerAlive(iClient))
{
if (g_bImmune[iClient])
{
return Plugin_Handled;
}
else
{
ClientCommand(iClient, "Kill");
PrintToChat(iClient, "Unfortunately the round has already started.")
}
}
}
}
return Plugin_Handled;
}
public Action Timer_Disallow(Handle hTimer)
{
g_bStarted = true;
}