20.12.2011, 14:01
How its impossible?
How i open boot or bonnet I have a out of car, exaple behind the car?
How i open boot or bonnet I have a out of car, exaple behind the car?
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,alarm,doors,1,1,objective);
CMD:openbonnet(playerid, params[]) { new vid; new engine,lights,alarm,doors,bonnet,boot,objective; GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); SetVehicleParamsEx(vid,engine,lights,alarm,doors,1,boot,objective); return 1; }
Код:
CMD:openbonnet(playerid, params[]) { new vid; new engine,lights,alarm,doors,bonnet,boot,objective; GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); SetVehicleParamsEx(vid,engine,lights,alarm,doors,1,boot,objective); return 1; } |
getPlayerClosestVehicle(playerid, Float:maximumDistance=-1.0)
{
if(!IsPlayerConnected(playerid))
return -1;
new
closestVehicle = -1,
Float:closestDistance = -1.0,
Float:currentDistance = 0.0,
Float:x0, Float:y0, Float:z0,
Float:x1, Float:y1, Float:z1;
GetPlayerPos(playerid, x0, y0, z0);
for(new checkVehicle; checkVehicle < MAX_VEHICLES; checkVehicle++)
{
if(!GetVehicleModel(checkVehicle)) // jeżeli pojazd o ID 'checkVehicle' ma model o ID '0' to pomijamy go
continue;
GetVehiclePos(checkVehicle, x1, y1, z1);
currentDistance = floatsqroot(floatadd(floatadd(floatpower(floatsub(x0, x1), 2), floatpower(floatsub(y0, y1), 2)), floatpower(floatsub(z0, z1), 2)));
if((maximumDistance == -1.0 || currentDistance < maximumDistance) && (closestDistance == -1.0 || currentDistance < closestDistance))
{
closestDistance = currentDistance;
closestVehicle = checkVehicle;
}
}
return closestVehicle;
}
CMD:openbonnet(playerid, params[]) { new vid = GetPlayerClosestVehicle(1.0, playerid); new engine,lights,alarm,doors,bonnet,boot,objective; GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); SetVehicleParamsEx(vid,engine,lights,alarm,doors,1,boot,objective); return 1; }