SA-MP Forums Archive
How to make this command unable to use for certain levels - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to make this command unable to use for certain levels (/showthread.php?tid=138752)



How to make this command unable to use for certain levels - Krozz - 02.04.2010

I have a question here How do I make it so it wont let multiple levels not able to use the cmd using dcmd because right now it lets all levels able to setadmin.Heres code

dcmd_setadmin(playerid, params[])
{
if(pInfo[playerid][pAdmin] == 4) return SystemMessage(playerid, "You are not Administrator.");
new alevel, str[128];
if(sscanf(params, "ud", giveplayerid, alevel)) return SystemMessage(playerid, "Correct usage: '/setadmin [playername] [level]'");
if(!IsPlayerConnected(giveplayerid)) return SystemMessage(playerid, "This player is not active.");
if(alevel < 0) return SystemMessage(playerid, "Invalid level!");
GetName(giveplayerid, playername);
GetName(playerid, adminname);
pInfo[giveplayerid][pAdmin] = alevel;
format(str, sizeof(str), "Administrator %s (%d) has set your admin level to %d", adminname, playerid, alevel);
SystemMessage(giveplayerid, str);
format(str, sizeof(str), "You have set %s (%d) admin level to %d", playername, giveplayerid, alevel);
SystemMessage(playerid, str);
return 1;
}


Re: How to make this command unable to use for certain levels - KevKo95 - 02.04.2010

My guess is that every admin level except 4 can use this command. If 4 is your highest admin level, then you should put:

pawn Код:
if(pInfo[playerid][pAdmin] != 4) return SystemMessage(playerid, "You are not Administrator.");
Otherwise:

pawn Код:
if(pInfo[playerid][pAdmin] <= 4) return SystemMessage(playerid, "You are not Administrator.");



Re: How to make this command unable to use for certain levels - Krozz - 03.04.2010

Quote:
Originally Posted by Kevin Fallow / KevKo
My guess is that every admin level except 4 can use this command. If 4 is your highest admin level, then you should put:

pawn Код:
if(pInfo[playerid][pAdmin] != 4) return SystemMessage(playerid, "You are not Administrator.");
Otherwise:

pawn Код:
if(pInfo[playerid][pAdmin] <= 4) return SystemMessage(playerid, "You are not Administrator.");
Ok thx that fixed but what if I want to let level 3 and level 2 to do the command? without letting level 0 do it


Re: How to make this command unable to use for certain levels - Bomber - 03.04.2010

Then use that
pawn Код:
if(pInfo[playerid][pAdmin] >= 4) return SystemMessage(playerid, "You are not Administrator.");



Re: How to make this command unable to use for certain levels - Krozz - 03.04.2010

Quote:
Originally Posted by Bomba' Xtreme'Stuntage
Then use that
pawn Код:
if(pInfo[playerid][pAdmin] >= 4) return SystemMessage(playerid, "You are not Administrator.");
Is that to let level 1 to 4 use it? Or level 0 to 4 ?


Re: How to make this command unable to use for certain levels - Bomber - 03.04.2010

Its 0 to level 4

You can't do that only level 2 3 and 4 can use that .


Re: How to make this command unable to use for certain levels - Krozz - 03.04.2010

Quote:
Originally Posted by Bomba' Xtreme'Stuntage
Its 0 to level 4

You can't do that only level 2 3 and 4 can use that .
Then How can some admin System do that? Like Lux Admin system level 1 and 2 can use /slap but not level 0


Re: How to make this command unable to use for certain levels - Bomber - 03.04.2010

Oops My mistake

pawn Код:
if(pInfo[playerid][pAdmin] <= 2) return SystemMessage(playerid, "You are not Administrator.");
Now level 2 3 4 can use that command
Sorry


Re: How to make this command unable to use for certain levels - Krozz - 03.04.2010

Quote:
Originally Posted by Bomba' Xtreme'Stuntage
Oops My mistake

pawn Код:
if(pInfo[playerid][pAdmin] <= 2) return SystemMessage(playerid, "You are not Administrator.");
Now level 2 3 4 can use that command
Sorry
When I compile I just get this error: Unreachable Code


Re: How to make this command unable to use for certain levels - Bomber - 03.04.2010

Hmm, i have no idea then, i complied then i got no errors.

But im going to sleep now