/Aduty Command error
#1

pawn Код:
CMD:aduty(playerid, params[])
{
    new string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(PlayerInfo[playerid][pAdmin] >= 2 && aDuty[playerid] = 0)  //line 18161
    {
        format(string, sizeof(string), "AdmWarn: %s has went on duty", RPN(playerid));
        SendAdminMessage(COLOR_DARKRED, 1, string);
        aDuty[playerid] = 1;
       
        if(IsValidDynamic3DTextLabel(aDutyText[playerid]))  DestroyDynamic3DTextLabel(aDutyText[playerid]);
        if(PlayerInfo[playerid][pAdmin] == 1) aDutyText[playerid] = CreateDynamic3DTextLabel(string, COLOR_LIGHTGREEN, 0, 0, -20, 25, playerid);
        if(PlayerInfo[playerid][pAdmin] == 2) aDutyText[playerid] = CreateDynamic3DTextLabel(string, COLOR_LIME, 0, 0, -20, 25, playerid);
        if(PlayerInfo[playerid][pAdmin] == 3) aDutyText[playerid] = CreateDynamic3DTextLabel(string, COLOR_YELLOW, 0, 0, -20, 25, playerid);
        if(PlayerInfo[playerid][pAdmin] == 4) aDutyText[playerid] = CreateDynamic3DTextLabel(string, COLOR_ORANGE, 0, 0, -20, 25, playerid);
        if(PlayerInfo[playerid][pAdmin] == 5) aDutyText[playerid] = CreateDynamic3DTextLabel(string, COLOR_RED, 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.25);
    }
    else if(aDuty[playerid] = 1)
    {
        format(string, sizeof(string), "AdmWarn: %s has went off duty", RPN(playerid));
        SendAdminMessage(COLOR_DARKRED,1,string);
        DestroyDynamic3DTextLabel(aDutyText[playerid]);
    }
    return 1;
}
pawn Код:
C:\Users\MrSwindle\Desktop\LSC-RP\gamemodes\lsc.pwn(18161) : warning 211: possibly unintended assignment
C:\Users\MrSwindle\Desktop\LSC-RP\gamemodes\lsc.pwn(18161) : error 022: must be lvalue (non-constant)
C:\Users\MrSwindle\Desktop\LSC-RP\gamemodes\lsc.pwn(18161) : warning 215: expression has no effect
C:\Users\MrSwindle\Desktop\LSC-RP\gamemodes\lsc.pwn(18161) : error 001: expected token: ";", but found ")"
C:\Users\MrSwindle\Desktop\LSC-RP\gamemodes\lsc.pwn(18161) : error 029: invalid expression, assumed zero
C:\Users\MrSwindle\Desktop\LSC-RP\gamemodes\lsc.pwn(18161) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Anyone know what the problem is?
Reply
#2

You already checked if the player is an admin level two or higher:

Quote:

if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");

You don't need to check again if he is lower, because if he isn't you will just receive the returned message.

So change this:
Quote:

if(PlayerInfo[playerid][pAdmin] >= 2 && aDuty[playerid] = 0) //line 18161

To this:
Quote:

if(aDuty[playerid] = 0) //line 18161

Or this:
Quote:

if(!aDuty[playerid])

Reply
#3

Change this:

pawn Код:
if(PlayerInfo[playerid][pAdmin] >= 2 && aDuty[playerid] = 0)
Boy:

pawn Код:
if(PlayerInfo[playerid][pAdmin] >= 2 && aDuty[playerid] == 0)
pawn Код:
lse if(aDuty[playerid] = 1)
    {
        format(string, sizeof(string), "AdmWarn: %s has went off duty", RPN(playerid));
        SendAdminMessage(COLOR_DARKRED,1,string);
        DestroyDynamic3DTextLabel(aDutyText[playerid]);
    }
    return 1;
}
By

pawn Код:
else if(aDuty[playerid] == 1)
    {
        format(string, sizeof(string), "AdmWarn: %s has went off duty", RPN(playerid));
        SendAdminMessage(COLOR_DARKRED,1,string);
        DestroyDynamic3DTextLabel(aDutyText[playerid]);
    }
    return 1;
}
Reply
#4

Thanks for the help guys!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)