Team markers on radar :/
#1

Hi, Iґm creating now my new gamemode for TDM
I have two team.. and I want to only your team will show on radar.
This is my code in OnPlayerSpawn :
pawn Код:
new pTeam;
pTeam = GetPlayerTeam(playerid);
SetPlayerTeam(playerid, pTeam);
for(new i=0;i<MAX_PLAYERS;i++)
{
    if(IsPlayerConnected(i))
    {
        if(GetPlayerTeam(i) != pTeam)
        {
            SetPlayerMarkerForPlayer(playerid, i, (GetPlayerColor(i) & 0xFFFFFF00));
            SetPlayerMarkerForPlayer(i, playerid, (GetPlayerColor(playerid) & 0xFFFFFF00));
        }
    }
}
But if I change team from red to blue, i see red players!
Reply
#2

if you change teams, do you die ?
Reply
#3

I must die, if i want to change class (I click F4 and then I select another team)
Reply
#4

Quote:
Originally Posted by lamarr007
Посмотреть сообщение
Hi, Iґm creating now my new gamemode for TDM
I have two team.. and I want to only your team will show on radar.
This is my code in OnPlayerSpawn :
pawn Код:
new pTeam;
pTeam = GetPlayerTeam(playerid);
SetPlayerTeam(playerid, pTeam);
for(new i=0;i<MAX_PLAYERS;i++)
{
    if(IsPlayerConnected(i))
    {
        if(GetPlayerTeam(i) != pTeam)
        {
            SetPlayerMarkerForPlayer(playerid, i, (GetPlayerColor(i) & 0xFFFFFF00));
            SetPlayerMarkerForPlayer(i, playerid, (GetPlayerColor(playerid) & 0xFFFFFF00));
        }
    }
}
But if I change team from red to blue, i see red players!
pawn Код:
if(GetPlayerTeam(i) != pTeam)
if team of player "i" isn't the same as team of player "playerid" then show him on map... try to change != to ==
Reply
#5

Nothing has changed.. I alway see enemy team
Reply
#6

oh yea, just looking at function SetPlyaerMarkerForPlayer, didn't know that 0xFFFFFF00 is invisible, give me 5 min
Reply
#7

Yes, this color is invisible.. Then I canґt use !=
Reply
#8

Quote:
Originally Posted by lamarr007
Посмотреть сообщение
Yes, this color is invisible.. Then I canґt use !=
this is a little bit hard for me since I don't have any players on server (local server for script purposes only), so I have no idea how can I try to do my own script for this and you didn't provide everything that's changing markers/teams etc, however, I've tried this

pawn Код:
public OnPlayerSpawn(playerid)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    if(GetPlayerTeam(playerid) == 1)
    {
        SetPlayerMapIcon(playerid, 0, x+10, y+10, z, 0, 0, MAPICON_GLOBAL);
    }
    else if(GetPlayerTeam(playerid) == 2)
    {
        SetPlayerMapIcon(playerid, 0, x+10, y+10, z, 0, 1, MAPICON_GLOBAL);
    }
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/1", true) == 0)
    {
        SetPlayerTeam(playerid, 1);
        SetPlayerHealth(playerid, 0);
    }
    if(strcmp(cmdtext, "/2", true) == 0)
    {
        SetPlayerTeam(playerid, 2);
        SetPlayerHealth(playerid, 0);
    }
    return 0;
}
and well, it works fine, maybe you can send me a PM with whole gamemode script or something so I can take a deep look at this

edit: maybe you should try to do this
pawn Код:
new pTeam = GetPlayerTeam(playerid);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(GetPlayerTeam(i) != pTeam) // if team of player "i" is not the same as my team
        {
            SetPlayerMarkerForPlayer(playerid, i, 0xFFFFFF00);
            SetPlayerMarkerForPlayer(i, playerid, 0xFFFFFF00);
        }
        else // if we are at same team
        {
            SetPlayerMarkerForPlayer(playerid, i, 0xFFFFFFFF);
            SetPlayerMarkerForPlayer(i, playerid, 0xFFFFFFFF);
        }
    }
this should show every friendly player on map as white
Reply
#9

Hm, I tested it... but I see enemy players with white markers
Reply
#10

Quote:
Originally Posted by lamarr007
Посмотреть сообщение
Hm, I tested it... but I see enemy players with white markers
that's the most weird thing I've ever saw, there are 2 solutions:

1. change != to == in my code, this would swap markers
2. if the above don't works then you have something wrong somewhere else
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)