PDA

View Full Version : /aduty problem.


N0FeaR
04/08/2013, 08:27 PM
Can u see whats wrong here when i got /aduty its says Administrator is now off-duty.

if(!strcmp(cmdtext, "/adminduty", true) || !strcmp(cmdtext, "/aduty", true))
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] <= 3)
{
if(AdminDuty[playerid] == 0)
{
AdminDuty[playerid] = 1;
SetPlayerColor(playerid, 0xAA3333AA);
format(string, sizeof(string),"Administrator %s is now on-duty.", sendername);
ABroadCast(COLOR_GRAD2, string, 1);
SetPlayerArmourEx(playerid, 100000);
SetPlayerHealthEx(playerid, 100000);
GetPlayerName(playerid, sendername, sizeof(sendername));
GiveNameSpace(sendername);
HidePM[playerid] = 0;
}

else if(PlayerInfo[playerid][pAdmin] == 5)
{
AdminDuty[playerid] = 1;
SetPlayerColor(playerid, 0xAA3333AA);
format(string, sizeof(string),"Administrator %s is now on-duty.", sendername);
ABroadCast(COLOR_GRAD2, string, 1);
SetPlayerArmourEx(playerid, 100000);
SetPlayerHealthEx(playerid, 100000);
GetPlayerName(playerid, sendername, sizeof(sendername));
GiveNameSpace(sendername);
HidePM[playerid] = 0;
}

else if(PlayerInfo[playerid][pAdmin] == 4)
{
AdminDuty[playerid] = 1;
SetPlayerColor(playerid, 0xAA3333AA);
format(string, sizeof(string),"Administrator %s is now on-duty.", sendername);
ABroadCast(COLOR_GRAD2, string, 1);
SetPlayerArmourEx(playerid, 100000);
SetPlayerHealthEx(playerid, 100000);
GetPlayerName(playerid, sendername, sizeof(sendername));
GiveNameSpace(sendername);
HidePM[playerid] = 0;
}
return 1;
}
else if(AdminDuty[playerid] == 0)
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
AdminDuty[playerid] = 0;
format(string, sizeof(string),"Administrator %s is now off-duty.", sendername);
ABroadCast(COLOR_GRAD2, string, 1);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not authorised to use this command!");
return 1;
}
}
return 1;
}

Blast3r
04/08/2013, 09:07 PM
if(!strcmp(cmdtext, "/adminduty", true) || !strcmp(cmdtext, "/aduty", true))
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] <= 3)
{
if(AdminDuty[playerid] == 0)
{
AdminDuty[playerid] = 1;
SetPlayerColor(playerid, 0xAA3333AA);
format(string, sizeof(string),"Administrator %s is now on-duty.", sendername);
ABroadCast(COLOR_GRAD2, string, 1);
SetPlayerArmourEx(playerid, 100000);
SetPlayerHealthEx(playerid, 100000);
GetPlayerName(playerid, sendername, sizeof(sendername));
GiveNameSpace(sendername);
HidePM[playerid] = 0;
}

else if(PlayerInfo[playerid][pAdmin] == 5)
{
AdminDuty[playerid] = 1;
SetPlayerColor(playerid, 0xAA3333AA);
format(string, sizeof(string),"Administrator %s is now on-duty.", sendername);
ABroadCast(COLOR_GRAD2, string, 1);
SetPlayerArmourEx(playerid, 100000);
SetPlayerHealthEx(playerid, 100000);
GetPlayerName(playerid, sendername, sizeof(sendername));
GiveNameSpace(sendername);
HidePM[playerid] = 0;
}

else if(PlayerInfo[playerid][pAdmin] == 4)
{
AdminDuty[playerid] = 1;
SetPlayerColor(playerid, 0xAA3333AA);
format(string, sizeof(string),"Administrator %s is now on-duty.", sendername);
ABroadCast(COLOR_GRAD2, string, 1);
SetPlayerArmourEx(playerid, 100000);
SetPlayerHealthEx(playerid, 100000);
GetPlayerName(playerid, sendername, sizeof(sendername));
GiveNameSpace(sendername);
HidePM[playerid] = 0;
}
return 1;
}
else if(AdminDuty[playerid] == 1)
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
AdminDuty[playerid] = 0;
format(string, sizeof(string),"Administrator %s is now off-duty.", sendername);
ABroadCast(COLOR_GRAD2, string, 1);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not authorised to use this command!");
return 1;
}
}
return 1;
}



You set the "else if" admin duty = 0, meaning that if he's off duty it'd set him off duty again, I just changed it with 1. Hope it worked.

C00K13M0N$73R
04/08/2013, 09:10 PM
Check your if statements. They're a bit mixed up.