SA-MP Forums Archive
Is this a wrong way to check? - 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)
+--- Thread: Is this a wrong way to check? (/showthread.php?tid=596141)



Is this a wrong way to check? - Ritzy2K - 13.12.2015

Well, i check if the playerid matches the houseowner id, im not sure this shows an error, do i use any other way?

Код:
 playerid == houseOwner[playerid]
This shows me error.
Код:
invalid subscript (not an array or too many subscripts): "houseOwner"
warning 215: expression has no effect
 error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
im not sure why.


Re: Is this a wrong way to check? - RoboN1X - 13.12.2015

Please show the array houseOwner and the code where you use playerid (that conditional part)


Re: Is this a wrong way to check? - jlalt - 13.12.2015

try to save houseonwer on other thing and then check if same example:
PHP код:
new houseid1 houseOwner[playerid];
// then:
if(playerid == houseOwner[playerid]) { 
//... 



Re: Is this a wrong way to check? - Ritzy2K - 13.12.2015

Okay, this is my housedata enum
Код:
enum houseData {
	houseID,
	houseExists,
	houseOwner,
	housePrice,
	houseAddress[32],
	Float:housePos[4],
	Float:houseInt[4],
	houseInterior,
	houseExterior,
	houseExteriorVW,
	houseLocked,
	houseMoney,
	houseMapIcon,
	Text3D:houseText3D,
	housePickup,
	houseLights,
	houseWeapons[10],
	houseAmmo[10]
};
and i check this in a command
Код:
if (playerid == houseOwner[playerid])
but it shows me error. the one mentioned above im not sure why.


Re: Is this a wrong way to check? - jlalt - 13.12.2015

Quote:
Originally Posted by [ND]xXZeusXx.
Посмотреть сообщение
Okay, this is my housedata enum
Код:
enum houseData {
	houseID,
	houseExists,
	houseOwner,
	housePrice,
	houseAddress[32],
	Float:housePos[4],
	Float:houseInt[4],
	houseInterior,
	houseExterior,
	houseExteriorVW,
	houseLocked,
	houseMoney,
	houseMapIcon,
	Text3D:houseText3D,
	housePickup,
	houseLights,
	houseWeapons[10],
	houseAmmo[10]
};
and i check this in a command
Код:
if (playerid == houseOwner[playerid])
but it shows me error. the one mentioned above im not sure why.
you need to add something below them to load from example:
PHP код:
new HouseInfo[MAX_HOUSES][houseData]; 
then later //
PHP код:
if (playerid == Houseinfo[playerid][houseOwner]) { 



Re: Is this a wrong way to check? - RoboN1X - 13.12.2015

Show also the array that uses houseData, also the command code duh.


Re: Is this a wrong way to check? - Ritzy2K - 13.12.2015

Quote:
Originally Posted by jlalt
Посмотреть сообщение
you need to add something below them to load from example:
PHP код:
new HouseInfo[MAX_HOUSES][houseData]; 
then later //
PHP код:
if (playerid == Houseinfo[playerid][houseOwner]) { 
Thankyou, fixed.
it's supposed to be.
Код:
playerid == HouseData[id][houseOwner]
Stupid me :P