error 006: must be assigned to an array
#1

Hey Guys i have one problem with my house system.

my problem is pname.

code:
Код HTML:
if(dialogid == DIALOG_BUYHOUSE)
{
	if(response)
	{
	new label[526],text[256];
	for(new i = 0; i<MAX_HOUSES; i++)
	{
	if(IsPlayerInRangeOfPoint(playerid, 3.0, dataHouse[i][EnterX], dataHouse[i][EnterY],dataHouse[i][EnterZ]))
	{
	if(playerid < dataHouse[i][Price])return SendClientMessage(playerid,-1,"You are {FF0000}not{FFFFFF} have moneys for buy this house.");
	if(dataHouse[i][Owned] == 1)return SendClientMessage(playerid,-1,"This House owned from another player.");
	format(label,sizeof(label),"{00FF00}House ID:{FFFFFF}%d\n{00FF00}House Owner:{FFFFFF}%s\n{00FF00}House Locked: {FFFFFF}%d\n{00FF00}House Price:{FFFFFF} %d",i,dataHouse[i][Owner],dataHouse[i][Locked],dataHouse[i][Price]);
	DestroyDynamicMapIcon(dataHouse[i][MapIcon]);
	Delete3DTextLabel(dataHouse[i][hLabel]);
	DestroyPickup(dataHouse[i][Pick]);
	dataHouse[i][MapIcon] = CreateDynamicMapIcon(dataHouse[i][EnterX],dataHouse[i][EnterY],dataHouse[i][EnterZ], 32, 0, -1, -1, -1, 100.0);
	dataHouse[i][hLabel] = Create3DTextLabel(label, 0xFFFFFFFF, dataHouse[i][EnterX],dataHouse[i][EnterY],dataHouse[i][EnterZ], 25.0, 0, 0);
	dataHouse[i][Pick] = CreatePickup(1272, 1, dataHouse[i][EnterX],dataHouse[i][EnterY],dataHouse[i][EnterZ], 0);
	GivePlayerMoney(playerid,-dataHouse[i][Price]);
	dataHouse[i][Owned] = 1;
	new pname[24];
	GetPlayerName(playerid,pname,24);
	dataHouse[i][Owner] = pname;
	SaveHouse(i);
	format(text,sizeof(text),"You have {00FF00}successfully{FFFFFF} buy this house (ID:{FFFF00} %d{FFFFFF} | Price:{FFFF00} %d{FFFFFF})",dataHouse[i][ID],dataHouse[i][Price]);
	SendClientMessage(playerid,-1,text);
	}
	}
	
	}

}
thanks.
Reply
#2

Why not simply do this instead? About the error, it is pretty much self-explanatory that it is telling you to assign the string to an array.

pawn Код:
GetPlayerName(playerid, dataHouse[i][Owner], MAX_PLAYER_NAME);
Reply
#3

Not Working...
Reply
#4

Here you go:

FIND THIS:
pawn Код:
dataHouse[i][Owner] = pname;
CHANGE TO THIS:
Код:
format(dataHouse[i][Owner], 24, "%s", pname);
Reply
#5

Hm... now not save player name ...
Reply
#6

no now save player name!
my problem is now :P can't saved all player name this my name is George and saved only Ge rge
and saved random price wtf
Reply
#7

Change this:
Код:
new pname[24];
GetPlayerName(playerid,pname,24);
format(dataHouse[i][Owner], 24, "%s", pname);
To this:
Код:
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(dataHouse[i][Owner], sizeof(pname), "%s", pname);
Also post your SaveHouse(i).
Reply
#8

Thanks man i working now i have one crazy problem -_-
me buy one house and price is 0$ and server removed -78 wtf?
and auto save price = 78 -_-

code:
Код HTML:
if(dialogid == DIALOG_BUYHOUSE)
{
	if(response)
	{
	new label[526],text[256];
	for(new i = 0; i<MAX_HOUSES; i++)
	{
	if(IsPlayerInRangeOfPoint(playerid, 3.0, dataHouse[i][EnterX], dataHouse[i][EnterY],dataHouse[i][EnterZ]))
	{
	if(playerid < dataHouse[i][Price])return SendClientMessage(playerid,-1,"You are {FF0000}not{FFFFFF} have moneys for buy this house.");
	if(dataHouse[i][Owned] == 1)return SendClientMessage(playerid,-1,"This House owned from another player.");
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
	format(dataHouse[i][Owner], sizeof(pname), "%s", pname);
	format(label,sizeof(label),"{00FF00}House ID:{FFFFFF}%d\n{00FF00}House Owner:{FFFFFF}%s\n{00FF00}House Locked: {FFFFFF}%d\n{00FF00}House Price:{FFFFFF} %d",i,dataHouse[i][Owner],dataHouse[i][Locked],dataHouse[i][Price]);
	DestroyDynamicMapIcon(dataHouse[i][MapIcon]);
	Delete3DTextLabel(dataHouse[i][hLabel]);
	DestroyPickup(dataHouse[i][Pick]);
	dataHouse[i][MapIcon] = CreateDynamicMapIcon(dataHouse[i][EnterX],dataHouse[i][EnterY],dataHouse[i][EnterZ], 32, 0, -1, -1, -1, 100.0);
	dataHouse[i][hLabel] = Create3DTextLabel(label, 0xFFFFFFFF, dataHouse[i][EnterX],dataHouse[i][EnterY],dataHouse[i][EnterZ], 25.0, 0, 0);
	dataHouse[i][Pick] = CreatePickup(1272, 1, dataHouse[i][EnterX],dataHouse[i][EnterY],dataHouse[i][EnterZ], 0);
	GivePlayerMoney(playerid,-dataHouse[i][Price]);
    SaveInterior(i);
    dataHouse[i][Owned] = 1;
    dataHouse[i][Locked] = 0;
    dataHouse[i][Removed] = 0;
	SaveHouse(i);
	format(text,sizeof(text),"You have {00FF00}successfully{FFFFFF} buy this house (ID:{FFFF00} %d{FFFFFF} | Price:{FFFF00} %d{FFFFFF})",dataHouse[i][ID],dataHouse[i][Price]);
	SendClientMessage(playerid,-1,text);
	}
	}
	
	}

}
Reply
#9

Start by learning the basics. Start learning english basics also.

Don't use that kind of emoticons and be patient.
Reply
#10

Man i know basics -_- and yes i don't know good english ...
But I asked here to help me for my problem and not to tell me to learn the basics -_-

And i'am know c++,javascript,c#,html5,css3 some python and some java you say me for basics?
Rly? man -_-?

edit: i fix this problem (Price) and thx for help to me for format name and saved.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)