13.01.2014, 18:02
Hello guys, I have an irritating thing with my /adminduty command. When i type it once ill get into admin suty. Thats okay. But when i want to get off dut and type i agaon, It is defined to kill. Heres the code
Please help me. I want to get off duty directly when i type it again by resetting my weapons and skin if my team.
Код:
CMD:adminduty(playerid,params[])
{
if(PlayerInfo[playerid][Level] >= 1)
{
if(PlayerInfo[playerid][OnDuty] == 0) {
PlayerInfo[playerid][OnDuty] = 1;
new str[128], AdminName[28];
GetPlayerName(playerid, AdminName, sizeof(AdminName));
format(str, sizeof(str), "Administrator %s is now on Admin duty.!", AdminName);
SendClientMessageToAll(0xF600F6FF, str);
SetPlayerSkin(playerid,217);
SetPlayerTeam(playerid,6);
SetVehicleHealth(VID[playerid], 9999999999.0);
Duty[playerid] = Create3DTextLabel("On Duty Admin\n!!Do Not Attack!!", 0xF600F6FF, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(Duty[playerid], playerid, 0.0, 0.0, 0.5);
SetPlayerColor(playerid, 0xF600F6FF);
SetPlayerHealth(playerid, 100000000000);
SetPlayerArmour(playerid, 100000000000);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 38,999999999);
Update3DTextLabelText(RankLabel[playerid], 0xFFFFFFFF, " ");
Update3DTextLabelText(DM[playerid], 0xFFFFFFFF, " ");
Update3DTextLabelText(GG[playerid], 0xFFFFFFFF, " ");
UpdateTextdraw(playerid);
gTeam[playerid] = TEAM_NONE;
gClass[playerid] = CLASS;
}
else if(PlayerInfo[playerid][OnDuty] == 1) {
PlayerInfo[playerid][OnDuty] = 0;
new str[128], AdminName[28];
GetPlayerName(playerid, AdminName, sizeof(AdminName));
format(str, sizeof(str), "Administrator %s is now off Admin duty.", AdminName);
SendClientMessageToAll(0xFD01FDAA, str);
SetPlayerHealth(playerid, 0);
Update3DTextLabelText(RankLabel[playerid], 0xFFFFFFFF, " ");
Update3DTextLabelText(Duty[playerid], 0xFFFFFFFF, " ");
ForceClassSelection(playerid);
SetPlayerHealth(playerid, 0);
SetPlayerArmour(playerid, 0);
new rand = random(sizeof(PlayerColors));
SetPlayerColor(playerid, PlayerColors[rand]);
}
} else return 0;
return 1;
}


