26.06.2013, 16:03
(
Последний раз редактировалось Elietje28; 27.06.2013 в 09:30.
)
Hi!
I'm making a code, but I've got a problem; The intention is that when a player (pi) is nearby to another player (a or b), the map icon from player (a or b) isn't visible anymore for player (pi). I've used a loop to check all the players. This has to be checked frequently, so I use the callback OnPlayerUpdate.
This is the code:
So I use for the playerid-variable in the first for-loop 'a' and for the second 'b'.
So the problem is that the server checks both the loops always, even if the conditions aren't correct. (I've tested this by putting
in the first loop and
in the second loop).
So in my code, the color from (a or b) for the player (ip) becomes black. Is there a way to get this color back to the normal color, given to the player when he spawns?
I know it might be quite difficult to understand
Thanks
Elietje28
I'm making a code, but I've got a problem; The intention is that when a player (pi) is nearby to another player (a or b), the map icon from player (a or b) isn't visible anymore for player (pi). I've used a loop to check all the players. This has to be checked frequently, so I use the callback OnPlayerUpdate.
This is the code:
Код:
public OnPlayerSpawn { new Float:x, Float:y, Float:z, a, b, pi; pi = playerid; a = 0; b = 0; GetPlayerPos(pi, x, y, z); for( ;GetPlayerDistanceFromPoint(a,x,y,z)<200 && a < GetMaxPlayers(); ) { SetPlayerMarkerForPlayer(pi,a, 00); a++; } for( ;GetPlayerDistanceFromPoint(b,x,y,z)>200 && b < GetMaxPlayers(); ) { SetPlayerMarkerForPlayer(pi,b,COLOR_BLACK); a++; } return 1; }
So the problem is that the server checks both the loops always, even if the conditions aren't correct. (I've tested this by putting
Код:
SendClientMessage(playerid, COLOR_WHITE, "loop 1");
Код:
"loop 2"
So in my code, the color from (a or b) for the player (ip) becomes black. Is there a way to get this color back to the normal color, given to the player when he spawns?
I know it might be quite difficult to understand
Thanks
Elietje28