SA-MP Forums Archive
Wierd attached objects bug. - 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: Wierd attached objects bug. (/showthread.php?tid=359586)



Wierd attached objects bug. - [WSF]ThA_Devil - 14.07.2012

Hello, I've been messing around with attached objects... now i am talking about pirate ships...
But when one pirate ship explodes what was caused by button press, other ship which shot loses attached objects.
Code:
pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
    for(new i = 0; i < MAX_SHIPS; i++)
    {
        if(vehicleid == piratev[i])
        {
            new Float:X,Float:Y,Float:Z,Float:RZ;
            GetVehiclePos(piratev[i],X,Y,Z);
            GetVehicleZAngle(piratev[i],RZ);
            for(new O = 0; O < MAX_SHIP_OBJECTS; O++)
            {
                DestroyDynamicObject(pirateo[piratev[i]][O]);
            }
            DestroyVehicle(piratev[i]);
        }
    }
   
    return 1;
}
I can't tell what's the problem is, code has no warnings / errors.
But why does it destroys wrong vehicle's objects?


Re: Wierd attached objects bug. - [WSF]ThA_Devil - 14.07.2012

Seems i've fixed it.
I had shipid = 0; under OnGameModeInit which caused game to mess up ids...
Now it seems when i moved it to top it works fine...