#1

PHP код:
new alabel[MAX_PLAYERS];
CMD:adminlabel(playeridparams[]) {
    if(
alabel[playerid] == 0)
    {
        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;
        }
    } else return 
SendClientMessage(playeridred"ERROR: You need to be admin to use this command");
    return 
1;

Код:
D:\SA-MP Servers\NZTDM\Gamemodes\NZTDM-1.pwn(36305) : error 029: invalid expression, assumed zero
D:\SA-MP Servers\TestServer\Gamemodes\TestServer.pwn(36305) : warning 215: expression has no effect
D:\SA-MP Servers\TestServer\Gamemodes\TestServer.pwn(36305) : error 001: expected token: ";", but found "return"
D:\SA-MP Servers\TestServer\Gamemodes\TestServer.pwn(36306) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#2

This line doesn't make sense..

Quote:

} else return SendClientMessage(playerid, red, "ERROR: You need to be admin to use this command");
return 1;

You didn't even add the case of is player an admin to add its "else", Also why did you put "else" just beside "}"
Reply
#3

can you give me the codes?
Reply
#4

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
Reply
#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


Forum Jump:


Users browsing this thread: 1 Guest(s)