PDA

View Full Version : Admin Duty (/aduty) +REP


Trevor Gin
11/03/2015, 09:48 AM
I have old cmd /aduty when You go on duty the player masked shows for admin on duty only, now how i can make that too to my /aduty new cmd?

this old one
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 string[128];
for(new x = 0; x < MAX_PLAYERS; x++)
{
if(PlayerInfo[x][pAdmin] > 7)
{
format(string, sizeof(string), "Administrator %s is now on Admin Duty!", GetPlayerNameEx(playerid));
SendClientMessage(x, COLOR_YELLOW, string);
}
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (MaskOnOff[i] == 1)
{
ShowPlayerNameTagForPlayer(playerid, i, true);
}
}
}
else
{
SendClientMessageEx(playerid, COLOR_RED, "You are now off admin duty!");
//SetPlayerName(playerid, PlayerInfo[playerid][pNormalName]);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 0);
PlayerInfo[playerid][pAdminDuty] = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (MaskOnOff[i] == 1)
{
ShowPlayerNameTagForPlayer(playerid, i, false);
}
}
}
return 1;
}


this new one:
CMD:aduty(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 2)
{
new string[256];
if(aDuty[playerid] == 1)
{
SendClientMessage(playerid, COLOR_WHITE, "You are now off a-duty.");
format(string, sizeof(string), "{FFFFFF}Administrator {FF0000}%s {FFFFFF}is now {FF0000}off{FFFFFF} a-duty.", GetPlayerNameEx(playerid));
SendClientMessageToAllEx(COLOR_WHITE, string);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
Delete3DTextLabel(aDutytext[playerid]);
aDuty[playerid] = 0;
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, "You are now on a-duty.");
aDutytext[playerid] = Create3DTextLabel("{FFFFFF}OOC\n{FF0000}Administrator {FFFFFF}OOC to\n{FF0000}Avoid Roleplay", 0xFF0000, 110.0, 110.0, 110.0, 110.0, 0);
Attach3DTextLabelToPlayer(aDutytext[playerid], playerid, 0.0, 0.0, 0.0);
format(string, sizeof(string), "{FFFFFF}Administrator {00FF00}%s {FFFFFF}is now {00FF00}on{FFFFFF} a-duty.", GetPlayerNameEx(playerid));
SendClientMessageToAllEx(COLOR_WHITE, string);
SetPlayerHealth(playerid, 1000000);
SetPlayerArmour(playerid, 1000000);
aDuty[playerid] = 1;
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, " You are not a Administrator!");
}
return 1;
}

Kaliber
11/03/2015, 10:04 AM
Write it like this:

CMD:aduty(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 2)
{
new string[256];
if(aDuty[playerid] == 1)
{
SendClientMessage(playerid, COLOR_WHITE, "You are now off a-duty.");
format(string, sizeof(string), "{FFFFFF}Administrator {FF0000}%s {FFFFFF}is now {FF0000}off{FFFFFF} a-duty.", GetPlayerNameEx(playerid));
SendClientMessageToAllEx(COLOR_WHITE, string);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
Delete3DTextLabel(aDutytext[playerid]);
aDuty[playerid] = 0;
for(new i = 0; i < MAX_PLAYERS; i++) if (MaskOnOff[i] == 1) ShowPlayerNameTagForPlayer(playerid, i, false);
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, "You are now on a-duty.");
aDutytext[playerid] = Create3DTextLabel("{FFFFFF}OOC\n{FF0000}Administrator {FFFFFF}OOC to\n{FF0000}Avoid Roleplay", 0xFF0000, 110.0, 110.0, 110.0, 110.0, 0);
Attach3DTextLabelToPlayer(aDutytext[playerid], playerid, 0.0, 0.0, 0.0);
format(string, sizeof(string), "{FFFFFF}Administrator {00FF00}%s {FFFFFF}is now {00FF00}on{FFFFFF} a-duty.", GetPlayerNameEx(playerid));
for(new i = 0; i < MAX_PLAYERS; i++)if (MaskOnOff[i] == 1) ShowPlayerNameTagForPlayer(playerid, i, true);
SendClientMessageToAllEx(COLOR_WHITE, string);
SetPlayerHealth(playerid, 1000000);
SetPlayerArmour(playerid, 1000000);
aDuty[playerid] = 1;
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, " You are not a Administrator!");
}
return 1;
}

Trevor Gin
11/03/2015, 10:19 AM
Thank you very much <3