21.07.2012, 22:56
Whenever I type /adminduty I want it to display a 3D text label above my name in green saying 'Admin Duty', then when I type /adminduty again it should disappear. This is what I have so far:
This is the command, and with all other 'new' variables I put this:
When I go on duty the text above my head doesn't show, please help. The script looks fine to me.
pawn Код:
CMD:adminduty(playerid, params[]) {
if(playerVariables[playerid][pAdminLevel] >= 1) {
if(!strcmp(playerVariables[playerid][pAdminName], "(null)", true)) {
return SendClientMessage(playerid, COLOR_LIGHTRED, "You don't have an admin name set. Contact a higher Administrator first.");
}
else {
switch(playerVariables[playerid][pAdminDuty]) {
case 0: {
playerVariables[playerid][pAdminDuty] = 1;
GetPlayerHealth(playerid, playerVariables[playerid][pHealth]);
GetPlayerArmour(playerid, playerVariables[playerid][pArmour]);
SetPlayerName(playerid, playerVariables[playerid][pAdminName]);
SetPlayerHealth(playerid, 500000.0);
format(szMessage, sizeof(szMessage), "{8D8DFF}%s{F97804} is now on duty as an Administrator, /report for any major problems.", playerVariables[playerid][pAdminName], playerVariables[playerid][pNormalName]);
aDutyText[playerid] = CreateDynamic3DTextLabel("Admin Duty", COLOR_GREEN, 0, 0, -20, 25, playerid);
Streamer_SetFloatData(STREAMER_TYPE_3D_TEXT_LABEL,aDutyText[playerid] , E_STREAMER_ATTACH_OFFSET_Z, 0.35);
}
case 1: {
playerVariables[playerid][pAdminDuty] = 0;
SetPlayerName(playerid, playerVariables[playerid][pNormalName]);
SetPlayerHealth(playerid, playerVariables[playerid][pHealth]);
SetPlayerArmour(playerid, playerVariables[playerid][pArmour]);
format(szMessage, sizeof(szMessage), "{8D8DFF}%s{F97804} is now off duty as an Administrator.", playerVariables[playerid][pAdminName], playerVariables[playerid][pNormalName]);
DestroyDynamic3DTextLabel(aDutyText[playerid]);
}
}
SendClientMessageToAll(COLOR_HOTORANGE, szMessage);
}
}
return 1;
}
pawn Код:
new Text3D:aDutyText[MAX_PLAYERS];