25.12.2012, 10:57
Also, the latency between the server and the player in the car affects the explosion too, because if the vehicle goes in top speed and the player has a relatively high ping, the explosion won't affect the car. The explosion will be placed something with a half coordinate away from the vehicle.
My solution (edited off RuiGy's code) would be:
My code will turn off the engine of the vehicle and then create the explosion. You could also do it like this:
My solution (edited off RuiGy's code) would be:
pawn Код:
CMD:explode(playerid, params[])
{
new vehicleid;
if(sscanf(params, "i", vehicleid)) return SendClientMessage(playerid, -1, "/explode [vehicleid]");
if(vehicle == INVALID_VEHICLE_ID) return SendClientMessage(playerid, -1, "Invalid vehicleid");
new engine, lights, alarm, doors, bonnet, boot, objective, Float:x, Float:y, Float:z;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 0, lights, false, doors, bonnet, boot, objective);
GetVehiclePos(vehicleid, x, y, z);
CreateExplosion(x, y, z, 12, 10.0);
return 1;
}
pawn Код:
CMD:explode(playerid, params[])
{
new vehicleid;
if(sscanf(params, "i", vehicleid)) return SendClientMessage(playerid, -1, "/explode [vehicleid]");
if(vehicle == INVALID_VEHICLE_ID) return SendClientMessage(playerid, -1, "Invalid vehicleid");
new Float:x, Float:y, Float:z;
GetVehiclePos(vehicleid, x, y, z);
SetVehiclePos(vehicleid, x, y, z);
CreateExplosion(x, y, z, 12, 10.0);
return 1;
}