Vehicle radius
#1

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.
Reply
#2

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

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!".
Reply
#4

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;
                }
            }
        } 
Reply
#5

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.
Reply
#6

Thanks again, rep+
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)