SetPlayerMarkerForPlayer problem
#1

Hey guys, I'm creating a script which makes you see your teammates on the radar and it doesn't seem to work.

The code runs through but nothing happens:

pawn Код:
SetPlayerMarkerForPlayer(playerid, i, COLOR_RED);
SendClientMessage(playerid,-1,"Color Red"); // This was just a debug ,,feature" so I know the script ran just fine
It works when I add ShowPlayerMarkers when the gamemode starts, but in that case it shows everyone and only changes the color of the team members, so the script above works for sure but it also shows everyone else.

Can anyone help me? I only want to see the people I choose ( my teammates ) and not everyone.

Thanks in advance!
Reply
#2

You need to show more code. I can assume that "i" variable is in some kind of a loop, so your conditionals are most likely not precise enough to filter out other players.
Reply
#3

PartyInfo[InParty[playerid]][pMember][X] is storing the PlayerID of the party members. This is a script I'll be releasing here because the community helped me a lot and yet I'm having troubles with it.

The script has to work because if I enable the markers and you see everyone it changes the color of the marker so the script has to work.

pawn Код:
stock ShowMarkers(playerid)
{
    if(PartyInfo[InParty[playerid]][pMember][1]!=-1&&PartyInfo[InParty[playerid]][pMember][1]!=playerid)
    {
        SetPlayerMarkerForPlayer(playerid, PartyInfo[InParty[playerid]][pMember][1], COLOR_RED);
        SendClientMessage(playerid,-1,"Color Red");
    }
    if(PartyInfo[InParty[playerid]][pMember][2]!=-1&&PartyInfo[InParty[playerid]][pMember][2]!=playerid)
    {
        SetPlayerMarkerForPlayer(playerid,PartyInfo[InParty[playerid]][pMember][2],COLOR_GREEN);
        SendClientMessage(playerid,-1,"Color Green");
    }
    if(PartyInfo[InParty[playerid]][pMember][3]!=-1&&PartyInfo[InParty[playerid]][pMember][3]!=playerid)
    {
        SetPlayerMarkerForPlayer(playerid, PartyInfo[InParty[playerid]][pMember][3], COLOR_BLUE);
        SendClientMessage(playerid,-1,"Color Blue");
    }
    if(PartyInfo[InParty[playerid]][pMember][4]!=-1&&PartyInfo[InParty[playerid]][pMember][4]!=playerid)
    {
        SetPlayerMarkerForPlayer(playerid, PartyInfo[InParty[playerid]][pMember][4], COLOR_YELLOW);
        SendClientMessage(playerid,-1,"Color Yellow");
    }
    if(PartyInfo[InParty[playerid]][pMember][5]!=-1&&PartyInfo[InParty[playerid]][pMember][5]!=playerid)
    {
        SetPlayerMarkerForPlayer(playerid, PartyInfo[InParty[playerid]][pMember][5], COLOR_PURPLE);
        SendClientMessage(playerid,-1,"Color Purple");
    }
    SendClientMessage(playerid,-1,"End");
}
Script runs through because I get the ,,End" message too.


EDIT: Tried adding this to onplayerconnect, still not working.

Color Invisible is defined: #define COLOR_INVISIBLE 0xFFFFFF00

pawn Код:
SetPlayerColor(playerid,COLOR_INVISIBLE);
for(new i =0;i<MAX_PLAYERS;i++)
{
    if(IsPlayerConnected(i))
    {
        SetPlayerMarkerForPlayer(playerid, i, COLOR_INVISIBLE);
        SetPlayerMarkerForPlayer(i, playerid, COLOR_INVISIBLE);
    }
}
Edit 2.: It seems to work if I set a timer to 1.5 - 3 seconds and it makes all the players ,,invisible" after spawning. Any better solution to this?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)