Get nearby vehicle's ID & check if player is near that vehicles boot eg?
#1

Hello.

How should I get nearby vehicle's ID? I think it would be possible if I'd hook it up with MySQL database, since I'm creating a SQL based gamemode anyway, it wouldn't be a problem. I think it should be possible to use a loop too.

It should be something like this, if using a loop...
pawn Код:
SetNearbyVehicleParam(playerid)
{
    new Float:x, Float:y, Float:z, Float:radi;
    GetPlayerPos(playerid, x, y, z);
    Float:radi = 3.0;
    for(new i=1; i<MAX_VEHICLES; i++) {
        if(GetVehicleModel(i)) {
            new Float:posx, Float:posy, Float:posz;
            new Float:tempposx, Float:tempposy, Float:tempposz;
            new engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(i, engine, lights, alarm, doors, bonnet, boot, objective);
            GetVehiclePos(i, posx, posy, posz);
            tempposx = (posx - x);
            tempposy = (posy - y);
            tempposz = (posz - z);
            if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) {
                // Setting the vehicle's params here.
            }
        }
    }
}
Is there any way to check if player is near vehicle's specific point, eg. boot?
Reply


Messages In This Thread
Get nearby vehicle's ID & check if player is near that vehicles boot eg? - by HP - 18.05.2011, 09:41
Re: Get nearby vehicle's ID & check if player is near that vehicles boot eg? - by __ - 18.05.2011, 09:54
Re: Get nearby vehicle's ID & check if player is near that vehicles boot eg? - by HP - 18.05.2011, 10:28

Forum Jump:


Users browsing this thread: 1 Guest(s)