House entering problem -
oliverrud - 15.07.2010
Okay so I got 29 houses on my server right now just randomly made for my system I'm making, anyways I went in to test the store command & stuff I had made but then I discovered I only could enter house ID 0, all the others didn't react when I pressed F or ENTER
Heres the house code for when pressing F or Enter
pawn Код:
for(new i = 0; i < sizeof(HouseInfo); i++)
{
if(IsPlayerInRangeOfPoint(playerid,4.0,HouseInfo[i][SpawnX],HouseInfo[i][SpawnY],HouseInfo[i][SpawnZ]))
{
if(HouseInfo[i][Locked] == 1)
{
GameTextForPlayer(playerid,"~r~Locked",500,1);
return 1;
}
else
{
SetPlayerPos(playerid,Int[HouseInfo[i][Interior]][PosX],Int[HouseInfo[i][Interior]][PosY],Int[HouseInfo[i][Interior]][PosZ]);
SetPlayerInterior(playerid,Int[HouseInfo[i][Interior]][Interior]);
SetPlayerVirtualWorld(playerid,HouseInfo[i][World]);
HouseEntered[playerid] = i;
printf("%s entered house id: %d",pname,HouseEntered[playerid]);
}
}
else if(IsPlayerInRangeOfPoint(playerid,5.0,Int[HouseInfo[HouseEntered[playerid]][Interior]][PosX],Int[HouseInfo[HouseEntered[playerid]][Interior]][PosY],Int[HouseInfo[HouseEntered[playerid]][Interior]][PosZ]))
{
SetPlayerPos(playerid,HouseInfo[HouseEntered[playerid]][SpawnX],HouseInfo[HouseEntered[playerid]][SpawnY],HouseInfo[HouseEntered[playerid]][SpawnZ]);
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid,0);
printf("%s exited house id: %d",pname,HouseEntered[playerid]);
HouseEntered[playerid] = 9999;
}
}
If the problem could be somewhere else then please tell me, I've been looking in my loading part but can't seem to find any problems there, however neither can I here
Re: House entering problem -
ikey07 - 15.07.2010
I guess in all these [][][][[][][] is somewhere some mismatch
or somewhere is return 1;
Re: House entering problem -
oliverrud - 15.07.2010
Well that's where I've been looking, I recently changed a SetPVarInt() to HouseEntered as I needed it later and that would be easy to handle.
I didn't change anything that should affect whether your able to enter the house the only thing that would be made unable was to exit as I didn't change anything in the enter part when adding the HouseEntered, only the HouseEntered[playerid] = i; and the one at printf but nothing else.
Re: House entering problem -
oliverrud - 15.07.2010
Update: Okay so I still have the problem however I made a command
pawn Код:
dcmd_aenter(playerid, params[])
{
#pragma unused params
if(PlayerAccount[playerid][Admin] >= 1)
{
for(new i = 0; i < sizeof(HouseInfo); i++)
{
if(IsPlayerInRangeOfPoint(playerid,4.0,HouseInfo[i][SpawnX],HouseInfo[i][SpawnY],HouseInfo[i][SpawnZ]))
{
SetPlayerPos(playerid,Int[HouseInfo[i][Interior]][PosX],Int[HouseInfo[i][Interior]][PosY],Int[HouseInfo[i][Interior]][PosZ]);
SetPlayerInterior(playerid,Int[HouseInfo[i][Interior]][Interior]);
SetPlayerVirtualWorld(playerid,HouseInfo[i][World]);
HouseEntered[playerid] = i;
printf("%s entered house id: %d",pname,HouseEntered[playerid]);
}
}
}
return 1;
}
I removed the locked part as for some reason if that was there I got it as if it was return 0; (Server Unknown Command), I now tried to do that with the OnPlayerKeyStateChange, however I had no luck whatsoever. It still came with the same as before, however HouseID 0 is still accessible but that's the only one.
Re: House entering problem -
[HiC]TheKiller - 15.07.2010
What happens when you do
pawn Код:
printf("%d", sizeof(HouseInfo));
Does it come up with a larger number than 0?
Re: House entering problem -
oliverrud - 15.07.2010
Yes 300 which is my MAX_HOUSES
Re: House entering problem -
oliverrud - 16.07.2010
Bump 8words.