i have the problem that my objects donґt destroy(fire+smoke donґt destroy....). the objects should be destroy , when a fire vehicle with driver in 29 meters distance between the house is , the driver should push the KEY_ACTION key that the fire objects delete. what is wrong? here my code:
Код:
[pwn]#include <a_samp>
#include <ocmd>
new checktimer;
new bool:FireObject[MAX_OBJECTS];
new bool:RauchObject[MAX_OBJECTS];
new tastegedrueckt[MAX_PLAYERS];
public OnFilterScriptInit()
{
checktimer = SetTimer("Feuerwehr",700,1);
for(new i = 0; i < MAX_PLAYERS; i++)
{
tastegedrueckt[i] = 0;
}
return 1;
}
forward Feuerwehr();
public Feuerwehr()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInRangeOfPoint(i, 26.0, 1243.8386230469, -909.07940673828, 47.313026428223))
{
if(IsPlayerInVehicle(i,(GetPlayerVehicleID(i))))
{
if(GetVehicleModel(GetPlayerVehicleID(i)) == 407)
{
new playerState = GetPlayerState(i);
if (playerState == PLAYER_STATE_DRIVER)
{
if(tastegedrueckt[i] == 1)
{
for(new o=0; o<sizeof(FireObject); o++)
{
if(FireObject[o])
{
Randomm = random(o);
if(Randomm == o)
{
DestroyObject(o);
FireObject[o]=false;
}
}
}
for(new o=0; o<sizeof(RauchObject); o++)
{
if(RauchObject[o])
{
Randommm = random(o);
if(Randommm == o)
{
DestroyObject(o);
RauchObject[o]=false;
}
}
}
}
}
}
}
}
}
}
}
stock CreateFireObject(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ)
{
new objectid = CreateObject(modelid, X, Y, Z, rX, rY, rZ);
FireObject[objectid] = true;
return 1;
}
stock DestroyFireObjects()
{
for(new o=0; o<sizeof(FireObject); o++)
{
if(FireObject[o])
{
DestroyObject(o);
FireObject[o]=false;
}
}
}
stock CreateRauchObject(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ)
{
new objectid = CreateObject(modelid, X, Y, Z, rX, rY, rZ);
RauchObject[objectid] = true;
return 1;
}
stock DestroyRauchObjects()
{
for(new o=0; o<sizeof(RauchObject); o++)
{
if(RauchObject[o])
{
DestroyObject(o);
RauchObject[o]=false;
}
}
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if ((newkeys & KEY_ACTION) && !(oldkeys & KEY_ACTION))
{
tastegedrueckt[playerid] = 1;
}
else
{
tastegedrueckt[playerid] = 0;
}
return 1;
}[/pwn]