Local Countdown
#1

Hi,

I tried to make a countdown only visible for players near the admin who start the /countdown command.

I made this script:

Код:
forward countdown(playerid);
public countdown(playerid)
{
    new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid,x,y,z);
    for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    if(IsPlayerInRangeOfPoint(i,7.0,x,y,z))
		{
			if(CountDown==6) GameTextForPlayer(playerid,"~p~Starting...",1000,6);
			CountDown--;
			if(CountDown==0)
			{
				//GameTextForPlayer(i,"~g~GO~ r~!",1000,6);
				CountDown = -1;
				GameTextForPlayer(i,"~g~GO~ r~!",1000,6);
				TogglePlayerControllable(i,true);
				PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
				return 0;
			}
			else
			{
				new text[7]; format(text,sizeof(text),"~w~%d",CountDown);
				GameTextForPlayer(i,text,1000,6);
				PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
				TogglePlayerControllable(i,false);
			 	//GameTextForPlayer(i,text,1000,6);
			}

			SetTimer("countdown",1000,0);
		}
	}
	return 0;
}
But the countdown is really buggy and only works for the player with ID 0 and the timer get fucked up sometimes.

Can somebody tell me what I'm doing wrong?

Thanks!
Reply


Messages In This Thread
Local Countdown - by [KMA]DlennartD - 01.08.2010, 01:08
Re: Local Countdown - by Kar - 01.08.2010, 01:13
Re: Local Countdown - by [KMA]DlennartD - 01.08.2010, 01:31
Re: Local Countdown - by Kar - 01.08.2010, 01:44
Re: Local Countdown - by Calgon - 01.08.2010, 01:45
Re: Local Countdown - by [KMA]DlennartD - 04.08.2010, 09:47
Re: Local Countdown - by Kar - 04.08.2010, 13:58
Re: Local Countdown - by [KMA]DlennartD - 04.08.2010, 20:34
Re: Local Countdown - by ikey07 - 04.08.2010, 20:36
Re: Local Countdown - by Finn - 04.08.2010, 22:31

Forum Jump:


Users browsing this thread: 1 Guest(s)