Array?What?i don't know any of these...
#1

Hello guys!

Today i'm in a trouble.

Код:
error 006: must be assigned to an array
Line :
Код:
ApartmentInfo[apid][Adresas] = GetPlayerZone(playerid);
I don't know how to work with strings :/
Reply
#2

Read through this.

https://sampforum.blast.hk/showthread.php?tid=318212

Learn, and you'll be able to fix it.
Reply
#3

pawn Код:
strcpy(ApartmentInfo[apid][Adresas], GetPlayerZone(playerid), 129);
pawn Код:
#define strcpy(%0,%1,%2) strcat((%0[0] = '\0', %0), %1, %2)
Reply
#4

i have already read it before and i'm felling like in space .

I tried like this

Код:
new zonename[129] = GetPlayerZone(playerid)

ApartmentInfo[apid][Adresas] = zonename;
Still getting errors :/
Reply
#5

Konstantinos , i don't really understand :/
Reply
#6

I'm not sure if you read my post after I edited it because I added the size you declared the array.

You cannot copy a string to another with assignment (=) if the sizes do not match so you should use strcat, memcpy, format.

This:
pawn Код:
strcpy(ApartmentInfo[apid][Adresas], GetPlayerZone(playerid), 129);
it's like doing:
pawn Код:
format(ApartmentInfo[apid][Adresas], 129, GetPlayerZone(playerid));
but format is slower.
Reply
#7

Nevermind , i made it with format .Thanks anyway!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)