Admin Login 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Admin Login Help (
/showthread.php?tid=206254)
Admin Login Help -
wilko1995 - 03.01.2011
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
Re: Admin Login Help -
Yvax - 03.01.2011
GetPlayerName(playerid, pName,
sizeof(pName));
Re: Admin Login Help -
wilko1995 - 03.01.2011
ok thanks, it did the trick
Re: Admin Login Help -
Scenario - 03.01.2011
You cannot do this with string variables:
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.
Re: Admin Login Help -
wilko1995 - 03.01.2011
Thanks for the help