Doesn't show player marker on the mini map
#1

I have /backup command for police faction that should place a marker for every law member where the backup is needed. But it doesn't show any marker, what's wrong?
pawn Code:
if(strcmp(cmd,"/backup",true)==0 || strcmp(cmd,"/bk",true)==0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsACop(playerid) || IsAFreecop(playerid))
            {
                if(PlayerInfo[playerid][pDBanned] == 1)
                {
                    SendClientMessage(playerid, COLOR_GREY, "** You are banned From Cop Duty!");
                    return 1;
                }
                if(PlayerInfo[playerid][pDuty] == 0)
                {
                    SendClientMessage(playerid, COLOR_GREY, "** You aren't on duty Duty!");
                    return 1;
                }
                if (PlayerInfo[playerid][pRequestingBackup] != 1)
                {
                    format(string, sizeof(string), "ALL UNITS: %s is requesting immediate assistance, they have been marked on the map (red).", sendername);
                    PlayerInfo[playerid][pRequestingBackup] = 1;
                    for(new i = 0; i < MAX_PLAYERS; i++)
                    {
                        if(IsPlayerConnected(i))
                        {
                            if(IsACop(i) || IsAFreecop(i))
                            {
                                if(PlayerInfo[i][pDuty] == 1)
                                {
                                    SetPlayerMarkerForPlayer(i, playerid, COLOR_YELLOW);
                                    SendClientMessage(i, TEAM_BLUE_COLOR, string);
                                }
                            }
                        }
                    }
                    SendClientMessage(playerid, TEAM_BLUE_COLOR, "Type /bkc to clear your backup request.");
                    SetTimerEx("BackupClear", 180000, false, "ii", playerid, 1);
                    new y, m, d;
                    new h,mi,s;
                    getdate(y,m,d);
                    gettime(h,mi,s);
                    format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /backup",d,m,y,h,mi,s,sendername);
                    CommandLog(string);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "You already have an active backup request!");
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "You are not a cop!");
            }
        }
        return 1;
    }
Reply
#2

I changed this
pawn Code:
SetPlayerMarkerForPlayer(i, playerid, COLOR_YELLOW);
to this
pawn Code:
SetPlayerMarkerForPlayer( i, playerid, ( GetPlayerColor( playerid ) & 0xFF66FFFF ) );
But still I get nothing. It doesn't show on the radar!
Reply
#3

Switch i with playerid, you are setting them in wrong parameter positions.
Reply
#4

Quote:
Originally Posted by Dragonsaurus
View Post
Switch i with playerid, you are setting them in wrong parameter positions.
I was trying to figure out whose marker he wants to show but I guess he wants:
A player types /backup, whoever is cop on duty will see that player's marker in the minimap.

Correct? If so, the parameters are fine.

pawn Code:
SetPlayerMarkerForPlayer(i, playerid, COLOR_YELLOW);
So.. check if the COLOR_YELLOW is defined with FF (alpha value) just to prevent to be invisible 00.
pawn Code:
// Example
#define COLOR_YELLOW 0xFFFF00FF
In OnGameModeInit:
pawn Code:
ShowPlayerMarkers(1);
Reply
#5

Thank you! This was the problem
Code:
ShowPlayerMarkers(1);
I had it on 0
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)