PDA

View Full Version : Unsolvable bugs?


Danny
12/11/2011, 08:10 AM
Hello and thanks for reading in the first place.

I'm making a gamemode with another guy and we noticed some weird bugs.
Things just won't be executed or they'll be executed in a wrong way. For example:


if(EmployeeInfo[playerid][vehicle] != 0)
{
DestroyVehicleX(EmployeeInfo[playerid][vehicle]);
EmployeeInfo[playerid][vehicle]=0; // this won't be executed
}


Also, OnPlayerSpawn will take $200 from the player instead of the scripted $100.
Before this mysterious bug came, everything was allright and all systems were working.
I'm sure it isn't a normal scripting mistake. I run through the code a thousand times, and this just make no sence at al.

Can someone help me?

Greetz,
Danny

[HiC]TheKiller
12/11/2011, 08:12 AM
Could we see the DestroyVehicleX function?

Danny
12/11/2011, 08:14 AM
TheKiller;1514275']Could we see the DestroyVehicleX function?

Ofcourse, but i'm afraid i cannot show too much of my gamemode here.


forward DestroyVehicleX(Dvehicleid);
public DestroyVehicleX(Dvehicleid)
{
DestroyVehicle(Dvehicleid);
Iter_Remove(Vehicle, Dvehicleid);
return Dvehicleid;
}

CyNiC
12/11/2011, 10:45 AM
Comment this:Iter_Remove(Vehicle, Dvehicleid); to see what happens.

Ash.
12/11/2011, 10:50 AM
DestroyVehicle(..) will halt the callback/segment if the vehicle ID is invalid (INVALID_VEHICLE_ID) or if the vehicle doesn't exist. Had the problem a week ago or so. This may not be your problem, but check to see if the vehicle is valid before acting on it.

Not sure about the OnPlayerSpawn issue though.

Babul
12/11/2011, 11:33 AM
the part which looks most suspect, are the $200 being taken.
my sugggestion is to use JernejL's ExecLogger (http://forum.sa-mp.com/showthread.php?t=292130&highlight=ExecLogger) plugin, it will direct you to why the player gets taken the double amount for sure. oh, backup your old server.log, i accidently got an almost 400MB sized file after playing a few minutes!

Danny
12/11/2011, 12:52 PM
That Execution Logger from JernejL is really amazing, thanks, i will keep using it with future bugs :)

Unfortunately it only shows me one GivePlayerMoneyX line. Another weird thing: If i give myself $500 dollars and then kill myself with /kill, i've $300 left. But when i look into the playerstats it shows me i have $400. I'm using serverside money so i guess the bug isn't affecting serverside money, but only takes clientside-money away from the player.

@CynIC: Thanks for your tip, i'll try as soon as i have a few friends around in my server.

@funky1234: Hmm, indeed, i'll make a if(.. check for that, thanks.

MadeMan
12/11/2011, 12:56 PM
$100 is taken from players money each death by default.

Danny
12/11/2011, 12:58 PM
$100 is taken from players money each death by default.

So why this didn't occur some days ago and suddenly it does?