16.07.2010, 16:28
Okay I'm having a pretty serious problem so far, I've been having for some time, for some reason you are only able to enter house ID 0, I figured it might be something with a if statement but they are totally the way they should be and have worked earlier on.
This is for entering the normal way as supposed:
It's not reacting, it's returning like: return 0;
Anyhow I also made a command while trying to fix the problem and discovered that if you did a command like this:
Then you're able to enter, what I did was to remove the locked part, when that is there it just outputs that it's locked even if it isn't and sometimes return 0;(Unknown Server Command).
I tried to look at the loading but it isn't that, It gotta be one of these things but I can't see one single thing that would cause it not work? I've been doing some tests to test if the loading was working okay and it is.
I got some code at the OnPlayerKeyStateChange almost the same not having any problem with that:
Anybody who can see the issue with the houes parts?
P.S In case you misunderstood I'm not having any issues with the HQ part that's working perfectly fine even through it's the same in my eyes with small differences.
This is for entering the normal way as supposed:
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;
}
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;
}
}
Anyhow I also made a command while trying to fix the problem and discovered that if you did a command like this:
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 tried to look at the loading but it isn't that, It gotta be one of these things but I can't see one single thing that would cause it not work? I've been doing some tests to test if the loading was working okay and it is.
I got some code at the OnPlayerKeyStateChange almost the same not having any problem with that:
pawn Код:
for(new i = 0; i < sizeof(HQInfo); i++)
{
if(IsPlayerInRangeOfPoint(playerid,2.0,HQInfo[i][SpawnX],HQInfo[i][SpawnY],HQInfo[i][SpawnZ]))
{
if(HQInfo[i][Locked] == 1)
{
GameTextForPlayer(playerid,"~r~Closed",500,1);
}
else
{
SetPlayerPos(playerid,Int[HQInfo[i][Interior]][PosX],Int[HQInfo[i][Interior]][PosY],Int[HQInfo[i][Interior]][PosZ]);
SetPlayerInterior(playerid,Int[HQInfo[i][Interior]][Interior]);
}
}
else if(IsPlayerInRangeOfPoint(playerid,5.0,Int[HQInfo[i][Interior]][PosX],Int[HQInfo[i][Interior]][PosY],Int[HQInfo[i][Interior]][PosZ]))
{
SetPlayerPos(playerid,HQInfo[i][SpawnX],HQInfo[i][SpawnY],HQInfo[i][SpawnZ]);
SetPlayerInterior(playerid,0);
}
}
P.S In case you misunderstood I'm not having any issues with the HQ part that's working perfectly fine even through it's the same in my eyes with small differences.