setlevel
#1

I want the admins only can set level 1 and from level 3 to level 10 and can't set level 2

PHP код:
CMD:setlevel(playeridparams[])
{
    new 
lookupidstr[128], level;
    if(
pData[playerid][Admin] >= || IsPlayerAdmin(playerid))
    {
        if(
sscanf(params,"ud",lookupid,level)) return SendClientMessage(playeridCOLOR_YELLOW"Usage: /setlevel (UserID | UserName) (level)");
        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 == 1) return SendClientMessage(playeridred"ERROR: Invalid Level [Levels 3 to 10 or 1]"); // 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",GetName(playerid), playerid,GetName(lookupid),lookupid,level);
            
IRC_GroupSay(groupIDIRC_CHANNELirc);
            
format(strsizeof(str), "Admin %s (ID:%d) has demoted you to level %d",GetName(playerid), playeridlevel);
            
SendClientMessage(lookupid0xFF0000FFstr);
            
format(strsizeof(str),"You have demoted %s (ID:%d) to level %d",GetName(lookupid),lookupid,level);
            
SendClientMessage(playerid, -1str);
        }
        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), "Admin %s (ID:%d) has granted level %d to you",GetName(playerid), playeridlevel);
            
SendClientMessage(lookupidCOLOR_YELLOWstr);
            
format(strsizeof(str),"You have setted %s (ID:%d) to level %d",GetName(lookupid),lookupid,level);
            
SendClientMessage(playeridCOLOR_YELLOWstr);
        }
        
pData[lookupid][Admin] = level;
        
printf("Setted level %d",level);
        
SavePlayerData(playerid);
    }
    else return 
SendClientMessage(playeridCOLOR_YELLOW"Only +level 9 can use this command");
    return 
1;

Reply
#2

PHP код:
CMD:setlevel(playeridparams[])
{
    new 
lookupidstr[128], level;
    if(
pData[playerid][Admin] >= || IsPlayerAdmin(playerid))
    {
        if(
sscanf(params,"ud",lookupid,level)) return SendClientMessage(playeridCOLOR_YELLOW"Usage: /setlevel (UserID | UserName) (level)");
        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 >= && level <= 10) return SendClientMessage(playeridred"ERROR: Invalid Level [Levels 3 to 10 or 1]"); // 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",GetName(playerid), playerid,GetName(lookupid),lookupid,level);
            
IRC_GroupSay(groupIDIRC_CHANNELirc);
            
format(strsizeof(str), "Admin %s (ID:%d) has demoted you to level %d",GetName(playerid), playeridlevel);
            
SendClientMessage(lookupid0xFF0000FFstr);
            
format(strsizeof(str),"You have demoted %s (ID:%d) to level %d",GetName(lookupid),lookupid,level);
            
SendClientMessage(playerid, -1str);
        }
        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), "Admin %s (ID:%d) has granted level %d to you",GetName(playerid), playeridlevel);
            
SendClientMessage(lookupidCOLOR_YELLOWstr);
            
format(strsizeof(str),"You have setted %s (ID:%d) to level %d",GetName(lookupid),lookupid,level);
            
SendClientMessage(playeridCOLOR_YELLOWstr);
        }
        
pData[lookupid][Admin] = level;
        
printf("Setted level %d",level);
        
SavePlayerData(playerid);
    }
    else return 
SendClientMessage(playeridCOLOR_YELLOW"Only +level 9 can use this command");
    return 
1;

I'm not so sure about this
Reply
#3

Quote:
Originally Posted by NealPeteros
Посмотреть сообщение
PHP код:
CMD:setlevel(playeridparams[])
{
    new 
lookupidstr[128], level;
    if(
pData[playerid][Admin] >= || IsPlayerAdmin(playerid))
    {
        if(
sscanf(params,"ud",lookupid,level)) return SendClientMessage(playeridCOLOR_YELLOW"Usage: /setlevel (UserID | UserName) (level)");
        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 >= && level <= 10) return SendClientMessage(playeridred"ERROR: Invalid Level [Levels 3 to 10 or 1]"); // 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",GetName(playerid), playerid,GetName(lookupid),lookupid,level);
            
IRC_GroupSay(groupIDIRC_CHANNELirc);
            
format(strsizeof(str), "Admin %s (ID:%d) has demoted you to level %d",GetName(playerid), playeridlevel);
            
SendClientMessage(lookupid0xFF0000FFstr);
            
format(strsizeof(str),"You have demoted %s (ID:%d) to level %d",GetName(lookupid),lookupid,level);
            
SendClientMessage(playerid, -1str);
        }
        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), "Admin %s (ID:%d) has granted level %d to you",GetName(playerid), playeridlevel);
            
