SA-MP Forums Archive
Siren won't delete - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Siren won't delete (/showthread.php?tid=573717)



Siren won't delete - sammp - 09.05.2015

uh , well I'm using the good ol' sirens added in 0.3.7 and im having a weird problem (which isnt linked to the new sirens).


When I try to destroy the object, it doesn't do it.

pawn Код:
public OnVehicleSirenStateChange(playerid, vehicleid, newstate)
    {
        Siren[vehicleid] = CreateObject(19620, 0, 0, 0, 0, 0, 0, 0);
        if(newstate == 1 && !IsACarWithSirenObject(vehicleid))
        {
            AttachObjectToVehicle(Siren[vehicleid], vehicleid, 0.000000, -0.549499, 0.884999, 0.000000, 0.000000, 0.000000);
        }
        if(newstate == 0 && !IsACarWithSirenObject(vehicleid))
        {
            DestroyObject(Siren[vehicleid]);
        }
    }



AW: Siren won't delete - Mencent - 09.05.2015

Hello!

Try this:
PHP код:
public OnVehicleSirenStateChange(playerid,vehicleid,newstate)
{
    
Siren[vehicleid] = CreateObject(19620,0,0,0,0,0,0,0);
    if(
newstate == && !IsACarWithSirenObject(vehicleid))
    {
        
AttachObjectToVehicle(Siren[vehicleid],vehicleid,0.00,-0.549499,0.884999,0.0000,0.0000,0.0000);
        return 
1;
    }
    else if(
newstate == && !IsACarWithSirenObject(vehicleid))
    {
        
DestroyObject(Siren[vehicleid]);
    }
    return 
1;

If it doesn't work, what prints here?
PHP код:
public OnVehicleSirenStateChange(playerid,vehicleid,newstate)
{
    
printf("vehicleid: %i - newstate: %i - Objekt-ID: %i",vehicleid,newstate,Siren[vehicleid]);
    
Siren[vehicleid] = CreateObject(19620,0,0,0,0,0,0,0);
    if(
newstate == && !IsACarWithSirenObject(vehicleid))
    {
        print(
"newstate == 1");
        
AttachObjectToVehicle(Siren[vehicleid],vehicleid,0.00,-0.549499,0.884999,0.0000,0.0000,0.0000);
        return 
1;
    }
    else if(
newstate == && !IsACarWithSirenObject(vehicleid))
    {
        print(
"newstate == 0");
        
DestroyObject(Siren[vehicleid]);
    }
    return 
1;