Temp level
#1

How can i save that?

PHP код:
CMD:settemplevel(playeridparams[])
{
    new 
lookupidstr[128], level,days;
    if(
pData[playerid][Admin] >= || IsPlayerAdmin(playerid))
    {
        if(
sscanf(params,"udd",lookupid,level,days)) return SendClientMessage(playeridCOLOR_YELLOW"Usage: /setlevel (UserID | UserName) (level) (days)");
        if(
pData[lookupid][Admin] > pData[playerid][Admin]) return SendClientMessage(playerid, -1"Sorry you cant setlevel becoz his level is higher then you");
        if(
level == || level 10 || level == 0) return SendClientMessage(playeridred"ERROR: Invalid Level [Levels 3 to 10]"); // you can change this to any level you want
        
if(!IsPlayerConnected(lookupid)) return SendClientMessage(playerid,0xFF0000FF"Sorry this player isnt connected ");
        if(
level pData[lookupid][Admin])
        {
            new 
irc[130];
            
format(irc,sizeof(str),"8,3* Admin %s (ID: %d) Demoted %s (ID: %d) to level %d for %d days",GetName(playerid), playerid,GetName(lookupid),lookupid,level,days);
            
IRC_GroupSay(groupIDIRC_CHANNELirc);
            
format(strsizeof(str), "Admin %s (ID:%d) has temp demoted you to level %d for %d days",GetName(playerid), playeridleveldays);
            
SendClientMessage(lookupid0xFF0000FFstr);
            
format(strsizeof(str),"You have demoted %s (ID:%d) to level %d",GetName(lookupid),lookupid,level);
            
SendClientMessage(playerid, -1str);
            
ta[lookupid] = gettime() + days*86400;
            
pData[lookupid][Admin] = level;
            if(
pData[lookupid][Admin] == 1)
            {
            
onlineadmins--;
            new 
strings[100+1000];
            
format(stringssizeof(strings), "Online Admins: %d",onlineadmins);
            
TextDrawSetString(oastrings);
            
TextDrawShowForPlayer(playeridoa);
            }
        }
        if(
level pData[lookupid][Admin])
        {
            new 
irc[130];
            
format(irc,sizeof(str),"8,3* Admin %s (ID: %d) granted level %d to %s (ID: %d)",GetName(playerid), playeridlevel,GetName(lookupid),lookupid);
            
IRC_GroupSay(groupIDIRC_CHANNELirc);
            
format(strsizeof(str), "* You have been granted permanent Admin Level %d by %s (ID: %d)",levelGetName(playerid), playerid);
            
SendClientMessage(lookupidCOLOR_GREENstr);
            
ta[lookupid] = gettime() + days*86400;
            ForEach(
iMAX_PLAYERS)
            {
                if(
pData[i][Admin] >= 3)
                {
                  
format(str,sizeof(str),"* Admin %s (ID: %d) granted permanent Admin level %d to %s (ID: %d)",GetName(playerid),playerid,level,GetName(lookupid),lookupid);
                  
SendClientMessage(i0x00FFC1FFstr);                   
                }
            }
            
format(strsizeof(str),"You have setted %s (ID:%d) to level %d",GetName(lookupid),lookupid,level);
            
SendClientMessage(playeridCOLOR_YELLOWstr);
            if(
level >= 3)
            {
            if(
pData[lookupid][Admin] < 3){onlineadmins++;}//If not already an admin count ++
            
pData[lookupid][Admin] = level;//now set the level
            
new strings[100+1000];
            
format(stringssizeof(strings), "Online Admins: %d",onlineadmins);
            
TextDrawSetString(oastrings);
            
TextDrawShowForPlayer(playeridoa);
            }
        }
        
printf("Setted level %d",level);
        
SavePlayerData(playerid);
    }
    else return 
SendClientMessage(playeridCOLOR_YELLOW"Only +level 9 can use this command");
    return 
1;

PHP код:
//OnPlayerConnect
if(ta[playerid] >= gettime())
    {
        
SendClientMessage(playerid,COLOR_GREEN"Your Admin level is not expired");
    }
    else
    {
        
SendClientMessage(playerid,COLOR_GREEN,"Your level is expired");
    } 
And its written wrong?
Reply
#2

saved what? instead of data you already have the save function? "SavePlayerData(playerid);"
Reply
#3

I mean save the temp level
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)