I need help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: I need help (
/showthread.php?tid=403460)
I need help -
appleomax - 30.12.2012
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;
}
Re: I need help -
Windrush - 30.12.2012
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;
}
Re: I need help -
appleomax - 30.12.2012
This code will work when player offline?
Re: I need help -
appleomax - 30.12.2012
I still need help