Vehicle Explodes via /command
#5

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:

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;
}
My code will turn off the engine of the vehicle and then create the explosion. You could also do it like this:

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


Messages In This Thread
Vehicle Explodes via /command - by ShawtyyMacJunior - 25.12.2012, 00:34
Re: Vehicle Explodes via /command - by jNkk - 25.12.2012, 00:44
Re: Vehicle Explodes via /command - by [CG]Milito - 25.12.2012, 00:45
Re: Vehicle Explodes via /command - by Larceny - 25.12.2012, 00:47
Re: Vehicle Explodes via /command - by SKAzini - 25.12.2012, 10:57

Forum Jump:


Users browsing this thread: 1 Guest(s)