Admin Names. (+rep)
#1

Hello,

How do i make an Admin Names. If you are on duty admin your name should be set on ADMIN NAME and your stats won't save unless if you go OFF DUTY.

Here is my Admin Duty Code:
Код:
CMD:aduty(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, -1, "This is an admin only command!");
	{
			if(PlayerInfo[playerid][pAdminDuty] == 0)
			{

				SendClientMessageEx(playerid, COLOR_YELLOW, "You are now on administrative duty! Remember to check /reports!");
				PlayerInfo[playerid][pAdminDuty] = 1;
				SetPlayerHealth(playerid, 100000);
				SetPlayerArmour(playerid, 100000);
				//SetPlayerColor(playerid, COLOR_TWORANGE);
				//SetPlayerSkin(playerid, 294); - Commented by Voltage
				new string[128];
				format(string, sizeof(string), "Administrator %s(ID %d) is now on Admin Duty!", GetPlayerNameEx(playerid), playerid);
				ABroadCast(COLOR_YELLOW, string, 1);
			}
			else
			{
				SendClientMessageEx(playerid, COLOR_RED, "You are now off admin duty!");
				//SetPlayerName(playerid, PlayerInfo[playerid][pNormalName]);
				SetPlayerHealth(playerid, 100);
				SetPlayerArmour(playerid, 0);
				SetPlayerToTeamColor(playerid);
				//SetPlayerSkin(playerid, 299); - Commented by Voltage
				PlayerInfo[playerid][pAdminDuty] = 0;
				new string[128];
				format(string, sizeof(string), "Administrator %s(ID %d) is now Off Admin Duty! ( Leave the Admin to Roleplay )", GetPlayerNameEx(playerid), playerid);
				ABroadCast(COLOR_YELLOW, string, 1);
			}
	}
	return 1;
}
Please Give me the exact code! Thanks alot!
Reply
#2

I don't understand your question, Could you please explain a bit more?
Reply
#3

Quote:
Originally Posted by biker122
Посмотреть сообщение
I don't understand your question, Could you please explain a bit more?
There should be an temporary admin name like "Ivann" when you go ON DUTY.

Admin names should be set. /setadminname or else it will return SendClientMessage

When you go back OFF DUTY again. Your name should be return into normal like "Christian_Ivann"

NOTE: When your on duty. Your stats should not be save except if you go off duty.
Reply
#4

If you already have an ENUM called pNormalName under enum PlayerInfo, then let it stay. If not, Make one called pNormalName.

Код:
CMD:aduty(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, -1, "This is an admin only command!");
	{
			if(PlayerInfo[playerid][pAdminDuty] == 0)
			{

				SendClientMessageEx(playerid, COLOR_YELLOW, "You are now on administrative duty! Remember to check /reports!");
				PlayerInfo[playerid][pAdminDuty] = 1;
				SetPlayerHealth(playerid, 100000);
				SetPlayerArmour(playerid, 100000);
                new name = GetPlayerNameEx(playerid);
                PlayerInfo[playerid][pNormalName] = name;
                new str1[128];
                format(str1,sizeof(str1),"[ADMIN]%s",GetPlayerNameEx(playerid));
                SetPlayerName(playerid,str1);
				//SetPlayerColor(playerid, COLOR_TWORANGE);
				//SetPlayerSkin(playerid, 294); - Commented by Voltage
				new string[128];
				format(string, sizeof(string), "Administrator %s(ID %d) is now on Admin Duty!", GetPlayerNameEx(playerid), playerid);
				ABroadCast(COLOR_YELLOW, string, 1);
			}
			else
			{
				SendClientMessageEx(playerid, COLOR_RED, "You are now off admin duty!");
				SetPlayerName(playerid, PlayerInfo[playerid][pNormalName]);
				SetPlayerHealth(playerid, 100);
				SetPlayerArmour(playerid, 0);
				SetPlayerToTeamColor(playerid);
				//SetPlayerSkin(playerid, 299); - Commented by Voltage
				PlayerInfo[playerid][pAdminDuty] = 0;
				new string[128];
				format(string, sizeof(string), "Administrator %s(ID %d) is now Off Admin Duty! ( Leave the Admin to Roleplay )", GetPlayerNameEx(playerid), playerid);
				ABroadCast(COLOR_YELLOW, string, 1);
			}
	}
	return 1;
}
Like, If you go /onduty, your name should be [ADMIN]Ivann and if you go offduty, It should be back to Ivann?
If yes, then try this.
Reply
#5

