03.03.2015, 12:31
Probably define AdminLabel this way :
Edit : use print("line ( 1 , 2 ... n )") in multiple lines to see when the code ends.
Edit 2: after reading it well, I saw the flaw and its that you don't return after going on duty offduty
what you code does is :
if ( off duty )
set duty on ( you should just return 1 here )
if ( on duty )
set duty off. ( same thing )
Код:
AdminLabel[MAX_PLAYERS]; AdminLabel[playerid] = Create3DTextLabel("ADMIN ON DUTY\nDO NOT ATTACK",0x33DD1100,0.0, 0.0, 0.0, 40.0, 0, 0); Delete3DTextLabel(AdminLabel[playerid]);
Edit 2: after reading it well, I saw the flaw and its that you don't return after going on duty offduty
what you code does is :
if ( off duty )
set duty on ( you should just return 1 here )
if ( on duty )
set duty off. ( same thing )
Код:
CMD:adminduty(playerid, params[]) { if(!PInfo[playerid][Level]) return SendClientMessage(playerid, STEALTH_BLUE, "You need to be level 1 to go on admin duty."); CMDMessageToAdmins(playerid, "ADMINDUTY"); new string[55], pName[MAX_PLAYER_NAME]; new Text3D:AdminLabel; GetPlayerName(playerid, pName, sizeof(pName)); if(!PInfo[playerid][pAdminDuty]) { PInfo[playerid][God] = PInfo[playerid][GodCar] = PInfo[playerid][pAdminDuty] = 1; GetPlayerArmour(playerid, OldArmour[playerid]); OldSkin[playerid] = GetPlayerSkin(playerid); GetPlayerPos(playerid,PosX[playerid],PosY[playerid],PosZ[playerid]); for(new i; i < 13; ++i) { GetPlayerWeaponData(playerid, i, OldWeapon[playerid][i], OldAmmo[playerid][i]); } SetPlayerSkin(playerid, 217); ResetPlayerWeapons(playerid); GivePlayerWeapon(playerid, 38, 99999); format(string, sizeof(string), "Administrator %s is now on Admin Duty.", pName); AdminLabel = Create3DTextLabel("ADMIN ON DUTY\nDO NOT ATTACK",0x33DD1100,0.0, 0.0, 0.0, 40.0, 0, 0); Attach3DTextLabelToPlayer(AdminLabel,playerid, 0.0, 0.0, 0.7); SendClientMessageToAll(COLOR_MENUHIGHLIGHT, string); if(PInfo[playerid][ASP] == 1) OldHealth[playerid] = 100.0; else GetPlayerHealth(playerid, OldHealth[playerid]); return 1; } else if(PInfo[playerid][pAdminDuty]) { PInfo[playerid][God] = PInfo[playerid][GodCar] = PInfo[playerid][pAdminDuty] = 0; format(string, sizeof(string), "Administrator %s is now off Admin Duty.", pName); SetPlayerSkin(playerid,OldSkin[playerid]); SetPlayerHealth(playerid,OldHealth[playerid]); SetPlayerArmour(playerid, OldArmour[playerid]); SetPlayerPos(playerid,PosX[playerid],PosY[playerid],PosZ[playerid]); ResetPlayerWeapons(playerid); for(new i; i < 13; ++i) { GivePlayerWeapon(playerid, OldWeapon[playerid][i], OldAmmo[playerid][i]); } Delete3DTextLabel(AdminLabel); SendClientMessageToAll(COLOR_MENUHIGHLIGHT, string); return 1; } return 1; }