for loop -
Baboon - 05.02.2012
ok,
so I have this small bit of code:
http://pastebin.com/XQjG37jn
note: foreach is the same as for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
and the first pos[0] - pos[3] are from the object id that I shot, its updating every 250ms, so this piece of code is inside a timer.
Well the problem starts at the first loop already... I added: if(playerid != i), but seems that sometimes this piece of code is even occuring for the playerid himself and not other ids..
So I tried many stuff and well seems there should be nothing wrong with this piece of code. So I guess it is a sampbug -_-. The playerid looses health and gets a bloodobject around them, but the other id (= i) gets nothing. This happens sometimes.. I even tried checking it with a client message, but even that says there isn't a change of id. So it should take the right playerid... But why

?
Re: for loop -
AndreT - 05.02.2012
Is the break; supposed to be there? That stops the loop!
Re: for loop -
Baboon - 05.02.2012
Yep, the break is supposed to be there, because I dont want to check any further.
Imean like found = found.
Re: for loop -
Rac3r - 05.02.2012
This section is for SA-MP bugs, your problem is a scripting error. Post in the Scripting section.
Re: for loop -
Baboon - 05.02.2012
Why did you move this 0.0
It is a samp bug, I am sure of it. There is no way this is a scripting error.
Re: for loop -
Rac3r - 06.02.2012
Firstly, I very much doubt it's SA-MP's fault, just by looking at that function you've stuck together.
Secondly, you're not showing where the
playerid is coming from for it not to equal
i. All we see is a
GetDynamicObject function, might be best if you actually shown us how the code is being handled, rather than just a loop you've ripped from your gamemode together with a
Get function.