Hallo Brotfische,
ich habe ein Problem mit meiner Sirene, sie geht zwar an aber nicht aus. Hier der define und die new´s
#define KEY_HORN 8
new bool:sirene[MAX_PLAYERS] = false; // sirene ist aus.
new sfl1 [MAX_VEHICLES];
new sfl2 [MAX_VEHICLES];
new sfl3 [MAX_VEHICLES];
new sfl4 [MAX_VEHICLES];
new sfl5 [MAX_VEHICLES];
So jetzt kommen wir zum eigentlichen Code, der auf der Taste "H" ausgeführt wird.
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_HORN)
{
if(sirene[playerid] == false)
{
new vehid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehid) == 451 && sfl1[vehid] == 0) // Turismo
{
sfl1[vehid] = CreateObject(19292,0,0,-1000,0,0,0,100);
sfl2[vehid] = CreateObject(19292,0,0,-1000,0,0,0,100);
sfl3[vehid] = CreateObject(19290,0,0,-1000,0,0,0,100);
sfl4[vehid] = CreateObject(19290,0,0,-1000,0,0,0,100);
sfl5[vehid] = CreateObject(19419,0,0,-1000,0,0,0,100);
AttachObjectToVehicle(sfl1[vehid],vehid,-0.000000,2.250000,0.000000,0.000000,0.000000,0.000000);
AttachObjectToVehicle(sfl2[vehid],vehid,0.000000,2.250000,0.000000,0.000000,0.000000,0.000000);
AttachObjectToVehicle(sfl3[vehid],vehid,0.000000,2.275000,0.000000,0.000000,0.000000,0.000000);
AttachObjectToVehicle(sfl4[vehid],vehid,-0.000000,2.275000,0.000000,0.000000,0.000000,0.000000);
AttachObjectToVehicle(sfl5[vehid], vehid, -0.000000, -0.704999, 0.544999, 0.000000, 0.000000, 0.000000);
sirene[playerid] = true;
}
else
{
DestroyObject(sfl1[GetPlayerVehicleID(playerid)]);
DestroyObject(sfl2[GetPlayerVehicleID(playerid)]);
DestroyObject(sfl3[GetPlayerVehicleID(playerid)]);
DestroyObject(sfl4[GetPlayerVehicleID(playerid)]);
DestroyObject(sfl5[GetPlayerVehicleID(playerid)]);
sfl1[GetPlayerVehicleID(playerid)] = 0;
sfl2[GetPlayerVehicleID(playerid)] = 0;
sfl3[GetPlayerVehicleID(playerid)] = 0;
sfl4[GetPlayerVehicleID(playerid)] = 0;
sfl5[GetPlayerVehicleID(playerid)] = 0;
sirene[playerid] = false;
return 1;
}
}
}
return 1;
}