DeanMrz
Умник
Как обновлять информацию в открытом текстдраве,
допустим у меня текстдрав телефона и в нём время, я сделал таймер, но текстдрав не обновляется
допустим у меня текстдрав телефона и в нём время, я сделал таймер, но текстдрав не обновляется
PHP:
cmd:phone(playerid)
{
if(mobile[playerid] == 0)
{
mobile[playerid] = 1;
SelectTextDraw(playerid, 0xB0C4DEFF);
new montht[21], year, month, day, newhour, newminute, newsecond;
getdate(year, month, day);
gettime(newhour, newminute, newsecond);
switch(month)
{
case 1: montht = "January";
case 2: montht = "February";
case 3: montht = "March";
case 4: montht = "April";
case 5: montht = "Maya";
case 6: montht = "June";
case 7: montht = "July";
case 8: montht = "August";
case 9: montht = "Sentebrya";
case 10: montht = "October";
case 11: montht = "November";
case 12: montht = "December";
}
new string[25];
format(string, sizeof(string), "_%d:%d", newhour, newminute);
TextDrawSetString(phone_TD[33], string);
format(string, sizeof(string), "%d_%s", day, montht);
TextDrawSetString(phone_TD[34], string);
format(string, sizeof(string), "%d", year);
TextDrawSetString(phone_TD[35], string);
for(new i; i < 50; i ++) TextDrawShowForPlayer(playerid, phone_TD[i]);
phone_timer[playerid] = SetTimerEx("UpdatePhone", 1000, 1, "i", playerid);
}
else
{
mobile[playerid] = 0;
CancelSelectTextDraw(playerid);
for(new i; i < 50; i ++) TextDrawHideForPlayer(playerid, phone_TD[i]);
if(phone_timer[playerid] != -1)KillTimer(phone_timer[playerid]);
}
return 1;
}
PHP:
function UpdatePhone(playerid)
{
if(mobile[playerid] == 1)
{
new newhour, newminute, newsecond;
gettime(newhour, newminute, newsecond);
new string[25];
format(string, sizeof(string), "_%d:%d", newhour, newminute);
TextDrawSetString(phone_TD[33], string);
TextDrawShowForPlayer(playerid, phone_TD[12]);
TextDrawHideForPlayer(playerid, phone_TD[12]);
}
if(vizov[playerid] == 1)
{
new newhour, newminute, newsecond;
gettime(newhour, newminute, newsecond);
new string[25];
format(string, sizeof(string), "_%d:%d", newhour, newminute);
TextDrawSetString(phone3_TD[13], string);
TextDrawShowForPlayer(playerid, phone3_TD[13]);
TextDrawHideForPlayer(playerid, phone3_TD[13]);
}
return 1;
}
