17.07.2017, 20:52
PHP код:
new moneyTimer[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
for(new i = 0; i < 3; i++)
{
PlayerTextDrawShow(playerid,TDEditor_PTD[playerid][i]);
}
moneyTimer[playerid] = SetTimerEx("MoneyUpdater", 1000, true, "i", playerid);
return 1;
}
PHP код:
public OnPlayerDisconnect(playerid)
{
KillTimer(moneyTimer[playerid]);
return 1;
}
You need to use SetTimerEx to have a way to use the playerid inside the function.
https://sampwiki.blast.hk/wiki/SetTimerEx
https://sampwiki.blast.hk/wiki/SetTimer
Specifically what you should learn about.
PHP код:
public MoneyUpdater(playerid)
{
new
string[60];
format(string, sizeof(string), "%.2f", Peniaze[playerid]);
PlayerTextDrawSetString(playerid, TDEditor_PTD[playerid][1], string);
return 1;
}