SA-MP Forums Archive
Help with create a command for distance - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help with create a command for distance (/showthread.php?tid=310348)



Help with create a command for distance - Join7 - 11.01.2012

I need a code to limit VehicleSpawn, over the 15.0 distance from another car.


Re: Help with create a command for distance - Psymetrix - 11.01.2012

OK, I guess you could do something like;
pawn Код:
stock IsPlayerNearAnyVehicle( playerid, Float:distance )
{
    new Float:x, Float:y, Float:z;
    for( new i; i < MAX_VEHICLES; i ++ )
    {
        if ( GetVehicleModel( i ) )
        {
            GetVehiclePos( i, x, y, z );
            if( GetPlayerDistanceFromPoint( playerid, x, y, z) <= distance )
                return 1;
   
        }
    }
    return 0;
}



Re: Help with create a command for distance - Join7 - 12.01.2012

one question.
Where should I introduce a distance.