error 006: must be assigned to an array
#1

Код:
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?
Reply
#2

Help Please.

I need it.

Thx.
Reply
#3

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

Код:
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.
Reply
#5

Код:
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
Reply
#6

Read >this<
Reply
#7

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);
Reply
#8

Why not use the string variable directly in the function ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)