GetPlayerDistanceFromPoint
#2

Logic problems try it like this it also allows you to add as many police stations as you like.

pawn Код:
// 0 = lspd, 1 = sfpd, 2 = lvpd

#define         MAX_POLICE_STATIONS     3

new Float:PDDist[MAX_POLICE_STATIONS], ClosestStation;

// Get distances
PDDist[0]=GetPlayerDistanceFromPoint(playerid,1554.9974,-1675.5564,16.4953);
PDDist[1]=GetPlayerDistanceFromPoint(playerid,-1605.5566,710.4965,13.8672);
PDDist[2]=GetPlayerDistanceFromPoint(playerid,288.6926,167.3528,1007.4719);

// Find closest distance
for(new i = 1; i < MAX_POLICE_STATIONS; i++) if(PDDist[i] < PDDist[ClosestStation]) ClosestStation = i;

// Teleport player
SetPlayerVirtualWorld(playerid,1);
switch(ClosestStation)
{
    case 0:
    {
        SetPlayerInterior(playerid,6);
        SetPlayerPos(playerid,264.7468,77.4799,1001.0391);
    }
    case 1:
    {
        SetPlayerInterior(playerid,10);
        SetPlayerPos(playerid,227.5555,111.0000,999.0156);
    }
    case 2:
    {
        SetPlayerInterior(playerid,3);
        SetPlayerPos(playerid,193.4588,175.0000,1003.0234);
    }
}
Reply


Messages In This Thread
GetPlayerDistanceFromPoint - by ATGOggy - 02.02.2015, 10:16
Re: GetPlayerDistanceFromPoint - by Pottus - 02.02.2015, 10:36
Re: GetPlayerDistanceFromPoint - by ATGOggy - 02.02.2015, 10:48

Forum Jump:


Users browsing this thread: 1 Guest(s)