Remove map icon when a player is nearby.
#1

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:

Код:
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 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
Код:
SendClientMessage(playerid, COLOR_WHITE, "loop 1");
in the first loop and
Код:
"loop 2"
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
Reply
#2

Anyone?
Reply
#3

plz, anyone?
Reply
#4

use OnPlayerStreamedIn(playerid, forplayerid) for that instead.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)