Certain Object per Certain vehicle model
#1

Alright I believe my title was confusing enough, so let me explain my question.

I want to make a /flash command for police, which adds the siren mod(the red circular one) to the vehicle. I want it to see what vehicle model your in, then add the siren to a specific spot, based off the model.

I know this probably needs an array or w/e its called, so thanks in advanced to anyone who explains this to me!
Reply
#2

Using 0.3e RC6;
pawn Код:
COMMAND:siren(playerid, params[])
{
    if (GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, -1, "You must be the driver of a vehicle to use this command.");
    new objectid, vehicleid, Float:x, Float:y, Float:z;
    vehicleid = GetPlayerVehicleID(playerid);
    GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_SIZE, x, y, z);
    objectid = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
    AttachObjectToVehicle(objectid, vehicleid, 0.0, 0.0, floatadd(floatdiv(z, 2.0), 0.05), 0.0, 0.0, 0.0)
    return 1;
}
This gave me a chance to try GetVehicleModelInfo. Seems to work great.
Reply
#3

And this would make the siren appear perfectly on every single vehicle used? I thought you would have to like define the pos for each vehicle model
Reply
#4

No, It won't be perfect for all vehicles. If you try it on a boat, it will be floating in the air. I'm not sure what the best way to do it for all vehicles would be without manually collecting all the offsets. What I gave you was an example, something to get you started.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)