Hide Player Markers
#1

Hello SA:MP Community,

I've a little problem. I did a Capture The Flag System. It's working perfect but I have a strange bug which I'm trying to solve for almost 4 hours.

Indeed, in my game there are 2 team (Red & Blue). I wanna hide the blue players (in the mini map) for red players and hide the red players for the blue players.

My code is currently hiding only red players for blue players.

Here is my function.

Код:
// Function to teleport the player to his base
GXTeleportPlayerCTF(playerid)
{
	// Red team
	if(AllPlayers[playerid][PlayerEventTeam] == 1)
	{
	    // Set Player Team
	    SetPlayerTeam(playerid,15);
	    // Teleport
		SetPlayerVirtualWorld(playerid,56);
		SetPlayerPos(playerid,230.3188, 250.3898, 60.7265);
		SetPlayerFacingAngle(playerid,2.3934);
		// Set checkpoint
		SetPlayerCheckpoint(playerid, 228.9879, 274.0908, 57.1859, 3.0);
		// Set player color
		SetPlayerColor(playerid, 0xFF000000);
		// Set map icon
		SetPlayerMapIcon(playerid, 99, 360.8691, 593.2734, 54.4642, 19, 0, MAPICON_GLOBAL);
	}
	
	// Blue team
	if(AllPlayers[playerid][PlayerEventTeam] == 2)
	{
	    // Set Player Team
	    SetPlayerTeam(playerid,16);
        SetPlayerVirtualWorld(playerid,56);
        // Teleport
		SetPlayerPos(playerid,393.3380, 594.2791, 56.4628);
		SetPlayerFacingAngle(playerid,92.3388);
		// Set checkpoint
		SetPlayerCheckpoint(playerid, 360.8691, 593.2734, 54.4642, 3.0);
		// Set player color
		SetPlayerColor(playerid, 0x000066FF);
		// Set map icon
		SetPlayerMapIcon(playerid, 99, 228.9879, 274.0908, 57.1859, 19, 0, MAPICON_GLOBAL);
	}

	// Join minigame
	GXGoingToMiniGame(playerid);
	
	// Give back weapons
	if(EventStarted)
	{
	    // AK47
	    GivePlayerWeapon(playerid,30,10000);
	    // Deagle
	    GivePlayerWeapon(playerid,24,10000);
	    // Shotgun
	    GivePlayerWeapon(playerid,25,10000);
	    // Sniper
	    GivePlayerWeapon(playerid,34,19000);
	}
	
	// Hide markers
	for(new j=0; j<MAX_PLAYERS; j++)
 	{
 	    if(AllPlayers[j][PlayerIsInEvent])
        {
	  		if(AllPlayers[playerid][PlayerEventTeam] != AllPlayers[j][PlayerEventTeam])
	    	{
	  				// Hide enemy for the player
	     			SetPlayerMarkerForPlayer(playerid, j, ( GetPlayerColor(j)&0xFFFFFF00));
	     			
	     			// Hide player for enemy
				    SetPlayerMarkerForPlayer(j, playerid, ( GetPlayerColor(playerid)&0xFFFFFF00));
	   		}
		}
    }
}
Thanks for help.
Reply
#2

I think this is the problem. Change the SetPlayerMapIcon on the BLUE team to this:
99, 360.8691, 593.2734, 54.4642, 19, 0,

I think that should fix the problem
Reply
#3

Not really...
Reply
#4

"j" is the enemy right?



mmh Test 1:
try with no hide player to enemy.. becouse enemy already have this callback calls
pawn Код:
for(new j=0; j<MAX_PLAYERS; j++)
{
    if(AllPlayers[j][PlayerIsInEvent])
    {
        if(AllPlayers[playerid][PlayerEventTeam] != AllPlayers[j][PlayerEventTeam])
        {
            // Hide enemy for the player
            SetPlayerMarkerForPlayer(playerid, j, ( GetPlayerColor(j)&0xFFFFFF00));
        }
    }
}
Reply
#5

Thanks for your reply, but it's not working.

I explain you how my system works :

First the player type a cmd to join the game. It calls this function :

http://pastebin.com/aPtRP17v

After this call red players can see blue and blue players can see red.

Then I start the minigame with this function :

http://pastebin.com/u8Uy8ucM

After this call it's working perfect.

When a player die and rejoin the minigame, it calls again the first function, and it bugs again.

I don't understand cause the second functions calls the first one.
Reply
#6

You reset player vars when player die?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)