error 006: must be assigned to an array - 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: error 006: must be assigned to an array (
/showthread.php?tid=432970)
error 006: must be assigned to an array -
TheDeath - 25.04.2013
Hello. I want to get ip of a player but when i try to set it in the enum i get errors:
Код:
C:\Users\Andrey\Desktop\samp03x_svr_R1-2_win32\gamemodes\cnr.pwn(177) : error 006: must be assigned to an array
Code:
Код:
format(query, sizeof(query), "SELECT * FROM users WHERE `user`='%s'", User(playerid));
mysql_query(query);
mysql_store_result();
new ip[16];
mysql_fetch_field("ip",ip);
P[playerid][IP] = ip;
mysql_free_result();
Re: error 006: must be assigned to an array -
iggy1 - 25.04.2013
Ip is a string not a number.
pawn Код:
P[playerid][IP] = ip;//not allowed
pawn Код:
strcat(P[playerid][IP], ip, 16);//allowed
EDIT: Even better still...
pawn Код:
mysql_fetch_field("ip", P[playerid][IP]);
Re: error 006: must be assigned to an array -
TheDeath - 25.04.2013
What about this one ?
Код:
if(P[playerid][IP] == UserIP(playerid))print("Yes");
---------------------------
error 033: array must be indexed (variable "UserIP")
Re: error 006: must be assigned to an array -
iggy1 - 25.04.2013
pawn Код:
if( !strcmp(P[playerid][IP], UserIP(playerid) ))
strcmp