18.05.2012, 19:51
Using zCmd:
You have to create a enum for vehicles, where there's a variable called vehiclesiren,
So, /siren = > Add Objects and set variable to 1, again /siren = > Remove Objects and set variable to 0. (Without variable you can't do Delete Siren)
Header:
Command:
This should work.
PHP код:
COMMAND:siren(playerid,params[])
{
new 1siren = CreateObject(18646,0,0,0,0,0,0);
new 2siren = CreateObject(18646,0,0,0,0,0,0);
AttachObjectToVehicle(1siren, GetPlayerVehicleID(playerid), -0.5, -0.2, 0.8, 2.0, 2.0, 3.0);
AttachObjectToVehicle(2siren, GetPlayerVehicleID(playerid), -0.5, -0.2, 0.8, 2.0, 2.0, 3.0);
return 1;
}
So, /siren = > Add Objects and set variable to 1, again /siren = > Remove Objects and set variable to 0. (Without variable you can't do Delete Siren)
Header:
PHP код:
#define MAX_VEHICLES selectmaxvehicles
enum VehiclesProperties {
UsingSiren,
Siren1,
Siren2
}
new VehicleInfo[MAX_VEHICLES][VehicleProperties];
PHP код:
COMMAND:siren(playerid,params[])
{
new vehicle = GetPlayerVehicleID(playerid);
VehicleInfo[vehicleid][Siren1] = CreateObject(18646,0,0,0,0,0,0);
VehicleInfo[vehicleid][Siren2] = CreateObject(18646,0,0,0,0,0,0);
if(VehicleInfo[vehicle][UsingSiren] == 0)
{
AttachObjectToVehicle(VehicleInfo[vehicleid][Siren1], GetPlayerVehicleID(playerid), -0.5, -0.2, 0.8, 2.0, 2.0, 3.0);
AttachObjectToVehicle(VehicleInfo[vehicleid][Siren2], GetPlayerVehicleID(playerid), -0.5, -0.2, 0.8, 2.0, 2.0, 3.0);
VehicleInfo[vehicle][UsingSiren] = 1;
}
else
{
DestroyObject(VehicleInfo[vehicleid][Siren1]);
DestroyObject(VehicleInfo[vehicleid][Siren2]);
VehicleInfo[vehicle][UsingSiren] = 0;
}
}