SA-MP Forums Archive
Why does .. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Why does .. (/showthread.php?tid=340434)



Why does .. - [D]ry[D]esert - 07.05.2012

Hello every one
I want Make when map start /Class command Enable for just frist 30 sec its work but It Spam sendClientMessage
Like this
Код:
/Class Timer is over
/Class Timer is over
/Class Timer is over
/Class Timer is over
/Class Timer is over
/Class Timer is over
i will show script
Код:
new CMDClass[MAX_PLAYERS];
new Timer;
Код:
public NextMap()
{
for(new i;i<MAX_PLAYERS;i++)
	{
		switch(Map[ID])
		{
			case 0://map 1
	    	{
	    		SetPlayerWeather(i,0);
				SetPlayerTime(i,13,0);
    			SetPlayerInterior(i,0);
   			 	Timer = SetTimer("dissablecmd",30000,false);
	    		TogglePlayerControllable(i, false);
				ResetPlayerWeapons(i);
				CMDClass[i] = 0;
				SetPlayerScore(i, GetPlayerScore(i)+40);
				gTeam[i] = TEAM_HUMANS;			}
}
}
}

                                             //and others cases
Код:
forward dissablecmd(playerid);
public dissablecmd(playerid)
{
KillTimer(Timer);
CMDClass[playerid] = 1;
SendClientMessageToAll(COLOR_LIGHTBLUE,"/class time is over");
print("/class time is over");
return 1;
}



Re: Why does .. - [D]ry[D]esert - 07.05.2012

i think its from for
Код:
for(new i;i<MAX_PLAYERS;i++)
do i have to make Swich ?
if yes then How :O ?


Re: Why does .. - Jonny5 - 07.05.2012

dont bump its against the rules!!

pawn Код:
forward dissablecmd(playerid);
public dissablecmd(playerid)
{
KillTimer(Timer);
CMDClass[playerid] = 1;
SendClientMessage(playerid,COLOR_LIGHTBLUE,"/class time is over");
print("/class time is over");
return 1;
}
try that

edit also you should be using SetTimerEx

pawn Код:
Timer = SetTimerEx("dissablecmd",30000,false,"i",i);



Re: Why does .. - [D]ry[D]esert - 07.05.2012

Quote:
Originally Posted by Jonny5
Посмотреть сообщение
dont bump its against the rules!!

pawn Код:
forward dissablecmd(playerid);
public dissablecmd(playerid)
{
KillTimer(Timer);
CMDClass[playerid] = 1;
SendClientMessage(playerid,COLOR_LIGHTBLUE,"/class time is over");
print("/class time is over");
return 1;
}
try that

edit also you should be using SetTimerEx

pawn Код:
Timer = SetTimerEx("dissablecmd",30000,false,"i",i);
No work :\