24.07.2017, 08:29
Greedings,again me and i have got again problem...I made jail system on minutes...but i dont know how to save it,how many minutes remaining...Please help me how to make it...
There is a code..
//command
//public
Thank you for helping me.
There is a code..
//command
PHP код:
CMD:jail(playerid,params[])
{
new id,dovod[225],minuty,string[128];
if(AdminLevel[playerid] < 2)return SendClientMessage(playerid,COLOR_RED,"[!] {FFFFFF}Nemбљ oprбvnenie na tento prнkaz");
if(sscanf(params,"uis[225]",id,minuty,dovod))return SendClientMessage(playerid,COLOR_RED,"[!] {FFFFFF}Musнљ zadat /jail [ID] [Cas v minutбch] [Dфvod]");
if(jail[id] > 0)return SendClientMessage(playerid,COLOR_RED,"[!] {FFFFFF}Tento hrбc uћ je vo vдzenн");
format(string,sizeof(string),"%s{FF3300}%s(ID:%d) ťa dal do vдzenia na %i minъt [Dфvod: %s]",GetPlayerAdminTitle(playerid),Meno(playerid),playerid,minuty,dovod);
SendClientMessage(id,COLOR_RED,string);
jail[id] = gettime() + 60*minuty;
PlayerTextDrawShow(playerid,VazenieTimer[playerid][0]);
PlayerTextDrawShow(playerid,VazenieTimer[playerid][1]);
SetPlayerInterior(id,3);
SetPlayerPos(id,198.3796, 160.8905, 1003.03);
vazenietimer[id] = SetTimerEx("vazenie",1000,true,"i",id);
return 1;
}
PHP код:
public vazenie(playerid)
{
if(jail[playerid] > gettime())
{
new string[128];
format(string,sizeof(string),"%s",TimeConvert(jail[playerid] - gettime()));
PlayerTextDrawSetString(playerid,VazenieTimer[playerid][0],string);
}
else
{
SendClientMessage(playerid,COLOR_RED,"Odpykal si si trest");
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,1109.2490,-1796.0345,16.5938);
KillTimer(vazenietimer[playerid]);
PlayerTextDrawHide(playerid,VazenieTimer[playerid][0]);
PlayerTextDrawHide(playerid,VazenieTimer[playerid][1]);
}
return 1;
}