Quote:
Originally Posted by (SF)Noobanatior
how is this
pawn Код:
forward Go(playerid); new GoTimer[MAX_PLAYERS],GoTCount,GTStr[10]; public Go(playerid){ switch(GoTCount){ case 0:{ GTStr = "~g~GO!!"; KillTimer(GoTimer[playerid]); GoTimer[playerid] = 0; } default:format(GTStr,sizeof(GTStr),"~r~%d",g); } GameTextForAll(GTStr,3000,4); SoundForAll(1056); GoTCount--; return 1; }
// up to go
COMMAND:countdown(playerid, params[]) { if(Countdown == 1) return SendClientMessage(playerid, Red, "countdown already on"); SendClientMessage(playerid, Green, "count started"); GoTimer[playerid] = SetTimer("Go",4000,1,"i",playerid); Countdown = 1; GoTCount = 5; return 1; }
|
Timer and countdown variables? SIMPLIFICATION FAIL.
pawn Код:
forward Go();
new GoTCount, GTStr[10];
public Go(){
switch(GoTCount){
case 0: GTStr = "~g~GO!!";
default:format(GTStr,sizeof(GTStr),"~r~%d",GoTCount);
}
GameTextForAll(GTStr,1500,4);
SoundForAll(1056);
if(GoTCount > 0)
{
GoTCount--;
SetTimer("Go",1000,0);
}
return 1;
}
// up to go
COMMAND:countdown(playerid, params[])
{
if(GoTCount != 0) return SendClientMessage(playerid, Red, "countdown already on");
SendClientMessage(playerid, Green, "count started");
SetTimer("Go",1000,0);
GoTCount = 5;
return 1;
}