12.11.2011, 23:51
Hey people again. Here's my 'thingy'. I have this under OnPlayerKeyStateChange:
Now, the problem is that for some reason, my second loop just wouldn't be called. I tried about everything, nothing seems to work. The thing is that I want to enter in a Business (First loop) and in a faction HQ (Second loop)... So, any suggestions with what might be wrong?
ps: I tried with prints all over the code, the second loop isn't called. Even tried to change the loops order, (Faction HQs first and business second). Same thing, only the first loop is called.
How can I fix it to call the second loop aswell ?
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_SECONDARY_ATTACK)
{
for(new b = 1; b<=MAX_BUYABLE_BUS; b++)
{
/*if(IsPlayerInAnyVehicle(playerid))
return 1;*/
new pxVW = GetPlayerVirtualWorld(playerid);
if(IsPlayerInRangeOfPoint(playerid, 1, B_DATA[b][bEnterX], B_DATA[b][bEnterY], B_DATA[b][bEnterZ]))
{
SetPlayerPos(playerid, B_DATA[b][bExitX], B_DATA[b][bExitY], B_DATA[b][bExitZ]);
SetPlayerInterior(playerid, B_DATA[b][bExitInt]);
SetPlayerVirtualWorld(playerid, B_DATA[b][bExitVW]);
return 1;
}
else if(IsPlayerInRangeOfPoint(playerid, 1, B_DATA[b][bExitX], B_DATA[b][bExitY], B_DATA[b][bExitZ]) && pxVW == B_DATA[b][bExitVW])
{
SetPlayerPos(playerid, B_DATA[b][bEnterX], B_DATA[b][bEnterY], B_DATA[b][bEnterZ]);
SetPlayerInterior(playerid, B_DATA[b][bEnterInt]);
SetPlayerVirtualWorld(playerid, B_DATA[b][bEnterVW]);
return 1;
}
}
for(new b = 1; b<=MAX_FACTIONS; b++)
{
/*if(IsPlayerInAnyVehicle(playerid))
return 1;*/
new pxVW = GetPlayerVirtualWorld(playerid);
if(IsPlayerInRangeOfPoint(playerid, 1, F_DATA[b][fEnterX], F_DATA[b][fEnterY], F_DATA[b][fEnterZ]))
{
SetPlayerPos(playerid, F_DATA[b][fExitX], F_DATA[b][fExitY], F_DATA[b][fExitZ]);
SetPlayerInterior(playerid, F_DATA[b][fInt]);
SetPlayerVirtualWorld(playerid, F_DATA[b][fVW]);
return 1;
}
else if(IsPlayerInRangeOfPoint(playerid, 1, F_DATA[b][fExitX], F_DATA[b][fExitY], F_DATA[b][fExitZ]) && pxVW == F_DATA[b][fVW])
{
SetPlayerPos(playerid, F_DATA[b][fEnterX], F_DATA[b][fEnterY], F_DATA[b][fEnterZ]);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
return 1;
}
//else return 1;
}
}
return 1;
}
ps: I tried with prints all over the code, the second loop isn't called. Even tried to change the loops order, (Faction HQs first and business second). Same thing, only the first loop is called.
How can I fix it to call the second loop aswell ?