Admin on duty cmd(help)
#1

Hello i am trying to create a simple admin on duty cmd. But when i try to compile it then i get these errors

C:\Users\Folmer\Desktop\Data\dAdmin.pwn(256) : error 001: expected token: "-identifier-", but found "["
C:\Users\Folmer\Desktop\Data\dAdmin.pwn(257) : error 029: invalid expression, assumed zero
C:\Users\Folmer\Desktop\Data\dAdmin.pwn(257) : error 035: argument type mismatch (argument 2)
C:\Users\Folmer\Desktop\Data\dAdmin.pwn(257) : error 020: invalid symbol name ""
C:\Users\Folmer\Desktop\Data\dAdmin.pwn(257) : fatal error 107: too many error messages on one line

"Line 256" new aname[MAX_PLAYERS_NAME];
"Line 257 GetPlayerName(playerid,aname,sizeof(aname));
Reply
#2

Line 255 please.
Reply
#3

new string[128];
Reply
#4

edit in line 256 MAX_PLAYERS_NAME to MAX_PLAYER_NAME ( remove S)

Quote:
Originally Posted by a_samp.inc
#define MAX_PLAYER_NAME (24)
Reply
#5

Can we see the whole command please ?
Reply
#6

dcmd_aduty(playerid,params[])
{

if(PInfo[playerid][Logged] ==1)
{
if(PInfo[playerid][Level] < 2)
{
new string[128];
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid,aname,sizeof(aname));
format(string,sizeof(string),"Administrator %s is now on Admin Duty. Do not attack him",aname,playerid);
admin[playerid] = Create3DTextLabel("ADMIN ON DUTY[DONT ATTACK]",red,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(admin[playerid], playerid, 0.0, 0.0, 0.7);
GivePlayerWeapon(playerid,3;
SetPlayerArmour(playerid,999999);
SetPlayerHealth(playerid,999999);
return 1;
} else return SendClientMessage(playerid,LIGHTBLUE,"You need to be level 2 to use this command");
}else return SendClientMessage(playerid,LIGHTBLUE,"You need to be logged in to use commands");

}
Reply
#7

after editing to MAX_PLAYER_NAME still error comes up?

btw put it in [ pawn] (codehere) [ /pawn] ( remove spaces )
Reply
#8

Yes.
Reply
#9

Wow O_O
When player is LOWER than level 2, he can get on admin duty... change < 2 to >= 2
Reply
#10

Quote:
Originally Posted by Darkkx8
Посмотреть сообщение
pawn Код:
dcmd_aduty(playerid,params[])
{

    if(PInfo[playerid][Logged] ==1)
    {
       if(PInfo[playerid][Level] < 2)
       {
            new string[128];
            new aname[MAX_PLAYER_NAME];
            GetPlayerName(playerid,aname,sizeof(aname));
            format(string,sizeof(string),"Administrator %s is now on Admin Duty. Do not attack him",aname,playerid);
            admin[playerid] = Create3DTextLabel("ADMIN ON DUTY[DONT ATTACK]",red,30.0,40.0,50.0,40.0,0);
            Attach3DTextLabelToPlayer(admin[playerid], playerid, 0.0, 0.0, 0.7);
            GivePlayerWeapon(playerid,38);
            SetPlayerArmour(playerid,999999);
            SetPlayerHealth(playerid,999999);
            return 1;
            } else return SendClientMessage(playerid,LIGHTBLUE,"You need to be level 2 to use this command");
      }else return SendClientMessage(playerid,LIGHTBLUE,"You need to be logged in to use commands");

}
pawn Код:
dcmd_aduty(playerid,params[])
{

    if(PInfo[playerid][Logged] ==1)
    {
       if(PInfo[playerid][Level] < 2)
       {
            new string[128];
            new aname[MAX_PLAYER_NAME];
            GetPlayerName(playerid,aname,sizeof(aname));
            format(string,sizeof(string),"Administrator %s is now on Admin Duty. Do not attack him",aname,playerid);
            SendClientMessage(playerid, COLOR_RED, string); // you forgot this !! thats all...
            admin[playerid] = Create3DTextLabel("ADMIN ON DUTY[DONT ATTACK]",red,30.0,40.0,50.0,40.0,0);
            Attach3DTextLabelToPlayer(admin[playerid], playerid, 0.0, 0.0, 0.7);
            GivePlayerWeapon(playerid,38);
            SetPlayerArmour(playerid,999999);
            SetPlayerHealth(playerid,999999);
            return 1;
            } else return SendClientMessage(playerid,LIGHTBLUE,"You need to be level 2 to use this command");
      }else return SendClientMessage(playerid,LIGHTBLUE,"You need to be logged in to use commands");

}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)