SA-MP Forums Archive
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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: error 006: must be assigned to an array (/showthread.php?tid=75629)



error 006: must be assigned to an array - loleteviejo - 03.05.2009

Код:
new playerip[20];
GetPlayerIp(playerid,playerip,sizeof(playerip)); // 10040
PlayerInfo[playerid][pIP] = playerip;
Код:
C:\Documents and Settings\~\Desktop\~\~\~\~.pwn(10040) : error 006: must be assigned to an array
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

1 Error.
This save the IP of the Players.

їWhat's the Problem?


Re: error 006: must be assigned to an array - loleteviejo - 04.05.2009

Help Please.

I need it.

Thx.


Re: error 006: must be assigned to an array - Andom - 04.05.2009

Use:
pawn Код:
new playerip[16];
GetPlayerIp(playerid,playerip,sizeof(playerip)); // 10040
strmid(PlayerInfo[playerid][pIP], playerip, false, strlen(playerip), sizeof(playerip));



Re: error 006: must be assigned to an array - loleteviejo - 04.05.2009

Код:
new playerip[16];
GetPlayerIp(playerid,playerip,sizeof(playerip));
strmid(PlayerInfo[playerid][pIP], playerip, false, strlen(playerip), sizeof(playerip)); // 10040
Код:
C:\Documents and Settings\~\Desktop\~\~\~\~.pwn(10040): warning 213: tag mismatch
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

Header size:      8796 bytes
Code size:     1260792 bytes
Data size:     1673636 bytes
Stack/heap size:   16384 bytes; estimated max. usage: unknown, due to recursion
Total requirements: 2959608 bytes

1 Warning.



Re: error 006: must be assigned to an array - carlo rizzi - 04.05.2009

Код:
strmid(PlayerInfo[playerid][pIP], playerip, 0, strlen(playerip), sizeof(PlayerInfo[playerid][pIP])); // 10040
sizeof(PlayerInfo[playerid][pIP]) not sure if this will work if not try putting in the array size of pIP


Re: error 006: must be assigned to an array - HB - 04.05.2009

Read >this<


Re: error 006: must be assigned to an array - CracK - 04.05.2009

Add this at the very bottom of your script.
From dutils.inc, thanks Draco:
pawn Код:
/**
 * Sets a string's value to source.
 * @param  dest
 *      source
 *      count
 */

stock set(dest[],source[]) {
    new count = strlen(source);
    new i=0;
    for (i=0;i<count;i++) {
        dest[i]=source[i];
    }
    dest[count]=0;
}
And use:
pawn Код:
new playerip[16];
GetPlayerIp(playerid,playerip,sizeof(playerip));
set(PlayerInfo[playerid][pIP],playerip);



Re: error 006: must be assigned to an array - Donny_k - 04.05.2009

Why not use the string variable directly in the function ?