23.02.2015, 13:25
Hey guys i am in some trouble... I made a simple onduty/offduty system for admins, which shows if an admin is on or off duty in /admins (cmd that shows online admins), But i also wanted to add 3dtext labels above player's head when the commands are being used.
The problem is that when another admin uses the command, the 3d text label disappears from above the first admin's head. For example if they are 2 admins online and the first admin types /offduty its all ok, but when the second one then types /offduty, the 3d text label which says "Off Duty" disappears from above the first player. I really dont know whats wrong, but i tought maybe one of you does?
Here's the code:
and this on the top:
Thank you in advance
The problem is that when another admin uses the command, the 3d text label disappears from above the first admin's head. For example if they are 2 admins online and the first admin types /offduty its all ok, but when the second one then types /offduty, the 3d text label which says "Off Duty" disappears from above the first player. I really dont know whats wrong, but i tought maybe one of you does?
Here's the code:
Код:
CMD:onduty(playerid,params[]) { new string[128],playername[MAX_PLAYER_NAME]; if(PlayerInfo[playerid][Level] >= 1) { ONDUTY[playerid] = Create3DTextLabel("On Duty", 0x00FFFFAA, 0.0, 0.0, 2.0, 40, 0, 0); Delete3DTextLabel(OFFDUTY[playerid]); Attach3DTextLabelToPlayer(ONDUTY[playerid],playerid,0.0, 0.0, 0.4); SendCommandToAdmins(playerid,"ONDUTY"); GetPlayerName(playerid, playername, sizeof(playername)); format(string,128,"You are now on duty"); SendClientMessage(playerid,blue,string); dUserSetINT(PlayerName2(playerid)).("OnDuty",(1)); PlayerInfo[playerid][OnDuty] = 1; } else { SendClientMessage(playerid,COLOR_RED,"ERROR: You need to be admin to use this command"); } return 1; } CMD:offduty(playerid,params[]) { new string[128],playername[MAX_PLAYER_NAME]; if(PlayerInfo[playerid][Level] >= 1) { OFFDUTY[playerid] = Create3DTextLabel("Off Duty", 0x00FFFFAA, 0.0, 0.0, 2.0, 40, 0, 0); Delete3DTextLabel(ONDUTY[playerid]); Attach3DTextLabelToPlayer(OFFDUTY[playerid],playerid,0.0, 0.0, 0.4); SendCommandToAdmins(playerid,"OFFDUTY"); GetPlayerName(playerid, playername, sizeof(playername)); format(string,128,"You are now off duty"); SendClientMessage(playerid,blue,string); dUserSetINT(PlayerName2(playerid)).("OnDuty",(0)); PlayerInfo[playerid][OnDuty] = 0; } else { SendClientMessage(playerid,COLOR_RED,"ERROR: You need to be admin to use this command"); } return 1; }
Код:
new Text3D: ONDUTY[MAX_PLAYERS]; new Text3D: OFFDUTY[MAX_PLAYERS];