Help with a little mathematics
#2

looks like a memory leak. one (not so simple, but working) solution:
when you delete (sell) a car (assuming slot [1], then copy the LAST vehicle parameter into that slot.
Код:
[0=landstalker] [1=cheetah] [2=supergt]
sell the [1cheetah], so it becomes clear first (your correct step so far):
Код:
[0=landstalker] [1] [2=supergt]
now its time to fill the empty [1] with the last [2=supergt] to avoid the gap. after copying [2] to [1]...
Код:
[0=landstalker] [1=supergt] [2=supergt]
...delete the [2]:
Код:
[0=landstalker] [1=supergt] [2]
you need to script it for each player car entry, like mods, color etc yourself, but i hope the concept is clear
Код:
PlayerCars[playerid][1]=PlayerCars[playerid][2];
PlayerCars[playerid][2]=0;
advantage: when you buy a car, you may simply add it to the first unused entry. all cars gets rearranged (gap avoid) by copying the last entry to a deleted one.
DISadvantage: the cars' order may get messed up! (only their order, the system will still work)
Reply


Messages In This Thread
Help with a little mathematics - by clavador - 20.03.2012, 12:38
Re: Help with a little mathematics - by Babul - 20.03.2012, 12:53

Forum Jump:


Users browsing this thread: 1 Guest(s)