SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 24/05/2012, 06:29 PM   #1
MechaTech
Big Clucker
 
MechaTech's Avatar
 
Join Date: Feb 2012
Location: Netherlands
Posts: 174
Reputation: 6
Default Admin Ranks

I really want admin ranks like level 1 = Moderator level 2 = Administrator etc. I already have some commands and login/register system.
__________________
Code:
Maps: Stunt World
FilterScripts: Advanced Weapon Shop
MechaTech is offline   Reply With Quote
Old 24/05/2012, 06:35 PM   #2
Kindred
High-roller
 
Join Date: Aug 2011
Location: The Netherlands
Posts: 1,636
Reputation: 495
Default Re: Admin Ranks

Code:
stock CheckPlayerAdmin(targetid)
{
	new adminrank[10];
	if(PlayerInfo[targetid][pAdmin] == 0) { adminrank = "None"; }
	if(PlayerInfo[targetid][pAdmin] == 1) { adminrank = "Moderator"; }
	if(PlayerInfo[targetid][pAdmin] == 2) { adminrank = "Junior"; }
	if(PlayerInfo[targetid][pAdmin] == 3) { adminrank = "General"; }
	if(PlayerInfo[targetid][pAdmin] == 4) { adminrank = "Senior"; }
	if(PlayerInfo[targetid][pAdmin] == 5) { adminrank = "Executive"; }
	if(PlayerInfo[targetid][pAdmin] == 6) { adminrank = "Owner"; }
	return adminrank;
}

Above is just a simple stock I made, yet I'm not sure if it works. I use this on my gamemode, yet it's untested as of yet. Something like this could be made:

Code:
CMD:stats(playerid, params[])
{
	new string[128], faction[128];
	format(string, sizeof(string), "------------------------------------[%s]-------------------------------", GetName(playerid));
	SendClientMessage(playerid, COLOR_WHITE, string);
	format(string, sizeof(string), "|| [Admin]: %s ||", CheckPlayerAdmin(playerid));
	SendClientMessage(playerid, COLOR_WHITE, string);
	return 1;
}

Remember, this is just an example. The stock simply states that it creates a new variable, and then depending on what the admin rank is set to for the player, sets the name of their admin rank.
Kindred is offline   Reply With Quote
Old 24/05/2012, 06:47 PM   #3
Pizzy
Huge Clucker
 
Join Date: May 2012
Posts: 409
Reputation: 110
Default Re: Admin Ranks

Code:
stock AdminRank(targetid)
{
      new adminrank[10];
      switch(PlayerInfo[targetid][pAdmin])
      {
             case 0: { adminrank = "None"; }
             case 1: { adminrank = "Moderator"; }
             case 2: { adminrank = "Junior"; }
             //ETC.
      }
      return adminrank;
}

This is more efficient than Kindred's code, but the same idea/concept.
__________________
Need a few extra dollars to afford that SA-MP hosting?

Check out PrizePlus.net today!
Pizzy is offline   Reply With Quote
Old 24/05/2012, 07:34 PM   #4
MechaTech
Big Clucker
 
MechaTech's Avatar
 
Join Date: Feb 2012
Location: Netherlands
Posts: 174
Reputation: 6
Default Re: Admin Ranks

Okay i will make it clear.
I have an admin system which includes:
Register/Login.
Saving System. (scriptfiles/users)
A few commands: kick, ban, freeze and unfreeze.

QEUSTION:
I want if you are level 2 admin you can use that commands, and you can't use it if you are level 1 admin or lower.

Now i only can use
Code:
if(!IsPlayerAdmin(playerid))
But i want you can use this to
Code:
if(PlayerInfo[playerid][pAdmin] < 2)
__________________
Code:
Maps: Stunt World
FilterScripts: Advanced Weapon Shop
MechaTech is offline   Reply With Quote
Old 24/05/2012, 07:54 PM   #5
leonardo1434
High-roller
 
leonardo1434's Avatar
 
Join Date: Mar 2012
Posts: 1,674
Reputation: 179
Default Re: Admin Ranks

Code:
new AccountInfo[MAX_PLAYERS]

enum Info
{
	AdminLevel // here is made your admin level...
}

// exemple

if (AccountInfo[playerid][AdminLevel] > 0)
    {
        new lol[40]
        format(lol, sizeof lol, "|» You are now logged in as a level %d admin «|",[AdminLevel]);
        SendClientMessage(playerid, COLOR_GREEN, lol);
    }
}
__________________
c++
leonardo1434 is offline   Reply With Quote
Old 24/05/2012, 08:08 PM   #6
jessejanssen
Gangsta
 
