Freeze everyone for 5 minutes before game starts?
#1

ok, i made these functions to freeze the game till 5 minutes then the round starts. but it spams the message and crash's the server. Any idea how i would get it to wait 5 minutes then the game start?
Код:
forward Freeze(playerid);
public Freeze(playerid)
{
	for(new i = 0;i < MAX_PLAYERS;i++)
	{
	TogglePlayerControllable(i,false);
	SendClientMessage(playerid,COLOR_PURPLE,"Round has not started yet! 5 minutes remaining");
	SetTimer("UnFreeze",60000,false);
	}
}
forward UnFreeze(playerid);
public UnFreeze(playerid)
{
	for(new i = 0;i < MAX_PLAYERS;i++)
	{
 	KillTimer(RoundTimer);
	TogglePlayerControllable(i,true);
	SendClientMessage(playerid,COLOR_PURPLE,"Round Started!");
	}
}
Reply
#2

try this

Код:
forward Freeze(playerid);
public Freeze(playerid)
{
	for(new i = 0;i < MAX_PLAYERS;i++)
	{
    If(!IsPlayerConnected(i))continue;
	TogglePlayerControllable(i,false);
	SendClientMessage(i,COLOR_PURPLE,"Round has not started yet! 5 minutes remaining");
	SetTimer("UnFreeze",60000,false);
	}
}
forward UnFreeze(playerid);
public UnFreeze(playerid)
{
	for(new i = 0;i < MAX_PLAYERS;i++)
	{
    If(!IsPlayerConnected(i))continue;
 	KillTimer(RoundTimer);
	TogglePlayerControllable(i,true);
	SendClientMessage(i,COLOR_PURPLE,"Round Started!");
	}
}
Reply
#3

and you dont really need to kill the timer as it is not repeating
Reply
#4

They still repeat. keeps saying ROUND STARTED! and stoped ur player every few seconds. and.. no double posting.
Reply
#5

where are you starting RoundTimer the one you kill coz you start another in the function
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)