SendClientMessage(lookupidCOLOR_YELLOWstr);
            
format(strsizeof(str),"You have setted %s (ID:%d) to level %d",GetName(lookupid),lookupid,level);
            
SendClientMessage(playeridCOLOR_YELLOWstr);
        }
        
pData[lookupid][Admin] = level;
        
printf("Setted level %d",level);
        
SavePlayerData(playerid);
    }
    else return 
SendClientMessage(playeridCOLOR_YELLOW"Only +level 9 can use this command");
    return 
1;

I'm not so sure about this
The admin now can set level 2 and 0 only

I need the admin to set all levels except level 2 and 0
Reply
#4

PHP код:
CMD:setlevel(playeridparams[])
{
    new 
lookupidstr[128], level;
    if(
pData[playerid][Admin] >= || IsPlayerAdmin(playerid))
    {
        if(
sscanf(params,"ud",lookupid,level)) return SendClientMessage(playeridCOLOR_YELLOW"Usage: /setlevel (UserID | UserName) (level)");
        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 == 0) return SendClientMessage(playeridred"ERROR: Invalid Level [Levels 3 to 10 or 1]"); // 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",GetName(playerid), playerid,GetName(lookupid),lookupid,level);
            
IRC_GroupSay(groupIDIRC_CHANNELirc);
            
format(strsizeof(str), "Admin %s (ID:%d) has demoted you to level %d",GetName(playerid), playeridlevel);
            
SendClientMessage(lookupid0xFF0000FFstr);
            
format(strsizeof(str),"You have demoted %s (ID:%d) to level %d",GetName(lookupid),lookupid,level);
            
SendClientMessage(playerid, -1str);
        }
        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), "Admin %s (ID:%d) has granted level %d to you",GetName(playerid), playeridlevel);
            
SendClientMessage(lookupidCOLOR_YELLOWstr);
            
format(strsizeof(str),"You have setted %s (ID:%d) to level %d",GetName(lookupid),lookupid,level);
            
SendClientMessage(playeridCOLOR_YELLOWstr);
        }
        
pData[lookupid][Admin] = level;
        
printf("Setted level %d",level);
        
SavePlayerData(playerid);
    }
    else return 
SendClientMessage(playeridCOLOR_YELLOW"Only +level 9 can use this command");
    return 
1;

Reply
#5

PHP код:
if(level || level == || level 10)return... 
Reply
#6

Quote:
Originally Posted by GangstaSunny.
Посмотреть сообщение
PHP код:
if(level || level == || level 10)return... 
I need the admins can set players level 1 and level 3 to 10 and i want to disable level 0 and 2
Reply
#7

Quote:
Originally Posted by Loinal
Посмотреть сообщение
I need the admins can set players level 1 and level 3 to 10 and i want to disable level 0 and 2
The code that GanstaSunny posted it's exactly you said

If level is < 1 means 0,-1,-2,....,-infinite or
If level == 2 means it's equal to 2 or
If level > 10 means it's bigger than 10
If one of this condition it's true, then return a SendClientMessage that's say "You can set admin level smaller than 1, equal to 2 , or greater than 10"

Код:
if(level < 1 || level == 2 || level > 10)return SendClientMessage(playerid,-1, "You can set admin level smaller than 1, equal to 2 , or greater than 10");
Reply
#8

Quote:
Originally Posted by Banditul18
Посмотреть сообщение
The code that GanstaSunny posted it's exactly you said

If level is < 1 means 0,-1,-2,....,-infinite or
If level == 2 means it's equal to 2 or
If level > 10 means it's bigger than 10
If one of this condition it's true, then return a SendClientMessage that's say "You can set admin level smaller than 1, equal to 2 , or greater than 10"

Код:
if(level < 1 || level == 2 || level > 10)return SendClientMessage(playerid,-1, "You can set admin level smaller than 1, equal to 2 , or greater than 10");
I want to set level 1 only and 3,4,5,6,7,8,9,10 and when i try to set level 0 or 2 the server tell me You can only set level 1 or 3,4,5 etc
Reply
#9

