SA-MP Forums Archive
Vehicle position. - 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: Vehicle position. (/showthread.php?tid=553648)



Vehicle position. - Baltimore - 30.12.2014

xxxx


Re: Vehicle position. - Write - 30.12.2014

It's pretty simple.

pawn Код:
stock IsPlayerNearVehicle(playerid, vehicleid, Float:radius)
{
    new Float:x, Float:y, Float:z;
    GetVehiclePos(vehicleid, x, y, z);
    if(IsPlayerInRangeOfPoint(playerid, radius ,x, y, z))
    {
        return 1;
    }
    return 0;
}

new idveh,
    counter = 0;

for(new vehid = 1; vehid != MAX_VEHICLES; vehid++)
{
    new dist = if(IsPlayerNearVehicle(playerid, vehid, 5.0);
    if(dist)
    {
        idveh = vehid;
        counter++;
    }
}

if(counter == 0)
{
    counter = 0;
      return SendClientMessage(playerid, COLOR_ERREUR, "No vйhicle loan you.");
}
else if(counter > 1)
{
    counter = 0;
    return SendClientMessage(playerid, COLOR_ERREUR, "Too many vehicles you ready.");
}