I need help
#1

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.

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;

Reply
#2

pawn Код:
forward admintime(playerid);
public OnGameModeInit()
{
return 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]);
 SetTimer("admintime",60*1000,1);
 return 1;
}
Reply
#3

This code will work when player offline?
Reply
#4

I still need help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)