I wanted to made a countdown with use 3D text and I have a problem (Or function bug...)
Код:
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;
}
use textdraw's for this its easier and better or set the 3d texts position infront of the respective player and not 0,0,0 since the player can only see it if its near him and not near the center of the map (0,0,0)