18.05.2011, 09:41
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...
Is there any way to check if player is near vehicle's specific point, eg. boot?
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.
}
}
}
}