Hallo...
Einmal geht die Erstellung eines Fahrzeuges bei OnGameModeInit nicht.
Hier der Code
vehicle_id = AddStaticVehicle(560,1177.0503,-1308.5920,13.5996,267.7226,1,1);
sirenen [ vehicle_id ] = CreateObject(19419,0,0,-1000,0,0,0,100);
AttachObjectToVehicle(sirene, vehicle_id, -0.00000,0.225000,0.824999,0.000000,0.000000,0.000000);
Und dann geht ein Befehl nicht... Die Sirenen gehen nicht weg.
ocmd:sirene(playerid,params[])
{
if(IsPlayerAnAdmin(playerid,2))
{
new sirene,sirene2;
if(Sirene[playerid] == 0)
{
DestroyObject(sirene2);
sirene = CreateObject(19419,0,0,-1000,0,0,0,100);
AttachObjectToVehicle(sirene, GetPlayerVehicleID(playerid), -0.00000,0.225000,0.824999,0.000000,0.000000,0.000000);
Sirene[playerid] = 1;
new Float:X,Float:Y,Float:Z;
new string[128];
GetPlayerPos(playerid,X,Y,Z);
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerInRangeOfPoint(i,3.0,X,Y,Z))
{
format(string,sizeof(string),"%s schaltet die Sirene an.",SpielerName(playerid));
SendClientMessage(i,ME,string);
}
}
}
else if(Sirene[playerid] == 1)
{
DestroyObject(sirene);
sirene2 = CreateObject(19420,0,0,-1000,0,0,0,100);
AttachObjectToVehicle(sirene2, GetPlayerVehicleID(playerid), -0.00000,0.225000,0.824999,0.000000,0.000000,0.000000);
Sirene[playerid] = 0;
new Float:X,Float:Y,Float:Z;
new string[128];
GetPlayerPos(playerid,X,Y,Z);
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerInRangeOfPoint(i,3.0,X,Y,Z))
{
format(string,sizeof(string),"%s schaltet die Sirene aus.",SpielerName(playerid));
SendClientMessage(i,ME,string);
}
}
}
}
else
{
ERROR
}
return 1;
}
Ich hoffe Ihr wisst weiter