SA-MP Forums Archive
error - undefined symbol "i" - 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 - undefined symbol "i" (/showthread.php?tid=252108)



error - undefined symbol "i" - FCRP - 30.04.2011

Hello, I trying to resolve the error " undefined symbol i ", but with no luck.

Here's the code:

Код:
	else if(PlayerInfo[playerid][pHousekey] == i)
	{
		SetPlayerInterior(playerid,0);
	        SetPlayerToTeamColor(playerid);
		SetPlayerVirtualWorld(playerid,0);
		SetPlayerPos(playerid,HouseInfo[i][hEntrancex],HouseInfo[i][hEntrancey],HouseInfo[i][hEntrancez]);
		return 1;
	}
Thanks


Re: error - undefined symbol "i" - Hornet600 - 30.04.2011

"i" It's a variable and i assume you did not script that
add a loop with your code inside
pawn Код:
for(new i; i < MAX_HOUSES; i++)
{
// YOUR CODE GOES HERE sorry caps
}
Good luck


Re: error - undefined symbol "i" - FCRP - 30.04.2011

Код:
	else if(PlayerInfo[playerid][pHousekey] == i)
	{
	for(new i; i < MAX_HOUSES; i++)
	{
		SetPlayerInterior(playerid,0);
	        SetPlayerToTeamColor(playerid);
		SetPlayerVirtualWorld(playerid,0);
		SetPlayerPos(playerid,HouseInfo[i][hEntrancex],HouseInfo[i][hEntrancey],HouseInfo[i][hEntrancez]);
		return 1;
		}
	}
Thanks for reply, but now are the following issues:
undefined symbol "i"
undefined symbol "MAX_HOUSES"

btw. I'm using a Godfather edit.

Tried with:

for(new i = 0; i < sizeof(HouseInfo); i++)

now it's " undefined symbol "i" "


Re: error - undefined symbol "i" - Seven_of_Nine - 30.04.2011

Код:
        for(new i; i < MAX_HOUSES; i++)
        {
	     else if(PlayerInfo[playerid][pHousekey] == i)
	     {
		     SetPlayerInterior(playerid,0);
	             SetPlayerToTeamColor(playerid);
		     SetPlayerVirtualWorld(playerid,0);
		     SetPlayerPos(playerid,HouseInfo[i][hEntrancex],HouseInfo[i][hEntrancey],HouseInfo[i][hEntrancez]);
		     return 1;
	     }
	}
Because you create i after the statement!

EDIT: and define MAX_HOUSES:
pawn Код:
//top of the code
#define MAX_HOUSES [your max houses numbers, like..] 50



Re: error - undefined symbol "i" - FCRP - 30.04.2011

I got MAX_HOUSES defined as SCRIPT_MAXHOUSES, so there's no problem.

Script looks like this - http://codepad.org/6gZB83zm

error 029: invalid expression, assumed zero
error 001: expected token: ";", but found "if"
error 029: invalid expression, assumed zero
error 001: expected token: ";", but found "if"

New errors, help please? :S


Re: error - undefined symbol "i" - MadeMan - 30.04.2011

Show more code.


Re: error - undefined symbol "i" - FCRP - 30.04.2011

If I remove

for(new i; i < SCRIPT_MAXHOUSES; i++)

those errors disappear and only one is

" undefined symbol "i" "


Re: error - undefined symbol "i" - FCRP - 01.05.2011

Bump after 24hours.


Re: error - undefined symbol "i" - MadeMan - 01.05.2011

You have to show more code. If you don't, then don't expect any help.