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=66331)
error 006: must be assigned to an array -
Coicatak - 21.02.2009
pawn Код:
new Origin[MAX_PLAYER_NAME];
format(Origin, sizeof(Origin), "Nowhere");
PlayerInfo[playerid][pOrigin] = Origin; // error 006 here
What's wrong please?
Re: error 006: must be assigned to an array -
Dujma - 21.02.2009
pawn Код:
new Origin[MAX_PLAYER_NAME];
format(Origin, sizeof(Origin), "Nowhere");
strmid(PlayerInfo[playerid][pOrigin], string, 0, strlen(string), 128);
Re: error 006: must be assigned to an array -
Coicatak - 21.02.2009
Quote:
Originally Posted by Dujma
pawn Код:
new Origin[MAX_PLAYER_NAME]; format(Origin, sizeof(Origin), "Nowhere"); strmid(PlayerInfo[playerid][pOrigin], string, 0, strlen(string), 128);
|
Thanks a lot, but where's strmid function from? Which include? And could you please explain me how it works?
Re: error 006: must be assigned to an array -
pspleo - 21.02.2009
https://sampwiki.blast.hk/wiki/Scripting...ons_Old#strmid
Re: error 006: must be assigned to an array -
Dujma - 21.02.2009
You can change the string size to this
pawn Код:
strmid(PlayerInfo[playerid][pOrigin], string, 0, strlen(string), MAX_PLAYER_NAME);
Re: error 006: must be assigned to an array -
Coicatak - 21.02.2009
Quote:
Originally Posted by [K4L
|
Thanks a lot dude.
Quote:
Originally Posted by Dujma
You can change the string size to this
pawn Код:
strmid(PlayerInfo[playerid][pOrigin], string, 0, strlen(string), MAX_PLAYER_NAME);
|
I'll actually change it to 64 because I don't want it to have more the 64 characters
Thanks anyway
Re: error 006: must be assigned to an array -
Finn - 21.02.2009
Quote:
Originally Posted by Coicatak
dude.
I'll actually change it to 64 because I don't want it to have more the 64 characters
Thanks anyway 
|
It won't have more than (the amount of MAX_PLAYER_NAME) characters, because that's the size of the strings you're using.
pawn Код:
new Origin[MAX_PLAYER_NAME];
Just keep it empty, it should work.
Re: error 006: must be assigned to an array -
Dujma - 21.02.2009
Quote:
Originally Posted by Coicatak
Quote:
Originally Posted by [K4L
|
Thanks a lot
Quote:
Originally Posted by Dujma
You can change the string size to this
pawn Код:
strmid(PlayerInfo[playerid][pOrigin], string, 0, strlen(string), MAX_PLAYER_NAME);
|
dude.
I'll actually change it to 64 because I don't want it to have more the 64 characters
Thanks anyway 
|
hehe you already define that the max lenght of string is 16 so there is no point of using 128 or 64 for input.
Re: error 006: must be assigned to an array -
yom - 21.02.2009
What about
pawn Код:
#define MAX_ORIGIN_SIZE 64
//...
format(PlayerInfo[playerid][pOrigin], MAX_ORIGIN_SIZE, "Nowhere");
Re: error 006: must be assigned to an array -
Coicatak - 21.02.2009
Quote:
Originally Posted by Dujma
hehe you already define that the max lenght of string is 16 so there is no point of using 128 or 64 for input.
|
Oh really? Where?