Код:
CMD:setlevel(playerid, params[])
{
    new lookupid, str[128], level;
    if(pData[playerid][Admin] >= 9 || IsPlayerAdmin(playerid))
    {
        if(sscanf(params,"ud",lookupid,level)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /setlevel (UserID | UserName) (level)");
        if(pData[lookupid][Admin] > pData[playerid][Admin]) return SendClientMessage(playerid, -1, "Sorry you cant setlevel becoz his level is higher then you");
        if(level == 2 || level > 10 || level < 1 || level == 0) return SendClientMessage(playerid, red, "ERROR: Invalid Level [Levels 3 to 10 or 1]"); // 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",GetName(playerid), playerid,GetName(lookupid),lookupid,level);
            IRC_GroupSay(groupID, IRC_CHANNEL, irc);
            format(str, sizeof(str), "Admin %s (ID:%d) has demoted you to level %d",GetName(playerid), playerid, level);
            SendClientMessage(lookupid, 0xFF0000FF, str);
            format(str, sizeof(str),"You have demoted %s (ID:%d) to level %d",GetName(lookupid),lookupid,level);
            SendClientMessage(playerid, -1, str);
        }
        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), playerid, level,GetName(lookupid),lookupid);
            IRC_GroupSay(groupID, IRC_CHANNEL, irc);
            format(str, sizeof(str), "Admin %s (ID:%d) has granted level %d to you",GetName(playerid), playerid, level);
            SendClientMessage(lookupid, COLOR_YELLOW, str);
            format(str, sizeof(str),"You have setted %s (ID:%d) to level %d",GetName(lookupid),lookupid,level);
            SendClientMessage(playerid, COLOR_YELLOW, str);
        }
        pData[lookupid][Admin] = level;
        printf("Setted level %d",level);
        SavePlayerData(playerid);
    }
    else return SendClientMessage(playerid, COLOR_YELLOW, "Only +level 9 can use this command");
    return 1;
}
Reply
#10

Quote:
Originally Posted by Sunehildeep
Посмотреть сообщение
Код:
CMD:setlevel(playerid, params[])
{
    new lookupid, str[128], level;
    if(pData[playerid][Admin] >= 9 || IsPlayerAdmin(playerid))
    {
        if(sscanf(params,"ud",lookupid,level)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /setlevel (UserID | UserName) (level)");
        if(pData[lookupid][Admin] > pData[playerid][Admin]) return SendClientMessage(playerid, -1, "Sorry you cant setlevel becoz his level is higher then you");
        if(level == 2 || level > 10 || level < 1 || level == 0) return SendClientMessage(playerid, red, "ERROR: Invalid Level [Levels 3 to 10 or 1]"); // 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",GetName(playerid), playerid,GetName(lookupid),lookupid,level);
            IRC_GroupSay(groupID, IRC_CHANNEL, irc);
            format(str, sizeof(str), "Admin %s (ID:%d) has demoted you to level %d",GetName(playerid), playerid, level);
            SendClientMessage(lookupid, 0xFF0000FF, str);
            format(str, sizeof(str),"You have demoted %s (ID:%d) to level %d",GetName(lookupid),lookupid,level);
            SendClientMessage(playerid, -1, str);
        }
        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), playerid, level,GetName(lookupid),lookupid);
            IRC_GroupSay(groupID, IRC_CHANNEL, irc);
            format(str, sizeof(str), "Admin %s (ID:%d) has granted level %d to you",GetName(playerid), playerid, level);
            SendClientMessage(lookupid, COLOR_YELLOW, str);
            format(str, sizeof(str),"You have setted %s (ID:%d) to level %d",GetName(lookupid),lookupid,level);
            SendClientMessage(playerid, COLOR_YELLOW, str);
        }
        pData[lookupid][Admin] = level;
        printf("Setted level %d",level);
        SavePlayerData(playerid);
    }
    else return SendClientMessage(playerid, COLOR_YELLOW, "Only +level 9 can use this command");
    return 1;
}
I don't want level 2 or level 0 ONLY LEVEL 1 AND 3 ,4,5,6,7,8,9,10 ONLY 1,3,4,5,6,7,8,9,10 AND NOT LEVEL 2 AND NOT LEVEL 0
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)