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



Vehicle radius - Shazwan - 23.05.2015

How to make like a radius that must be near the vehicle.

Example vehicle that i want is shamal.

Код:
new vehicleid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleid) == 519) //shamal
The message send to client is "You are not near the shamal!".

Any ideas? I did try it on my own but failed, and i really need help.


Re: Vehicle radius - Alpay0098 - 23.05.2015

Can you edit your post (language problems).
No one can't understand what you're sayin


Re: Vehicle radius - Shazwan - 23.05.2015

Example,

They must be near the shamal to use /gunstorage, If they wasn't near the shamal it will tell the player that "you are not near the shamal!".


Re: Vehicle radius - Alpay0098 - 23.05.2015

You can use like below in /gunstroage scripts :
PHP код:
        for(new 0MAX_VEHICLESi++)
        {
            if(
GetVehicleModel(i) == 519)
            {
                new 
Float:shaxFloat:shayFloat:shaz;
                
GetVehiclePos(ishaxshayshaz);
                if(
IsPlayerInRangeOfPoint(playerid,8.0,shax,shay,shaz))
                {
                    
// Any code that you wanna put.
                
}
                else
                {
                    
SendClientMessage(playeridCOLOR_WHITE"You are not near a Shamal!");
                    return 
1;
                }
            }
        } 



Re: Vehicle radius - dominik523 - 23.05.2015

Are you looking for something like this?
pawn Код:
CMD:gunstorage(playerid, params[])
{
    new vehicleid
    if(ssanf(params, "d", vehicleid))
        return 1;

    if(GetVehicleModel(vehicleid) != 519)
        return 1;

    new Float:Pos[3];
    GetVehiclePos(vehicleid, Pos[0], Pos[1], Pos[2]);
    if(IsPlayerInRangeOfPoint(playerid, 5.0, Pos[0], Pos[1], Pos[2]))
    {
        // do something here
    }
    return 1;
}
This is an example where you have to enter vehicle's ID in the command. You could run a loop to find out is player standing near any shamal.


Re: Vehicle radius - Shazwan - 23.05.2015

Thanks again, rep+