Timer -
Micko123 - 01.11.2016
"Brain stopped working...
Check the log for more info"
Well I need your help guys.
I have textdraw
PHP код:
TimerTD[playerid][0] = CreatePlayerTextDraw(playerid, 526.000305, 246.746658, "Time_left:");
PlayerTextDrawLetterSize(playerid, TimerTD[playerid][0], 0.294666, 1.490489);
PlayerTextDrawTextSize(playerid, TimerTD[playerid][0], 647.000000, 0.000000);
PlayerTextDrawAlignment(playerid, TimerTD[playerid][0], 1);
PlayerTextDrawColor(playerid, TimerTD[playerid][0], -1);
PlayerTextDrawUseBox(playerid, TimerTD[playerid][0], 1);
PlayerTextDrawBoxColor(playerid, TimerTD[playerid][0], 255);
PlayerTextDrawSetShadow(playerid, TimerTD[playerid][0], 0);
PlayerTextDrawSetOutline(playerid, TimerTD[playerid][0], 0);
PlayerTextDrawBackgroundColor(playerid, TimerTD[playerid][0], 255);
PlayerTextDrawFont(playerid, TimerTD[playerid][0], 2);
PlayerTextDrawSetProportional(playerid, TimerTD[playerid][0], 1);
PlayerTextDrawSetShadow(playerid, TimerTD[playerid][0], 0);
TimerTD[playerid][1] = CreatePlayerTextDraw(playerid, 592.222290, 246.746673, "100_sec");
PlayerTextDrawLetterSize(playerid, TimerTD[playerid][1], 0.294666, 1.490489);
PlayerTextDrawAlignment(playerid, TimerTD[playerid][1], 1);
PlayerTextDrawColor(playerid, TimerTD[playerid][1], -1);
PlayerTextDrawSetShadow(playerid, TimerTD[playerid][1], 0);
PlayerTextDrawSetOutline(playerid, TimerTD[playerid][1], 0);
PlayerTextDrawBackgroundColor(playerid, TimerTD[playerid][1], 255);
PlayerTextDrawFont(playerid, TimerTD[playerid][1], 2);
PlayerTextDrawSetProportional(playerid, TimerTD[playerid][1], 1);
PlayerTextDrawSetShadow(playerid, TimerTD[playerid][1], 0);
I need help on how to make these 100 sec go down? Like 99, 98, 97...
I have no idea now... I am confused..
I know I need to use timer
SetTimer("Timer", 1000, true);
but problem is that I don't know what to do here
PHP код:
forward Timer(playerid);
public Timer(playerid)
{
return 1;
}
Any ideas??
Re: Timer -
StrikerZ - 01.11.2016
PHP код:
SetTimerEx("Timer",1000, false, "ii", playerid, 100);
PHP код:
forward Timer(playerid, time);
public Timer(playerid, time)
{
if(time != 0)
{
new string[5];
format(string, sizeof(string), "%d", time);
GameTextForPlayer(playerid, string, 1000, 5);
SetTimerEx("Timer", 1000, false, "ii", playerid, time-1);
}
else
{
GameTextForPlayer(playerid, "~g~GO!", 2500, 3); // or replace with anything else
}
return true;
}
Re: Timer -
Micko123 - 01.11.2016
EDIT: Still not fixed... DAMN!
Re: Timer -
StrikerZ - 01.11.2016
EDIT:It should work :/
Re: Timer -
Micko123 - 01.11.2016
Sorry for this but
BUMP!
Re: Timer -
Logic_ - 01.11.2016
You're creating the player textdraws in the wrong way.
PHP код:
// Top
new time[MAX_PLAYERS], TimerTD_0, TimerTD_1;
// Somewhere
time[playerid] = 100;
// OnPlayerConnect
TimerTD_0 = CreatePlayerTextDraw(playerid, 526.000305, 246.746658, "Time_left:");
PlayerTextDrawLetterSize(playerid, TimerTD_0, 0.294666, 1.490489);
PlayerTextDrawTextSize(playerid, TimerTD_0, 647.000000, 0.000000);
PlayerTextDrawAlignment(playerid, TimerTD_0, 1);
PlayerTextDrawColor(playerid, TimerTD_0, -1);
PlayerTextDrawUseBox(playerid, TimerTD_0, 1);
PlayerTextDrawBoxColor(playerid, TimerTD_0, 255);
PlayerTextDrawSetShadow(playerid, TimerTD_0, 0);
PlayerTextDrawSetOutline(playerid, TimerTD_0, 0);
PlayerTextDrawBackgroundColor(playerid, TimerTD_0, 255);
PlayerTextDrawFont(playerid, TimerTD_0, 2);
PlayerTextDrawSetProportional(playerid, TimerTD_0, 1);
PlayerTextDrawSetShadow(playerid, TimerTD_0, 0);
TimerTD_1 = CreatePlayerTextDraw(playerid, 592.222290, 246.746673, "100_sec");
PlayerTextDrawLetterSize(playerid, TimerTD_1, 0.294666, 1.490489);
PlayerTextDrawAlignment(playerid, TimerTD_1, 1);
PlayerTextDrawColor(playerid, TimerTD_1, -1);
PlayerTextDrawSetShadow(playerid, TimerTD_1, 0);
PlayerTextDrawSetOutline(playerid, TimerTD_1, 0);
PlayerTextDrawBackgroundColor(playerid, TimerTD_1, 255);
PlayerTextDrawFont(playerid, TimerTD_1, 2);
PlayerTextDrawSetProportional(playerid, TimerTD_1, 1);
PlayerTextDrawSetShadow(playerid, TimerTD_1, 0);
// OnPlayerDisconnect
PlayerTextDrawDestroy(playerid, TimerTD_0);
PlayerTextDrawDestroy(playerid, TimerTD_1);
// Somewhere
forward Timer(playerid);
public Timer(playerid)
{
if(time >= 1)
{
time -= 1;
new string[10];
format(string, sizeof(string), "%d", time);
PlayerTextDrawSetString(playerid, TimerTD_1, string);
SetTimerEx("Timer", 1000, false, "ii", playerid);
}
else
{
time = 0;
}
return true;
}
Re: Timer -
Micko123 - 01.11.2016
You gave me an idea.. Hold on.
EDIT: DOne thank you