/enter dosent work correctly
#1

Hey,i have the /enter command,it will enter to house,it should be if Explored is same as hId,but when my Explored is 1 i can enter any houses even if hId is 2,i hope you understood.thanks

Код:
if(strcmp(cmdtext, "/enter", true) == 0)
{
for(new i = 0; i < sizeof(HouseInfo); i++)
{
if (IsPlayerInRangeOfPoint(playerid, 3 ,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]))
{
new Houseid;
Houseid = HouseInfo[ playerid ] [ hId ];
if(PlayerStatistics [playerid] [Explored] == Houseid)
{
SetPlayerInterior(playerid,HouseInfo[i][hInt]);
SetPlayerPos(playerid,HouseInfo[i][hExitx],HouseInfo[i][hExity],HouseInfo[i][hExitz]);
}
else GameTextForPlayer(playerid, "~r~You have to Explore this first!", 5000, 6);
}
}
return 1;
}
Reply
#2

Код:
if(PlayerStatistics [playerid] [Explored] == Houseid)
The problem is that you are not going through all the elements of the array "Explored".
Код:
if(strcmp(cmdtext, "/enter", true,6) == 0)
{
	for(new i = 0; i < sizeof(HouseInfo); i++)
	{
		if (IsPlayerInRangeOfPoint(playerid, 3 ,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]))
		{
			new Houseid;
			Houseid = HouseInfo[ playerid ] [ hId ];
			for(new j=0; j<MAX_EXPLORED; j++) // here you go through all houses explored by the player (change the MAX_EXPLORED to anything you have as max array size)
			{
				if(PlayerStatistics [playerid] [j] == Houseid)
				{
					SetPlayerInterior(playerid,HouseInfo[i][hInt]);
					SetPlayerPos(playerid,HouseInfo[i][hExitx],HouseInfo[i][hExity],HouseInfo[i][hExitz]);
				}
				else GameTextForPlayer(playerid, "~r~You have to Explore this first!", 5000, 6);
			}
		}
	}
	return 1;
}
Reply
#3

Код:
if(PlayerStatistics [playerid] [j] == Houseid)
Gives me tag mismatch and wont work :S

now i cant enter any house
EDIT:
fixed it in my written command,i false wrote playerid,but i had to write i:P
Код:
Houseid = HouseInfo[ playerid ] [ hId ];
to
Код:
Houseid = HouseInfo[ i ] [ hId ];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)