PDA

View Full Version : Admin Names


ChristianIvann09
04/04/2014, 06:20 AM
Hello, Good day!

How can i make an admin name

For example:

My admin name didnt set by adminstrator yet then it will say "You dont have an admin name. Contact an adminstrator"

i will /setadminname his name then he can now go admin duty

In short the Admin Name is only a Temporray admin name. when i go off duty my name will go back to normal

Avi Raj
04/04/2014, 06:22 AM
Hints :-

-Make an Enum in the player file
-On /setadminname store the name in the file
-Loads the name (if there is any) on getting admin onduty
-Unload it and set it back to original name.

ChristianIvann09
04/04/2014, 06:29 AM
Hints :-

-Make an Enum in the player file
-On /setadminname store the name in the file
-Loads the name (if there is any) on getting admin onduty
-Unload it and set it back to original name.

Thanks mate


(( WTF YOUR SIGNATURE?? ))

Avi Raj
04/04/2014, 06:31 AM
Thanks mate


(( WTF YOUR SIGNATURE?? ))

Welcome and yes, that dumb made a topic to give free hosting. :D

ChristianIvann09
04/04/2014, 06:36 AM
Hints :-

-Make an Enum in the player file
-On /setadminname store the name in the file
-Loads the name (if there is any) on getting admin onduty
-Unload it and set it back to original name.

I cant under the 3rd one

I have this admin duty cmd and the setadminnname

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!");
//SetPlayerName(playerid, PlayerInfo[playerid][pAdminName]);
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 is now on Admin Duty! (/report for assistance)", GetPlayerNameEx(playerid));
SendClientMessageToAllEx(COLOR_YELLOW, string);
}
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 is now Off Admin Duty! ( Leave the Admin to Roleplay )", GetPlayerNameEx(playerid));
SendClientMessageToAllEx(COLOR_YELLOW, string);
}
return 1;
}


CMD:setadminname(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 5)
{
/*if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 6)
{
SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
return 1;
}*/

new giveplayerid, name[32];
if(sscanf(params, "us[32]", giveplayerid, name))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setadminname [playerid/partofname] [name]");
return 1;
}

if(PlayerInfo[giveplayerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_WHITE, "The player is not an admin.");
return 1;
}

if(AdminDuty[giveplayerid] != 0)
{
SendClientMessage(playerid, COLOR_WHITE, "That admin is currently on-duty. They must go off-duty in order for you to set their admin name.");
return 1;
}

new length = strlen(name);
if(length < 3 || length > 20)
{
SendClientMessage(playerid, COLOR_WHITE, "The name can't less than 3 characters or more than 20 characters.");
return 1;
}

if(strfind(name, "_", true) != -1)
{
SendClientMessage(playerid, COLOR_WHITE, "The admin name must be one name. There can't be an underscore in the name.");
return 1;
}

if(strcmp(name, "Zhao", true) == 0 && PlayerInfo[playerid][pAdmin] < 6) {
SendClientMessage(playerid, COLOR_WHITE, "stop ! im zao ! you're not zao !");
return 1;
}

new string[128];
format(string, sizeof(string), "AdmCmd: %s has set %s's admin name to '%s'.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), name);
ABroadCast(COLOR_LIGHTRED, string, 1);

format(PlayerInfo[giveplayerid][pAdminName], 32, name);
}
else SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
return 1;
}