setlevel
#1

PHP код:
CMD:setlevel(playerid,params[])
{
   if(
pInfo[playerid][pLevel] >= || IsPlayerAdmin(playerid))
   {
        new 
id,level,Jfile[100],year,month,day,hour,minute,second;
        if(
sscanf(params"ui"idlevel)) return
        
SendClientMessage(playerid0xFFFF00C8"Usage: /Setlevel <PlayerID> <Level>") ;
        if(
level 0) return SendClientMessage(playerid,red,"Invalid level(level must be greater than -1)");
        if(
IsPlayerConnected(id))
        {
           if(
level == pInfo[id][pLevel])
           return 
SendClientMessage(playerid,red,"Player is already in this level!");
           if(
level MaxAdminLevel)
           {
                   
format(Jstring,sizeof(Jstring),"Error: Maximum admin level is %d",MaxAdminLevel); return SendClientMessage(playerid,red,Jstring);
           }
           if(
pInfo[id][Logged] == 0) return SendClientMessage(playerid,red,"Error: This player is not loggedIn or not registered!");
           
CommandToAdmins(playerid,"setlevel");
           
getdate(yearmonthday);
           
gettime(hour,minute,second);
           
/*switch(level)
           {
              case 0: LevelName = "Player Status";
              case 1: LevelName = ADMIN_LEVEL_1;
              case 2: LevelName = ADMIN_LEVEL_2;
              case 3: LevelName = ADMIN_LEVEL_4;
              case 4: LevelName = ADMIN_LEVEL_3;
              case 5: LevelName = ADMIN_LEVEL_5;
              default: LevelName = ADMIN_LEVEL_6;
           }*/
           
format(Jstring,sizeof(Jstring),"You have given %s level: %d , Date: %d/%d/%d at %d:%d:%d",GetName(id), leveldaymonthyear ,hourminutesecond);
           
SendClientMessage(playerid,blue,Jstring);
           if(
levelpInfo[id][pLevel])
           {
               
format(Jstring,sizeof(Jstring),"Administrator %s has enabled for you admin feuture level: %d <Promoted on %d/%d/%d at %d:%d:%d>",GetName(playerid), level,daymonthyear,hourminutesecond),GameTextForPlayerEx(id,"~B~congratulations!~N~~G~Promoted"20003);
               
SendClientMessage(id,lighterblue,Jstring);
               
format(Jstring,sizeof(Jstring),"[PROMOTED] %s has changed %s's level from %d to %d",GetName(playerid),GetName(id),pInfo[id][pLevel], level);
               
WriteToLog(Jstring,"LevelChanges");
           }
           else
           {
           
format(Jstring,sizeof(Jstring),"Administrator %s has set you level: %d <Demoted on %d/%d/%d at %d:%d:%d>",GetName(playerid), level,daymonthyear,hourminutesecond),GameTextForPlayerEx(id,"~R~Demoted"20003);
           
SendClientMessage(id,red,Jstring);
           
format(Jstring,sizeof(Jstring),"[DEMOTED] %s has changed %s's level from %d to %d",GetName(playerid),GetName(id),pInfo[id][pLevel], level);
           
WriteToLog(Jstring,"LevelChanges");
           }
           
pInfo[id][pLevel] = level;
           
format(Jfile100ACCOUNTS_PATHGetName(id));
           new 
INI:ACCOUNT INI_Open(Jfile);
           
INI_WriteInt(ACCOUNT"Level"pInfo[id][pLevel]);
           
INI_Close(ACCOUNT);
           return 
1;
        }
        else return 
ShowMessage(playeridred2);
   }
   else return 
ShowMessage(playeridred1);

This CMD work but i need in this cmd if the player level 6 can set player level between 0-2 any level need level 9
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)