SA-MP Forums Archive
Admin on duty cmd(help) - 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: Admin on duty cmd(help) (/showthread.php?tid=285537)



Admin on duty cmd(help) - Darkkx8 - 24.09.2011

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));


Re: Admin on duty cmd(help) - CmZxC - 24.09.2011

Line 255 please.


Re: Admin on duty cmd(help) - Darkkx8 - 24.09.2011

new string[128];


Re: Admin on duty cmd(help) - CmZxC - 24.09.2011

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)



Re: Admin on duty cmd(help) - grand.Theft.Otto - 24.09.2011

Can we see the whole command please ?


Re: Admin on duty cmd(help) - Darkkx8 - 24.09.2011

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");

}


Re: Admin on duty cmd(help) - CmZxC - 24.09.2011

after editing to MAX_PLAYER_NAME still error comes up?

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


Re: Admin on duty cmd(help) - Darkkx8 - 24.09.2011

Yes.


Re: Admin on duty cmd(help) - CmZxC - 24.09.2011

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


Re: Admin on duty cmd(help) - Kaperstone - 24.09.2011

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");

}