SA-MP Forums Archive
Remove map icon when a player is nearby. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Remove map icon when a player is nearby. (/showthread.php?tid=446597)



Remove map icon when a player is nearby. - Elietje28 - 26.06.2013

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


Re: Remove map icon when a player is nearby. - Elietje28 - 27.06.2013

Anyone?


Re: Remove map icon when a player is nearby. - Elietje28 - 13.07.2013

plz, anyone?


Re: Remove map icon when a player is nearby. - Isolated - 13.07.2013

use OnPlayerStreamedIn(playerid, forplayerid) for that instead.