SA-MP Forums Archive
If Player Near a specific vehicle - 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: If Player Near a specific vehicle (/showthread.php?tid=489575)



If Player Near a specific vehicle - EthanMason - 23.01.2014

Hello i've been working on a little script and sadely i'm in need of how to check if player near a specific vehicle. Please if you're trying to help me, do not just name some functions. i've been trying to do it.. but still cannot find a way. thanks +rep to whoever helps me.


Re: If Player Near a specific vehicle - Scottas - 23.01.2014

What do you mean by specific vehicle? By its unique vehicleid in server or by model ID? If you tried to do it, show us what you got.


Re : Re: If Player Near a specific vehicle - EthanMason - 23.01.2014

Quote:
Originally Posted by Scottas
Посмотреть сообщение
What do you mean by specific vehicle? By its unique vehicleid in server or by model ID? If you tried to do it, show us what you got.
I'm making an interior for a tropical (boat) so when i'm on the boat ( not as a driver) i type /enter and get tp'd to the interior


Re: If Player Near a specific vehicle - Scottas - 23.01.2014

pawn Код:
new
    Float: X, Float: Y, Float: Z, model;
GetPlayerPos(playerid, X, Y, Z);

for(new v = 1; v < MAX_VEHICLES; v++)
{
    if((model = GetVehicleModel(i)))
    {
        if(model == [boat modelid])
        {
            if(GetVehicleDistanceFromPoint(i, X, Y, Z) < 5.0)
            {
                // you are near boat
            }
        }
    }
}



Re: If Player Near a specific vehicle - RajatPawar - 23.01.2014

EDIT: The above