I did not test it, but it should work.
I changed your logic actually, I'm sorry if it is a bit difficult for you.
Also I prefer new syntax, it is more familiar to me, because it is closer to 'C' syntax
Feel free to ask questions
PHP Code:
#include <sourcemod>
//#include <sdktools>
public Plugin myinfo =
{
name = "Warmup Waiting",
author = "Reid",
description = "Simple plugin for waiting other player's connecting by restricting movement",
version = "0.0.1",
url = ""
};
public void OnMapStart()
{
//new GetWarmUpTime = GetConVarInt(FindConVar("mp_warmuptime"));
//CreateTimer(GetWarmUpTime*1.0,WarmUpOver); //let GetWarmUpTime be float and set WarmUpOver callback
float GetWarmUpTime = (FindConVar("mp_warmuptime")).FloatValue;
if(GetWarmUpTime > 0.0)
{
HookEvent("player_spawn", OnPlayerSpawn, EventHookMode_Post);
CreateTimer(GetWarmUpTime,WarmUpOver);
}
}
public void OnPlayerSpawn(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));
if(IsClientInGame(client) && IsPlayerAlive(client))
{
SetEntityMoveType(client, MOVETYPE_NONE);
}
PrintCenterText(client, "Please wait for other players connect");
PrintToChat(client, "Please wait for other players connect.");
}
public Action WarmUpOver(Handle timer)
{
UnhookEvent("player_spawn", OnPlayerSpawn, EventHookMode_Post); //We don't need it anymore, so unhook.
for(int i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i) && IsPlayerAlive(i))
{
SetEntityMoveType(i, MOVETYPE_WALK);
}
}
PrintCenterTextAll("Game is going to start!");
PrintToChatAll("Game is going to start!");
}