Crazy bug.
#1

I've been messing with one of my scripts all day. I store the object id of an object. Later in the script, I call it to destroy that object. It doesn't. Now, right after I create the object I made it print what the value was. It was 6. Right before I destroy the object, it was 6. Right after I destroyed the object, it was 6. If I set my position to object 6, it puts me right on that object. But for whatever reason, it will not destroy that object. Some of the code around that also doesn't work. The code is getting called to destroy object 6 but it won't. When I was debugging, I added in a print statement to print some values, when I had that print statement in the code, it fixed the destroying part but messed something else up. Something that makes no sense at all to be broken. If adding in a print statement in fixes something, there must be a bug somewhere in sa:mp, pawn, or pawno. Any idea of what is happening?

Edit:I think I have an idea of what's happening but not sure why. I think parts of the code are getting called twice. As in, variables are being assigned to object ids two times. So it destroys the objects but there is one there with a different id so it looks like nothing happened. Any idea of why this might be happening?
Reply
#2

Show your script. Does it compile without any warnings or infos about stack size?
Reply
#3

It compiles fine. It seems random and different every time. I have no repeating timers or anything. If I reload the script without changing it at all, the bug will be different. They all have to do with destroying objects though. It just seems like the server or script just doesn't feel like calling parts of the script. I'll post all the variables I have right now. Maybe that's why?

pawn Код:
enum ShipInfo
{
    Ship,
    Sails,
    TimerID,
    Captain,
    bool:ShipMoving,
    Text:HealthText,
    Health,
    Float:X1,
    Float:Y1,
    Float:X2,
    Float:Y2,
    Float:X3,
    Float:Y3,
    Float:X4,
    Float:Y4
}

enum CannonInfo
{
    Count,
    TimerID,
    Cannon,
    CannonShot,
    Ammo,
    Float:fAngle,
    Float:fHeight,
    Float:BaseZ,
    Float:BaseX,
    Float:PosX,
    Float:PosY,
    CollisionChecker
}

enum PlayerInfo
{
    Team,
    Ammo,
    CannonID,
    Text:SpawnText
}

new PlatformID;
new BattleZone;
new Text:PText;
new bool:RoundStarted;

new AmmoCrates[2][4];
new ShipVar[2][ShipInfo];
new CannonVar[8][CannonInfo];
new PlayerVar[MAX_PLAYERS][PlayerInfo];

new Cannon1Data[3][FLIGHT_DATA];
new Cannon2Data[3][FLIGHT_DATA];
new Cannon3Data[3][FLIGHT_DATA];
new Cannon4Data[3][FLIGHT_DATA];
new Cannon5Data[3][FLIGHT_DATA];
new Cannon6Data[3][FLIGHT_DATA];
new Cannon7Data[3][FLIGHT_DATA];
new Cannon8Data[3][FLIGHT_DATA];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)