Jump to content
Sign in to follow this  
sunshimaro

Need help - listBox got double entries in MP

Recommended Posts

Hi guys,

i've got an Altis Life Server (:rolleyes:) and may need your help.

I've rewritten the following code

{
	_index = lbAdd [1500, [ [_x select 0, 0] call life_fnc_varHandle ] call life_fnc_varToStr ];
	lbSetData [1500, _index, _x select 0];
}
foreach life_market_resources;

to

{
_entry = _x select 0;
_found = false;

for [{private "_i"; _i=0},{_i<=lbSize 1500},{_i=_i+1}] do {
if(_entry isEqualTo lbData [1500,_i]) exitWith{_found = true;}
};

if(!(_found)) then
{
	_index = lbAdd [1500, [ [_entry, 0] call life_fnc_varHandle ] call life_fnc_varToStr ];
	lbSetData [1500, _index, _entry];
};
}
foreach life_market_resources;

My intention is to remove/prevent double-entries in the listBox. This event is spawned on the onLBSelectionChangedEvent and therefore executed multiple times.

I thought i might add a check with isEqualTo, so it's preventing those double-entries some players had reported of. Now the following: I don't have any issues, neither a few other people have. On the other hand there are people where they've got double-entries in the list (as i stated multiple times in here). Guess its a MP related issue and/or got to do with the publicVariable behavior or 1.18. As im pretty much have no clue what the hell im actually talking about i'll move on:

How can i prevent double-entries in listBoxes for ALL players?

I could post an example of the life_market_resources Array and some diag_logs of _entry or _x later on.

Greets

Sunshi

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×