CMD:aduty(playerid, params[])
{
if(IsPlayerAdmin(playerid))
//if(PlayerInfo[playerid][pAdmin]>1)
{
SetPlayerHealth(playerid, 999);
}else{
SendClientMessage(playerid, RED, "you're not admin etc");
}
return 1;
}
enum pInfo { pAdmin, pAdminDuty, }; new PlayerInfo[MAX_PLAYERS+1][pInfo]; CMD:aduty(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, -1, "This is an admin only command!"); if(PlayerInfo[playerid][pAdminDuty] == 0) { SendClientMessage(playerid, COLOR_YELLOW, "You are now on administrative duty! "); PlayerInfo[playerid][pAdminDuty] = 1; SetPlayerHealth(playerid, 100000); SetPlayerArmour(playerid, 100000); 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!"); SetPlayerHealth(playerid, 100); SetPlayerArmour(playerid, 0); PlayerInfo[playerid][pAdminDuty] = 0; } return 1; }
Code:
enum pInfo { pAdmin, pAdminDuty, }; CMD:aduty(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, -1, "This is an admin only command!"); if(PlayerInfo[playerid][pAdminDuty] == 0) { SendClientMessage(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]; 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!"); SetPlayerHealth(playerid, 100); SetPlayerArmour(playerid, 0); PlayerInfo[playerid][pAdminDuty] = 0; } return 1; } |
Since you just made the whole thing, you forgot to add the variable of PlayerInfo.
|
He didn't forget to add it, he just copied and pasted the command here, and since it's wrong section it's better to just describe him how to make the command. Not giving a finished command.
|
//top of your script
new AdminStatus;
CMD:aduty(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
if(!AdminStatus)
{
AdminStatus = 1;
SetPlayerHealth(playerid,9999);
}
else
{
AdminStatus = 0;
SetPlayerHealth(playerid,100);
}
}
return 1;
}
//Top
new AdminDuty[MAX_PLAYERS_NAME];
new Text3D:label[MAX_PLAYERS];
CMD:aduty(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_ORANGE, "[*] You're not a level 1+ admin!");
if(AdminDuty[playerid] == 1)
{
AdminDuty[playerid] = 0;
SendClientMessage(playerid,COLOR_BLUE,"You are now off duty!");
SpawnPlayer(playerid);
new string[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
format(string, sizeof(string), "%s[%d] is now off duty!", pName, playerid);
SendClientMessageToAll(COLOR_RED, string);
}
else
{
SendClientMessage(playerid,COLOR_ORANGE,"You are now a admin on duty !");
SendClientMessage(playerid,COLOR_ORANGE,"You have set a label to you, it means that you ARE a admin so now is your playercolor LIGHTBLUE !");
SendClientMessage(playerid,COLOR_ORANGE,"THIS MEANS TOO : YOU DON'T FIGHT AGAINST OTHER PLAYERS ! YOU'RE ON DUTY !!");
label[playerid] = Create3DTextLabel("Admin On Duty! Do not attack!",0x008080FF,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.7);
SetPlayerColor(playerid, 0xFFC0CBAA);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid,38,1000); GivePlayerWeapon(playerid,24,1000);
GivePlayerWeapon(playerid,9,1);
AdminDuty[playerid] = 1;
SetPlayerSkin(playerid, 219);
new string[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
format(string, sizeof(string), "%s[%d] is now on admin duty!", pName, playerid);
SendClientMessageToAll(COLOR_RED, string);
}
return 1;
}