Join Date: Apr 2008
Posts: 558
Reputation: 698
Default Re: Admin Ranks

Quote:
Originally Posted by leonardo1434 View Post
Code:
new AccountInfo[MAX_PLAYERS]

enum Info
{
	AdminLevel // here is made your admin level...
}

// exemple

if (AccountInfo[playerid][AdminLevel] > 0)
    {
        new lol[40]
        format(lol, sizeof lol, "|» You are now logged in as a level %d admin «|",[AdminLevel]);
        SendClientMessage(playerid, COLOR_GREEN, lol);
    }
}
That is not right, it should be as this:
Code:
enum Info
{
	AdminLevel
}
new AccountInfo[MAX_PLAYERS][Info];

public OnPlayerConnect(playerid)
{
	if (AccountInfo[playerid][AdminLevel] > 0)
	    {
	    new string[110];
	    format(string, sizeof(string), ">  You are logged in as level %d Administrator.",[AdminLevel]);
	    SendClientMessage(playerid, 0xFFFFFFFF, string);
	    }
}

Best regards,
Jesse
__________________
R.I.P. all people who passed away on the MH17
jessejanssen is offline   Reply With Quote
Old 24/05/2012, 08:14 PM   #7
leonardo1434
High-roller
 
leonardo1434's Avatar
 
Join Date: Mar 2012
Posts: 1,674
Reputation: 179
Default Re: Admin Ranks

About my code, it's right. it's pretty obviously it was to be put in onplayerconnect don't think you?

Code:
new lol[40]

it was a random number....
__________________
c++
leonardo1434 is offline   Reply With Quote
Old 24/05/2012, 08:17 PM   #8
jessejanssen
Gangsta
 
Join Date: Apr 2008
Posts: 558
Reputation: 698
Default Re: Admin Ranks

Quote:
Originally Posted by leonardo1434 View Post
About my code, it's right. it's pretty obviously it was to be put in onplayerconnect don't think you?

Code:
new lol[40]

it was a random number....
You didn't include the enum into the variable and more, and don't take this on a bad way, you learn from your mistakes ..

Best regards,
Jesse
__________________
R.I.P. all people who passed away on the MH17
jessejanssen is offline   Reply With Quote
Old 24/05/2012, 08:19 PM   #9
MechaTech
Big Clucker
 
MechaTech's Avatar
 
Join Date: Feb 2012
Location: Netherlands
Posts: 174
Reputation: 6
Default Re: Admin Ranks

both of those scripts is giving me this error:

Code:
W:\Users\Magdy\Desktop\Server 3.0e\filterscripts\MyAdmin.pwn(93) : error 029: invalid expression, assumed zero
W:\Users\Magdy\Desktop\Server 3.0e\filterscripts\MyAdmin.pwn(93) : error 091: ambiguous constant; tag override is required (symbol "AdminLevel")
W:\Users\Magdy\Desktop\Server 3.0e\filterscripts\MyAdmin.pwn(93) : error 029: invalid expression, assumed zero
W:\Users\Magdy\Desktop\Server 3.0e\filterscripts\MyAdmin.pwn(93) : fatal error 107: too many error messages on one line
__________________
Code:
Maps: Stunt World
FilterScripts: Advanced Weapon Shop
MechaTech is offline   Reply With Quote
Old 24/05/2012, 08:23 PM   #10
Mike_Peterson
Gangsta
 
Mike_Peterson's Avatar
 
Join Date: Apr 2009
Location: In a concrete(used to brick) house
Posts: 861
Reputation: 37
Default Re: Admin Ranks

Mecha this might be useful or totally unusful, as your dutch aswell I can help you (in dutch) on teamviewer, but if u dont reply quick, theres a chance that I have to go (school). PM me ur TV details.

edit: got to go, if this problem still occurs tomorrow i'll help ya out.
__________________
I'm looking for some small-time paid work, no MySQL preferably.
Search before you post!

Got a problem? Debug your script (add prints to it).
If that doesn't help, use Google!
Still having issues? Create a thread on the SA-MP Forums.
If nothing helps, send me a PM.
And I'll try to figure it out with you.
Mike_Peterson is offline   Reply With Quote
Reply

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
Admin Ranks? sanplayer Scripting Help 10 09/10/2011 05:59 PM
c ranks^ Kar Help Archive 2 26/07/2010 10:10 PM
Ranks ColdXX Help Archive 0 18/05/2010 05:13 PM
Ranks Puzi Help Archive 17 29/07/2009 03:30 PM


All times are GMT. The time now is 03:52 PM.


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