SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 04/09/2015, 04:29 PM   #1
AndreiWow
High-roller
 
AndreiWow's Avatar
 
Join Date: Nov 2014
Location: Romania, Bucharest
Posts: 1,046
Reputation: 48
Default How do I make this?

Example if he is admin 1
in /admins will show Admin Level: Moderator instead of 1?
Or in /stats, moderator instead of 1, and so on for all 6 ranks.
AndreiWow is offline   Reply With Quote
Old 04/09/2015, 04:35 PM   #2
SWAT4
Huge Clucker
 
SWAT4's Avatar
 
Join Date: May 2014
Posts: 245
Reputation: 56
Default Re: How do I make this?

Give us the codes that defines the admin levels/ranks..
check them as defines, if not, check at the /admins command itself,
SWAT4 is offline   Reply With Quote
Old 04/09/2015, 04:38 PM   #3
AndreiWow
High-roller
 
AndreiWow's Avatar
 
Join Date: Nov 2014
Location: Romania, Bucharest
Posts: 1,046
Reputation: 48
Default Re: How do I make this?

Code:
CMD:admins(playerid, params[])
{
	new count = 0;
	new pname[256], string[150];
    SendClientMessage(playerid, COLOR_GREY, "-----------------------------------------------------------");

    foreach (new i : Player) if (PlayerInfo[i][pAdmin] > 0)
	{
        if (PlayerInfo[i][pAdminDuty])
        {
			GetPlayerName(playerid, pname, sizeof(pname));
			PlayerInfo[playerid][pAdminDuty] = 1;
			format(string, sizeof(string), "%s - Admin Level: "COL_LIGHTBLUE"%d "COL_WHITE"("COL_GREEN"On Duty"COL_WHITE")", pname, PlayerInfo[playerid][pAdmin]);
			SendClientMessageToAll(COLOR_WHITE, string);
		}
		else
		{
  			GetPlayerName(playerid, pname, sizeof(pname));
			PlayerInfo[playerid][pAdminDuty] = 1;
			format(string, sizeof(string), "%s - Admin Level: "COL_LIGHTBLUE"%d "COL_WHITE"("COL_RED"Off Duty"COL_WHITE")", pname, PlayerInfo[playerid][pAdmin]);
			SendClientMessageToAll(COLOR_WHITE, string);
		}
        count++;
	}
	if (!count) {
	    SendClientMessage(playerid, COLOR_WHITE, "* No admins online.");
	}
	SendClientMessage(playerid, COLOR_GREY, "-----------------------------------------------------------");
	return 1;
}
Also tell me if it is good, it is made by me xD
AndreiWow is offline   Reply With Quote
Old 04/09/2015, 04:48 PM   #4
mirou123
Huge Clucker
 
Join Date: Jul 2013
Posts: 362
Reputation: 22
Default Re: How do I make this?

Use this code
Code:
format(string, sizeof(string), "%s - Admin Rank: "COL_LIGHTBLUE"%s "COL_WHITE"("COL_GREEN"On Duty"COL_WHITE")", pname, LevelToRank(PlayerInfo[playerid][pAdmin]));
Notice how I replaced %d with %s and changed PlayerInfo[playerid][pAdmin] to LevelToRank(PlayerInfo[playerid][pAdmin])

Next you need to define LevelToRank so here it is
Code:
stock LevelToRank(level)
{
    new rank[20];
    switch(level)
    {
       case 1: rank = "Moderator";
       case 2: rank = "Whatever you want";
       etc....
       case 6: rank = "Owner";
       default: rank = "Player";
    }
   return rank;
}
You obviously need to finish working on LevelToRank and by the way I did not test that code
mirou123 is offline   Reply With Quote
Old 04/09/2015, 05:02 PM   #5
AndreiWow
High-roller
 
AndreiWow's Avatar
 
Join Date: Nov 2014
Location: Romania, Bucharest
Posts: 1,046
Reputation: 48
Default Re: How do I make this?

Thanks alot, I will rep when I will be able to
AndreiWow 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
how to make ban,and unban cmd for offline player,and how to make /fakeban cmd PowerF Scripting Help 3 11/01/2015 09:31 AM
How to make /lockserver CMD + Audio CMD to make music for all players D3vin Scripting Help 2 19/04/2014 04:09 PM
Can someone make tutorial how to make vehicle tune saving system ? barts Scripting Help 3 09/01/2014 11:40 AM
How to make Admins Levels and how to make gates system and more Loranzo_De_Andreas Scripting Help 2 22/03/2013 11:56 AM
Noob question: how to make on-foot underwater spawn make player stick to ocean floor? kaisersouse Scripting Help 5 11/07/2012 02:30 PM


All times are GMT. The time now is 05:40 AM.


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