30.12.2012, 14:02
Hello,
I want to create admin system, when player buy admin, he can use it only one month. I tested it with SetTimer(); and it works. I have created all code, but I don't know how to create timer, that after one month remove player admin status, that even works when player is offline.
I want to create admin system, when player buy admin, he can use it only one month. I tested it with SetTimer(); and it works. I have created all code, but I don't know how to create timer, that after one month remove player admin status, that even works when player is offline.
PHP код:
forward admintime(playerid);
public OnGameModeInit()
{
SetTimer("admintime",60*1000,1);
}
forward admintime(playerid);
public admintime(playerid)
{
if(!playerDB[playerid][admin]){ return 1;}
if(playerDB[playerid][atime]==0){ return 1;}
playerDB[playerid][atime] --;
if(playerDB[playerid][atime]>=1){ return 1;}
SendClientMessage(playerid,YELLOW,"Your admin time has expired");
playerDB[playerid][adminlvl] = false;
playerDB[playerid][atime]=0;
new name[MAX_PLAYER_NAME],file[128];
GetPlayerName(playerid,name,sizeof(name));
format(file,sizeof(file),"saves/user/%s.ini",name);
dini_IntSet(file,"Adminlvl",playerDB[playerid][adminlvl]);
return 1;
}