error array must be indexed (variable "tmp") - 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: error array must be indexed (variable "tmp") (
/showthread.php?tid=89024)
error array must be indexed (variable "tmp") -
Dj_maryo1993 - 30.07.2009
pawn Код:
if (strcmp("/login", cmdtext, true, 10) == 0)
{
if(PlayerInfo[playerid][Logedin] == 0)
{
new tmp[64];
new idx;
tmp = strtok(cmdtext, idx);
if( tmp == PlayerInfo[playerid][Password])
{
SendClientMessage(playerid, COLOR_YELLOW, "You Are Now Logged In");
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "Wrong Password");
}
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "You are already loged in");
}
}
Код:
D:\Multiple\Servere\Sa-mp\UnderProgress\gamemodes\underprogress.pwn(191) : error 033: array must be indexed (variable "tmp")
HELP PLEASE
Re: error array must be indexed (variable "tmp") -
Joe Staff - 30.07.2009
You're supposed to use the function "strcmp" when comparing 2 strings.
Try something like
if!strcmp(tmp,PlayerInfo[playerid][Password])
{
...
}
Re: error array must be indexed (variable "tmp") -
Dj_maryo1993 - 30.07.2009
Doesn't work , another problem , how do i read from file , but not all file .
For example i have AdminLevel=x , how do i read the x ?(the x is an number) .I wanna use this in basic kick , ban , slap etc commands , i tryed with wikipedia but i did not undestand anything.