What's wrong with this?
#1

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:

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;
}
This is the command, and with all other 'new' variables I put this:

pawn Код:
new Text3D:aDutyText[MAX_PLAYERS];
When I go on duty the text above my head doesn't show, please help. The script looks fine to me.
Reply
#2

This is obviously not going to work, considering you are making the 3d text draws position this:

X: 0, Y: 0, Z: -20.

Attach the 3d text draw to the player using Attach3DTextLabelToPlayer, not sure if that would work, considering there is no AttachDynamic3DTextLabelToPlayer in the streamer. Try it anyways.
Reply
#3

It works on my other server, just not on this one, the code I posted I mean.

Attach3DTextLabelToPlayer won't work.

Any other suggestions?
Reply
#4

Please help.
Reply
#5

Don't bump your post. And how would this work if the textdraw is not attached to the player?

This is simply creating a text draw at the position 0, 0, -20.

Unless this is a different code then the other one, it's not possible for it to work on other servers.

I don't know what to tell you, though.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)