SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 02/04/2010, 11:51 PM   #1
Krozz
Little Clucker
 
Join Date: Apr 2010
Posts: 21
Reputation: 0
Default How to make this command unable to use for certain levels

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;
}
Krozz is offline  
Old 02/04/2010, 11:55 PM   #2
KevKo95
Banned
 
Join Date: Jan 2008
Location: Ontario, Canada
Posts: 457
Reputation: 0
Default Re: How to make this command unable to use for certain levels

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 Code:
if(pInfo[playerid][pAdmin] != 4) return SystemMessage(playerid, "You are not Administrator.");

Otherwise:

pawn Code:
if(pInfo[playerid][pAdmin] <= 4) return SystemMessage(playerid, "You are not Administrator.");
KevKo95 is offline  
Old 03/04/2010, 12:22 AM   #3
Krozz
Little Clucker
 
Join Date: Apr 2010
Posts: 21
Reputation: 0
Default Re: How to make this command unable to use for certain levels

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 Code:
if(pInfo[playerid][pAdmin] != 4) return SystemMessage(playerid, "You are not Administrator.");

Otherwise:

pawn Code:
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
Krozz is offline  
Old 03/04/2010, 12:23 AM   #4
Bomber
Big Clucker
 
Join Date: Dec 2009
Posts: 150
Reputation: 0
Default Re: How to make this command unable to use for certain levels

Then use that
pawn Code:
if(pInfo[playerid][pAdmin] >= 4) return SystemMessage(playerid, "You are not Administrator.");
Bomber is offline  
Old 03/04/2010, 12:24 AM   #5
Krozz
Little Clucker
 
Join Date: Apr 2010
Posts: 21
Reputation: 0
Default Re: How to make this command unable to use for certain levels

Quote:
Originally Posted by Bomba' Xtreme'Stuntage
Then use that
pawn Code:
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 ?
Krozz is offline  
Old 03/04/2010, 12:25 AM   #6
Bomber
Big Clucker
 
Join Date: Dec 2009
Posts: 150
Reputation: 0
Default Re: How to make this command unable to use for certain levels

Its 0 to level 4

You can't do that only level 2 3 and 4 can use that .
Bomber is offline  
Old 03/04/2010, 12:28 AM   #7
Krozz
Little Clucker
 
Join Date: Apr 2010
Posts: 21
Reputation: 0
Default Re: How to make this command unable to use for certain levels

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
Krozz is offline  
Old 03/04/2010, 12:30 AM   #8
Bomber
Big Clucker
 
Join Date: Dec 2009
Posts: 150
Reputation: 0
Default Re: How to make this command unable to use for certain levels

Oops My mistake

pawn Code:
if(pInfo[playerid][pAdmin] <= 2) return SystemMessage(playerid, "You are not Administrator.");
Now level 2 3 4 can use that command
Sorry
Bomber is offline  
Old 03/04/2010, 12:33 AM   #9
Krozz
Little Clucker
 
Join Date: Apr 2010
Posts: 21
Reputation: 0
Default Re: How to make this command unable to use for certain levels

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

pawn Code:
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
Krozz is offline  
Old 03/04/2010, 12:34 AM   #10
Bomber
Big Clucker
 
Join Date: Dec 2009
Posts: 150
Reputation: 0
Default Re: How to make this command unable to use for certain levels

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

But im going to sleep now
Bomber is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
levels [asg]davo Help Archive 7 16/05/2010 02:34 PM
Do ur guys know how to make other players unable to see the hp bar on our charac uplovethai Help Archive 3 13/02/2010 08:32 AM
+10 levels breakpaper Help Archive 5 17/12/2009 06:10 PM
How to make Admin Levels??? Badandy Help Archive 3 12/07/2009 10:02 PM
Levels. [AG]_Just Help Archive 4 20/04/2009 06:22 PM


All times are GMT. The time now is 04:55 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.