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); if(PInfo[playerid][ASP] == 1) OldHealth[playerid] = 100.0; else GetPlayerHealth(playerid, OldHealth[playerid]); } 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; }
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]);
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; }
new Text3D:AdminLabel[MAX_PLAYERS]; //Must be declared global
//Then in the Command
AdminLabel[playerid] = Create3DTextLabel(...);
I just explained above why It doesn't get attached.
Actually it does get attached but it gets destroyed right after it. |
new x=1;
if(x) print("hi"),x=0;
else if(!x) print("nope"),x=1;
print("end");