CMD:siren(playerid, params[])
{
if (GetFactionType(playerid) != POLICE) // Only members of the PD are able to use the cmmand.
return SendErrorMessage(playerid, "You are not memebr of the Police Department");
if (!IsADetectiveVehicle(GetPlayerVehicleID(playerid))) // Using the stock below.
return SendErrorMessage(playerid, "You are not inside a detective vehicle.");
new objectid = CreateObject(19620, 0, 0, 0, 0, 0, 0);
AttachObjectToVehicle(objectid, GetPlayerVehicleID(playerid), 0.009999, -0.019999, 0.854999, 0.000000, 0.000000, 0.000000);
SendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "** %s places a siren on their vehicle and turns it on.", ReturnName(playerid, 0));
return 1;
}
stock IsADetectiveVehicle(vehicleid)
{
switch (GetVehicleModel(vehicleid)) {
case 560, 426, 507, 490: return 1; // If you want more cars to use the siren, just add their IDs here.
}
return 0;
}
AttachObjectToVehicle(objectid, GetPlayerVehicleID(playerid), 0.009999, -0.019999, 0.854999, 0.000000, 0.000000, 0.000000);
Is it automatically detected the coordinate of every vehicles to attach the sirens?
I see it's just attaching siren with same coordinate for every vehicles. Код:
AttachObjectToVehicle(objectid, GetPlayerVehicleID(playerid), 0.009999, -0.019999, 0.854999, 0.000000, 0.000000, 0.000000); *Sorry for my bad english. |
stock IsADetectiveVehicle(vehicleid)
{
switch (GetVehicleModel(vehicleid)) {
case 560, 426, 507, 490: return 1; // If you want more cars to use the siren, just add their IDs here.
}
return 0;
}