PDA

View Full Version : setlevel


Loinal
13/04/2017, 09:59 AM
I want the admins only can set level 1 and from level 3 to level 10 and can't set level 2

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 < 3 || level > 10 || level == 1) 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;
}

NealPeteros
13/04/2017, 10:15 AM
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 == 1 || level >= 3 && level <= 10) 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'm not so sure about this

Loinal
13/04/2017, 10:19 AM
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 == 1 || level >= 3 && level <= 10) 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'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

StrikerZ
13/04/2017, 10:27 AM
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 == 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;
}

GangstaSunny.
13/04/2017, 10:28 AM
if(level < 1 || level == 2 || level > 10)return...

Loinal
13/04/2017, 10:34 AM
if(level < 1 || level == 2 || 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

Banditul18
13/04/2017, 10:41 AM
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");

Loinal
13/04/2017, 10:46 AM
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

StrikerZ
13/04/2017, 10:49 AM
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;
}

Loinal
13/04/2017, 10:53 AM
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

DarkSkull
13/04/2017, 10:59 AM
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

Do you know scripting? Have you tried that code. That code disables all the level below 1, Then it disables level 0, then it disables level 2 and disables all the level above 10

Banditul18
13/04/2017, 10:59 AM
You not even try the the codes as far i can see , well then i think you need to make it yourself.
I don't want to be mean, but it's the only posibility to make setlevel for level 1,3,....10

DarkSkull
13/04/2017, 11:01 AM
if(level == 2 || level > 10 || level < 1) return SendClientMessage(playerid, red, "You can only set level 1 or 3,4,5, 6, 7, 8, 9 ,10");

This code will block level 2, Any level above 10, And Any level below one that include 0.

Loinal
13/04/2017, 11:05 AM
Thanks it work, And sorry i was thinking

That part that i type the levels that i need to work not to block :)
if(level == 2 || level > 10 || level < 1)