Teams on radar
#1

Hello!

im trying to disable radar blips for teams your not member in on OnPlayerSpawn, but i cant fix it.

It is like this that you only will be able to see your own team players.
And the rest of the other teams are invisible on the radar.

I use (SetPlayerTeam)
i have two choices to use for this
pawn Код:
if(Member[playerid] == 0)
if(GetPlayerTeam(playerid) == 0)
How to fix this?
Reply
#2

You can use SetPlayerColor and just change the alpha-transparency of the hex color. So from there you just implement those team checks and voila ! It should work, It's something I wanted to do for a while now, but never got to realizing it..

Edit: I think this might not just work the way I thought it might, try using it under OnPlayerStreamIn
Reply
#3

I think this could be usefull as well: https://sampwiki.blast.hk/wiki/SetPlayerMarkerForPlayer
Reply
#4

Quote:
Originally Posted by Patrik356b
Посмотреть сообщение
I think this could be usefull as well: https://sampwiki.blast.hk/wiki/SetPlayerMarkerForPlayer
Ofc i need to use that, but i didnt get it to work
Reply
#5

Anyone who can help with this?
Reply
#6

pawn Код:
for(new i;i<MAX_PLAYERS;i++)
{
    if(IsPlayerConnected(i))
    {
        if(GetPlayerTeam(i) == GetPlayerTeam(playerid))
        {
            SetPlayerMarkerForPlayer(i,playerid,0xFF0000FF);
        }
    }
}
Reply
#7

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
pawn Код:
for(new i;i<MAX_PLAYERS;i++)
{
    if(IsPlayerConnected(i))
    {
        if(GetPlayerTeam(i) == GetPlayerTeam(playerid))
        {
            SetPlayerMarkerForPlayer(i,playerid,0xFF0000FF);
        }
    }
}
Can i put this on OnPlayerSpawn or?
and will the team collors still be what i have set them to be?
Reply
#8

pawn Код:
public OnPlayerSpawn( playerid )
{
   for( new i = 0; i < MAX_PLAYERS; i++ )
   {
      if( !IsPlayerConnected( i ) || i == playerid ) continue;
      if( GetPlayerTeam( playerid ) != GetPlayerTeam( i ) )
      {
         ShowPlayerMarkerForPlayer( playerid, i, 0xFFFFFF00 );
         ShowPlayerMarkerForPlayer( i, playerid, 0xFFFFFF00 );
         // Hide the player's marker from someone on the other team, and vice-versa
      }
   }
   return 1;
}
Note that this will also make the color of the player's name in the chat white. If you want to have a consistent color inside the chat, you'll have to make sure you previous used SetPlayerColor, and use this code:
pawn Код:
SetPlayerMarkerForPlayer( playerid, i, ( GetPlayerColor( 1 ) & 0xFFFFFF00 ) );
SetPlayerMarkerForPlayer( i, playerid, ( GetPlayerColor( 1 ) & 0xFFFFFF00 ) );
Also make sure ShowPlayerMarkers is set to 1 inside OnGameModeInit.
Reply
#9

Quote:
Originally Posted by Grim_
Посмотреть сообщение
pawn Код:
public OnPlayerSpawn( playerid )
{
   for( new i = 0; i < MAX_PLAYERS; i++ )
   {
      if( !IsPlayerConnected( i ) || i == playerid ) continue;
      if( GetPlayerTeam( playerid ) != GetPlayerTeam( i ) )
      {
         ShowPlayerMarkerForPlayer( playerid, i, 0xFFFFFF00 );
         ShowPlayerMarkerForPlayer( i, playerid, 0xFFFFFF00 );
         // Hide the player's marker from someone on the other team, and vice-versa
      }
   }
   return 1;
}
Note that this will also make the color of the player's name in the chat white. If you want to have a consistent color inside the chat, you'll have to make sure you previous used SetPlayerColor, and use this code:
pawn Код:
SetPlayerMarkerForPlayer( playerid, i, ( GetPlayerColor( 1 ) & 0xFFFFFF00 ) );
SetPlayerMarkerForPlayer( i, playerid, ( GetPlayerColor( 1 ) & 0xFFFFFF00 ) );
Also make sure ShowPlayerMarkers is set to 1 inside OnGameModeInit.
When i put this in my scrip ill get
pawn Код:
error 017: undefined symbol "ShowPlayerMarkerForPlayer
error 017: undefined symbol "
ShowPlayerMarkerForPlayerr
and when i define the first one ill get 2 of these warnings instead on ShowPlayerMarkerForPlayer line
pawn Код:
expression has no effect
Reply
#10

I meant SetPlayerMarkerForPlayer. Replace ShowPlayerMarkerForPlayer with it.
Reply
#11

Quote:
Originally Posted by Grim_
Посмотреть сообщение
I meant SetPlayerMarkerForPlayer. Replace ShowPlayerMarkerForPlayer with it.
This doest work, ill see the radar blips for the other teams.
Reply
#12

If you're using the second code I posted (keeping the chat color of the player the same), then make sure you have previously used SetPlayerColor.
Reply
#13

Quote:
Originally Posted by Grim_
Посмотреть сообщение
If you're using the second code I posted (keeping the chat color of the player the same), then make sure you have previously used SetPlayerColor.
Ill use this
pawn Код:
public OnPlayerSpawn( playerid )
{
   for( new i = 0; i < MAX_PLAYERS; i++ )
   {
      if( !IsPlayerConnected( i ) || i == playerid ) continue;
      if( GetPlayerTeam( playerid ) != GetPlayerTeam( i ) )
      {
         ShowPlayerMarkerForPlayer( playerid, i, 0xFFFFFF00 );
         ShowPlayerMarkerForPlayer( i, playerid, 0xFFFFFF00 );
         // Hide the player's marker from someone on the other team, and vice-versa
      }
   }
   return 1;
}
and i sett the team colors like this
pawn Код:
if(Member[playerid] == 0)
    {
        SetPlayerPos(playerid, 414.6559,2531.7651,19.1601);
        SetPlayerTeam(playerid, 0);
        SetPlayerColor(playerid, COLOR_RED);
it seams the blips are invisible untill youi get near the player, then it shown up on radar
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)