Admin Login Help
#1

pawn Код:
dcmd_alog(playerid, params[])
{
    #pragma unused params
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    if(pName == "User1")
    {
        SendRconCommand("login 1234");
        return 1;
    }
    else
    {
    return 0;
    }
}
This command sends back this Error:
Код:
G:\GTA SA\gamemodes\Matts_Trial.pwn(218) : error 033: array must be indexed (variable "pName")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Please Help
Reply
#2

GetPlayerName(playerid, pName, sizeof(pName));
Reply
#3

ok thanks, it did the trick
Reply
#4

You cannot do this with string variables:

pawn Код:
if(pName == "User1")
It has to be something like:
pawn Код:
if(!strcmp(pName, "User1", true))
You can use strcmp (or sscanf) to compare any string... More information can be found here.
Reply
#5

Thanks for the help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)