14.10.2009, 14:49
I wanted to made a countdown with use 3D text and I have a problem (Or function bug...)
My code:
The thing is I don't see any 3D text when I am using this command...
My code:
Код:
dcmd_cd(playerid, params[])
{
if(SData[IsCount] == true) return 1;
if(!strlen(params)) return SendClientMessage(playerid, white, "Use: /cd [time (1-50)]"), 1;
SData[CountTime] = strval(params);
if(SData[CountTime] > 50 || SData[CountTime] < 1 ) return SendClientMessage(playerid, white, "Use: /cd [time (1-50)]"), 1;
SData[TextTime] = SetTimerEx("OnModeCountDown", 1000, 1, "i", playerid);
SData[IsCount] = true;
return 1;
}
public OnModeCountDown(playerid)
{
new str[64];
if(SData[CountTime] <= 50 && SData[CountTime] >= 1)
{
format(str, 64, "Odliczanie: %i", SData[CountTime]);
Attach3DTextLabelToPlayer(SData[CountDown], playerid, 0.0, 0.0, 0.0);
Update3DTextLabelText(SData[CountDown], yellow, str);
SData[CountTime]--;
SoundForAll(1058);
return 1;
}
else if(SData[CountTime] == 0)
{
KillTimer(SData[TextTime]);
Update3DTextLabelText(SData[CountDown], green, "Go ! Go ! Go !");
for(new i, j = GetMaxPlayers(); i < j; i++) TogglePlayerControllable(i, 1);
SetTimer("OnModeHideCountDown", 3000, 0);
SoundForAll(1056);
SData[IsCount] = false;
}
return 1;
}
public OnModeHideCountDown()
{
Attach3DTextLabelToPlayer(SData[CountDown], 199, 0, 0, 0);
return 1;
}


It works !