Certain Object per Certain vehicle model - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Certain Object per Certain vehicle model (
/showthread.php?tid=331526)
Certain Object per Certain vehicle model -
Abreezy - 05.04.2012
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!
Re: Certain Object per Certain vehicle model -
Psymetrix - 05.04.2012
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.
Re: Certain Object per Certain vehicle model -
Abreezy - 05.04.2012
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
Re: Certain Object per Certain vehicle model -
Psymetrix - 05.04.2012
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.