Quote:
Originally Posted by biker122
Посмотреть сообщение
If you already have an ENUM called pNormalName under enum PlayerInfo, then let it stay. If not, Make one called pNormalName.

Код:
CMD:aduty(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, -1, "This is an admin only command!");
	{
			if(PlayerInfo[playerid][pAdminDuty] == 0)
			{

				SendClientMessageEx(playerid, COLOR_YELLOW, "You are now on administrative duty! Remember to check /reports!");
				PlayerInfo[playerid][pAdminDuty] = 1;
				SetPlayerHealth(playerid, 100000);
				SetPlayerArmour(playerid, 100000);
                new name = GetPlayerNameEx(playerid);
                PlayerInfo[playerid][pNormalName] = name;
                new str1[128];
                format(str1,sizeof(str1),"[ADMIN]%s",GetPlayerNameEx(playerid));
                SetPlayerName(playerid,str1);
				//SetPlayerColor(playerid, COLOR_TWORANGE);
				//SetPlayerSkin(playerid, 294); - Commented by Voltage
				new string[128];
				format(string, sizeof(string), "Administrator %s(ID %d) is now on Admin Duty!", GetPlayerNameEx(playerid), playerid);
				ABroadCast(COLOR_YELLOW, string, 1);
			}
			else
			{
				SendClientMessageEx(playerid, COLOR_RED, "You are now off admin duty!");
				SetPlayerName(playerid, PlayerInfo[playerid][pNormalName]);
				SetPlayerHealth(playerid, 100);
				SetPlayerArmour(playerid, 0);
				SetPlayerToTeamColor(playerid);
				//SetPlayerSkin(playerid, 299); - Commented by Voltage
				PlayerInfo[playerid][pAdminDuty] = 0;
				new string[128];
				format(string, sizeof(string), "Administrator %s(ID %d) is now Off Admin Duty! ( Leave the Admin to Roleplay )", GetPlayerNameEx(playerid), playerid);
				ABroadCast(COLOR_YELLOW, string, 1);
			}
	}
	return 1;
}
Like, If you go /onduty, your name should be [ADMIN]Ivann and if you go offduty, It should be back to Ivann?
If yes, then try this.
No, for example your name Biker_123

then when you go ON duty your name should be set on "Biker" only (depends what setted on /setadminname) for example i set your adminn name to 123 /setadminname 0 123. then everytime your go on duty your name should be 123 then when you go off duty your name should be back to Biker_123.
Reply
#6

Can you show me your /setadminname?
Reply
#7

pawn Код:
new gNames[MAX_PLAYERS][MAX_PLAYER_NAME] ;

COMMAND:setadminname(playerid, params[])
{
     if( isnull(params) || !IsPlayerAdmin(playerid)) return 0;
 
     memcpy(gNames[playerid], params, 0, MAX_PLAYER_NAME);

     return 1;
}

COMMAND:onduty(playerid)
{
    if(!IsPlayerAdmin(playerid)) return 0;
   
    SetPlayerName(playerid, gNames[playerid]);

     return 1;
}
Expand it to settings OTHER players' names as well, and you're good.
Reply
#8

Quote:
Originally Posted by biker122
Посмотреть сообщение
Can you show me your /setadminname?
I dont have the /setadminnames

thats why i call help here.. to make the /setadminnames
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)