Error
#5

Quote:
Originally Posted by JasonRiggs
Посмотреть сообщение
PHP код:
new alabel[MAX_PLAYERS];
CMD:adminlabel(playeridparams[]) {
    if(
alabel[playerid] == 0)
    {
        if(!
PlayerInfo[playerid][Level]) return SendClientMessage(playeridred"ERROR: You need to be admin to use this command");
        if(
PlayerInfo[playerid][Level] == 1)
        {
            
Label[playerid] = Create3DTextLabel("Basic Moderator"0x00FF00FF0.00.00.040.00);
            
Attach3DTextLabelToPlayer(Label[playerid], playerid0.00.00.3);
            
SendClientMessage(playeridblue"Admin Label enabled!");
            
CMDMessageToAdmins(playerid"ADMINLABEL");
            
alabel[playerid] = 1;
        }
        else if(
PlayerInfo[playerid][Level] == 2)
        {
            
Label[playerid] = Create3DTextLabel("Moderator"0x00FF00FF0.00.00.040.00);
            
Attach3DTextLabelToPlayer(Label[playerid], playerid0.00.00.3);
            
SendClientMessage(playeridblue"Admin Label enabled!");
            
CMDMessageToAdmins(playerid"ADMINLABEL");
            
alabel[playerid] = 1;
        }
        else if(
PlayerInfo[playerid][Level] == 3)
        {
            
Label[playerid] = Create3DTextLabel("Master Moderator"0x00FF00FF0.00.00.040.00);
            
Attach3DTextLabelToPlayer(Label[playerid], playerid0.00.00.3);
            
SendClientMessage(playeridblue"Admin Label enabled!");
            
CMDMessageToAdmins(playerid"ADMINLABEL");
            
alabel[playerid] = 1;
        }
        else if(
PlayerInfo[playerid][Level] == 4)
        {
            
Label[playerid] = Create3DTextLabel("Administrator"0x00FF00FF0.00.00.040.00);
            
Attach3DTextLabelToPlayer(Label[playerid], playerid0.00.00.3);
            
SendClientMessage(playeridblue"Admin Label enabled!");
            
CMDMessageToAdmins(playerid"ADMINLABEL");
            
alabel[playerid] = 1;
        }
        else if(
PlayerInfo[playerid][Level] == 5)
        {
            
Label[playerid] = Create3DTextLabel("Master Admin"0x00FF00FF0.00.00.040.00);
            
Attach3DTextLabelToPlayer(Label[playerid], playerid0.00.00.3);
            
SendClientMessage(playeridblue"Admin Label enabled!");
            
CMDMessageToAdmins(playerid"ADMINLABEL");
            
alabel[playerid] = 1;
        }
        else if(
PlayerInfo[playerid][Level] == 6)
        {
            
Label[playerid] = Create3DTextLabel("Elite Admin"0x00FF00FF0.00.00.040.00);
            
Attach3DTextLabelToPlayer(Label[playerid], playerid0.00.00.3);
            
SendClientMessage(playeridblue"Admin Label enabled!");
            
CMDMessageToAdmins(playerid"ADMINLABEL");
            
alabel[playerid] = 1;
        }
        else if(
PlayerInfo[playerid][Level] == 7)
        {
            
Label[playerid] = Create3DTextLabel("General"0x00FF00FF0.00.00.040.00);
            
Attach3DTextLabelToPlayer(Label[playerid], playerid0.00.00.3);
            
SendClientMessage(playeridblue"Admin Label enabled!");
            
CMDMessageToAdmins(playerid"ADMINLABEL");
            
alabel[playerid] = 1;
        }
        else if(
PlayerInfo[playerid][Level] == 8)
        {
            
Label[playerid] = Create3DTextLabel("Director"0x00FF00FF0.00.00.040.00);
            
Attach3DTextLabelToPlayer(Label[playerid], playerid0.00.00.3);
            
SendClientMessage(playeridblue"Admin Label enabled!");
            
CMDMessageToAdmins(playerid"ADMINLABEL");
            
alabel[playerid] = 1;
        }
        else if(
IsPlayerAdmin(playerid))
        {
            
Label[playerid] = Create3DTextLabel("RCON Admin"0xFF0000FF0.00.00.040.00);
            
Attach3DTextLabelToPlayer(Label[playerid], playerid0.00.00.3);
            
SendClientMessage(playeridblue"Admin Label enabled!");
            
CMDMessageToAdmins(playerid"ADMINLABEL");
            
alabel[playerid] = 1;
        }
    }
    else
    {
        if(
alabel[playerid] == 1)
        {
            
Delete3DTextLabel(Text3D:Label[playerid]);
            
SendClientMessage(playeridred"Admin Label disabled!");
            
alabel[playerid] = 0;
        }
    } 
    return 
1;

there you go
You code should work.

Although, writing else along with '}' is not the cause of error. the error came because he had no added if(PlayerInfo[playerid][Level]) condition at the top.
Reply


Messages In This Thread
Error - by Filbert - 19.05.2018, 10:34
Re: Error - by JasonRiggs - 19.05.2018, 10:41
Re: Error - by Filbert - 19.05.2018, 10:44
Re: Error - by JasonRiggs - 19.05.2018, 11:06
Re: Error - by GTLS - 19.05.2018, 14:03

Forum Jump:


Users browsing this thread: 2 Guest(s)