13.11.2011, 14:42
Try this code:
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_SECONDARY_ATTACK)
{
new pxVW = GetPlayerVirtualWorld(playerid);
for(new b = 1; b<=MAX_BUYABLE_BUS; b++)
{
if(IsPlayerInRangeOfPoint(playerid, 1.0, 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]);
break;
}
else if(IsPlayerInRangeOfPoint(playerid, 1.0, 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]);
break;
}
}
for(new c = 1; c<=MAX_FACTIONS; c++)
{
if(IsPlayerInRangeOfPoint(playerid, 1.0, F_DATA[c][fEnterX], F_DATA[c][fEnterY], F_DATA[c][fEnterZ]))
{
SetPlayerPos(playerid, F_DATA[c][fExitX], F_DATA[c][fExitY], F_DATA[c][fExitZ]);
SetPlayerInterior(playerid, F_DATA[c][fInt]);
SetPlayerVirtualWorld(playerid, F_DATA[c][fVW]);
break;
}
else if(IsPlayerInRangeOfPoint(playerid, 1.0, F_DATA[c][fExitX], F_DATA[c][fExitY], F_DATA[c][fExitZ]) && pxVW == F_DATA[c][fVW])
{
SetPlayerPos(playerid, F_DATA[c][fEnterX], F_DATA[c][fEnterY], F_DATA[c][fEnterZ]);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
break;
}
}
}
return 1;
}