SA-MP Forums Archive
Spec off problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Spec off problem (/showthread.php?tid=403752)



Spec off problem - Fiore - 31.12.2012

Hello, i've a problem with speccing colors for admins, because if i spec off during adminduty the admin who's speccing spawn again, but the color of adminduty disapper, so i made under OnPlayerSpawn this:

pawn Код:
// Spec
        if(PlayerInfo[playerid][pAdmin] && !aDuty[playerid])
        {
            SetPlayerColor(playerid,COLOR_IRC);
            SetPlayerArmour(playerid, 9999999);
            SetPlayerHealth(playerid, 9999999);
            SetPlayerChatBubble(playerid, "(( ADMINDUTY ))", COLOR_DARKRED, 30, 999999999);
        }
But it doesn't work, anyone can help me please?


Re: Spec off problem - Konstantinos - 31.12.2012

It's only a color problem, or the whole part it doesn't work?


Re: Spec off problem - Fiore - 31.12.2012

Just color, the rest work fine.


Re: Spec off problem - Konstantinos - 31.12.2012

How did you defined COLOR_IRC? Can you show us, please.


Re: Spec off problem - Fiore - 31.12.2012

#define COLOR_IRC 0xBFFAFEAA

Already defined, it works fine when i go on aduty.


Re: Spec off problem - Fiore - 31.12.2012

I should define that aDuty status must be 1=onduty, how to make it?


Re: Spec off problem - Konstantinos - 31.12.2012

I'm not sure why it doesn't work, it should do if you are (PlayerInfo[playerid][pAdmin] == 1) AND (aDuty[playerid] == 0).
Are you sure you are these two?

- To your question.
pawn Код:
//0 = offduty
!aDuty[playerid]
//1 = onduty
aDuty[playerid]



Re: Spec off problem - Fiore - 31.12.2012

not like that, but like this:

aDuty = 0 // offduty

aDuty = 1 //on duty

look:

pawn Код:
CMD:aduty(playerid, params[])
{
    new string[128], file[32];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(!aDuty[playerid])
    {
        format(file, sizeof(file), "users/%s.ini", RPNU(playerid));
        format(file, sizeof(file), "users/%s.ini", RPNU(playerid));
        format(string, sizeof(string), "AdmWarn: Admin %s has gone on admin duty", RPN(playerid));
        SendClientMessageToAll(COLOR_GREEN, string);
        format(file, sizeof(file), "users/%s.ini", RPNU(playerid));
        aDuty[playerid] = 1;
        SetPlayerColor(playerid,COLOR_IRC);
        SetPlayerArmour(playerid, 9999999);
        SetPlayerHealth(playerid, 9999999);
        GetPlayerIp(playerid, PlayerInfo[playerid][pIP], 16);
        SetPlayerChatBubble(playerid, "(( ADMINDUTY ))", COLOR_DARKRED, 30, 999999999);
        /*format(string, sizeof(string), "(( ADMINDUTY ))", playerid);
        Delete3DTextLabel(aDutyText[playerid]);
        if(PlayerInfo[playerid][pAdmin] == 1) aDutyText[playerid] = Create3DTextLabel(string, COLOR_LIGHTGREEN, 0, 0, -20, 25, -1, 1);
        if(PlayerInfo[playerid][pAdmin] == 2) aDutyText[playerid] = Create3DTextLabel(string, COLOR_LIME, 0, 0, -20, 25, -1, 1);
        if(PlayerInfo[playerid][pAdmin] == 3) aDutyText[playerid] = Create3DTextLabel(string, COLOR_YELLOW, 0, 0, -20, 25, -1, 1);
        if(PlayerInfo[playerid][pAdmin] == 4) aDutyText[playerid] = Create3DTextLabel(string, COLOR_ORANGE, 0, 0, -20, 25, -1, 1);
        if(PlayerInfo[playerid][pAdmin] == 5) aDutyText[playerid] = Create3DTextLabel(string, COLOR_RED, 0, 0, -20, 25, -1, 1);
        if(PlayerInfo[playerid][pAdmin] == 6) aDutyText[playerid] = Create3DTextLabel(string, COLOR_DARKRED, 0, 0, -20, 25, -1, 1);
        Attach3DTextLabelToPlayer(aDutyText[playerid], playerid, 0, 0, 0.25);
        if(IsValidDynamic3DTextLabel(aDutyText[playerid]))  DestroyDynamic3DTextLabel(aDutyText[playerid]);
        if(PlayerInfo[playerid][pAdmin] == 1) aDutyText[playerid] = CreateDynamic3DTextLabel(string, COLOR_DARKRED, 0, 0, -20, 25, playerid);
        if(PlayerInfo[playerid][pAdmin] == 2) aDutyText[playerid] = CreateDynamic3DTextLabel(string, COLOR_DARKRED, 0, 0, -20, 25, playerid);
        if(PlayerInfo[playerid][pAdmin] == 3) aDutyText[playerid] = CreateDynamic3DTextLabel(string, COLOR_DARKRED, 0, 0, -20, 25, playerid);
        if(PlayerInfo[playerid][pAdmin] == 4) aDutyText[playerid] = CreateDynamic3DTextLabel(string, COLOR_DARKRED, 0, 0, -20, 25, playerid);
        if(PlayerInfo[playerid][pAdmin] == 5) aDutyText[playerid] = CreateDynamic3DTextLabel(string, COLOR_DARKRED, 0, 0, -20, 25, playerid);
        if(PlayerInfo[playerid][pAdmin] == 6) aDutyText[playerid] = CreateDynamic3DTextLabel(string, COLOR_DARKRED, 0, 0, -20, 25, playerid);
        if(PlayerInfo[playerid][pAdmin] == 7) aDutyText[playerid] = CreateDynamic3DTextLabel(string, COLOR_DARKRED, 0, 0, -20, 25, playerid);
        Streamer_SetFloatData(STREAMER_TYPE_3D_TEXT_LABEL, aDutyText[playerid] , E_STREAMER_ATTACH_OFFSET_Z, 0.30);*/

    }
    else
    {
        if(Spec[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You can't go off admin duty while spectating someone.");
        format(file, sizeof(file), "users/%s.ini",RPNU(playerid));
        aDuty[playerid] = 0;
        SetPlayerColor(playerid,COLOR_WHITE);
        SetPlayerArmour(playerid, 0);
        SetPlayerHealth(playerid, 100);
        format(file, sizeof(file), "users/%s.ini", RPNU(playerid));
        format(string, sizeof(string), "AdmWarn: Admin %s has went off admin duty", RPN(playerid));
        SendClientMessageToAll(COLOR_DARKRED, string);
        SetPlayerChatBubble(playerid, "(( ADMINDUTY ))", COLOR_DARKRED, 30, 0);
        //Delete3DTextLabel(aDutyText[playerid]);
        //DestroyDynamic3DTextLabel(aDutyText[playerid]);
    }
    return 1;
}



Re: Spec off problem - Konstantinos - 31.12.2012

Oh, I misunderstood. I posted what it should be on the if statement. But I still don't get what you mean.
If he is not on duty (0), set to 1
pawn Код:
aDuty[playerid] = 1;
else (if it's 1, set to 0)
pawn Код:
aDuty[playerid] = 0;



Re: Spec off problem - Fiore - 31.12.2012

Could you post the script, i don't understand what you mean.