Show cops on radar (only for other cops)
#1

I have this function:
pawn Code:
forward TeamRadar(playerid); public TeamRadar(playerid) {
    if(IsACop(playerid)) {
        foreach(new i : Player) {
            if(IsACop(i)) {
                SetPlayerMarkerForPlayer(i, playerid, COLOR_LIMEGREEN);
            }
        }
    }
}
It is called in function every 1 second, check if player is a COP, and if player is a COP show to others COPs on radar...
It is already working, but there is a problem, if the partner go out of the player range, map icon show always to north
Even if the partner is not on the north
There is a way to fix it?

My server is already:
pawn Code:
ShowPlayerMarkers(1);
Reply
#2

bump
Reply
#3

Your code is a little bit incorrect!
I'd better use
Code:
public IsACop(killerid)
{
        if(GetPlayerSkin(killerid) == 280 || GetPlayerSkin(killerid) == 281 || GetPlayerSkin(killerid) == 282 || GetPlayerSkin(killerid) == 283 || GetPlayerSkin(killerid) == 284 || GetPlayerSkin(killerid) == 285 || GetPlayerSkin(killerid) == 286 || GetPlayerSkin(killerid) == 287 || GetPlayerSkin(killerid) == 288)
        {
                return 1;
        }
        else
        {
                return 0;
        }
}
Check your other scripts and PLUGINS also streamer you use and if your pawn include matches with plugin ver
Reply
#4

Quote:
Originally Posted by binnyl
View Post
pawn Code:
ShowPlayerMarkers(1);
Shouldn't you set ShowPlayerMarkers to 0, since you want to hide all the markers and only show the cops to other cops.


Quote:
Originally Posted by Hitek
View Post
Your code is a little bit incorrect!
I'd better use
Code:
public IsACop(killerid)
{
        if(GetPlayerSkin(killerid) == 280 || GetPlayerSkin(killerid) == 281 || GetPlayerSkin(killerid) == 282 || GetPlayerSkin(killerid) == 283 || GetPlayerSkin(killerid) == 284 || GetPlayerSkin(killerid) == 285 || GetPlayerSkin(killerid) == 286 || GetPlayerSkin(killerid) == 287 || GetPlayerSkin(killerid) == 288)
        {
                return 1;
        }
        else
        {
                return 0;
        }
}
Check your other scripts and PLUGINS also streamer you use and if your pawn include matches with plugin ver
Are you just randomly saying something? IsACop isn't shown here so how'd you know if it's wrong?
Reply
#5

Quote:
Originally Posted by Gforcez
View Post
Shouldn't you set ShowPlayerMarkers to 0, since you want to hide all the markers and only show the cops to other cops.




Are you just randomly saying something? IsACop isn't shown here so how'd you know if it's wrong?
Yes, he is


About showplayermakers i'm using this
pawn Code:
stock TransparentColor(color) { return (color  & 0xFFFFFF00); }
So players are not showing on map, only when i want to i remove this transparent color for a little time

By the way the function TeamRadar(playerid); is working as i think
It is only bugging when someone get over from a range, every cops so far to you shows to be on north, not on the right direction
Reply
#6

bump
Reply
#7

bump
Reply
#8

Hello binnyl, I don't know how exactly SetPlayerMarkerForPlayer works, but I have a similar system, but I used SetPlayerMapIcon to put an icon for all players of the same clan.

The difference is that SetPlayerMapIcon makes it possible to change the constant style to appear on every radar, or just in your field of view.

The problem is that for each Map Icon will need to get the position of the player, but if you are interested follow the steps below and put them in your code, which maybe will work perfectly.

pawn Code:
new iconMapPlayerCount[MAX_PLAYERS]; //Set the variable to Map Icon Count

forward TeamRadar(playerid); public TeamRadar(playerid)
{
    if(IsACop(playerid))
    {
        foreach(new i : Player)
        {
            if(IsACop(i))
            {
                if(IsPlayerConnected(i))
                {
                    new Float:tg_x, tg_y, tg_z; //Set variables to target coordinates
                    GetPlayerPos(i, Float:tg_x, Float:tg_y, Float:tg_z); //Get target pos
                    SetPlayerMapIcon(playerid, iconMapPlayerCount[playerid], Float:tg_x, Float:tg_y, Float:tg_z, 0, 0x59f060FF, MAPICON_GLOBAL); //Add a icon to the target position
                    iconMapPlayerCount[playerid]++; //Increment the player count icon id
                }
                else
                {
                    RemovePlayerMapIcon(playerid, iconMapPlayerCount[playerid]); //Remove the icon if the target disconnect
                }
            }
        }

        iconMapPlayerCount[playerid] = 0; //Set the count to 0
    }
}
I didn't have time to test the operation, but if you use it and some error occurs, just call me.
EDIT NOTE: The problem with this Icon is that only 100 can be used.
Reply
#9

Quote:
Originally Posted by ApolloScripter
View Post
Hello binnyl, I don't know how exactly SetPlayerMarkerForPlayer works, but I have a similar system, but I used SetPlayerMapIcon to put an icon for all players of the same clan.

The difference is that SetPlayerMapIcon makes it possible to change the constant style to appear on every radar, or just in your field of view.

The problem is that for each Map Icon will need to get the position of the player, but if you are interested follow the steps below and put them in your code, which maybe will work perfectly.

pawn Code:
new iconMapPlayerCount[MAX_PLAYERS]; //Set the variable to Map Icon Count

forward TeamRadar(playerid); public TeamRadar(playerid)
{
    if(IsACop(playerid))
    {
        foreach(new i : Player)
        {
            if(IsACop(i))
            {
                if(IsPlayerConnected(i))
                {
                    new Float:tg_x, tg_y, tg_z; //Set variables to target coordinates
                    GetPlayerPos(i, Float:tg_x, Float:tg_y, Float:tg_z); //Get target pos
                    SetPlayerMapIcon(playerid, iconMapPlayerCount[playerid], Float:tg_x, Float:tg_y, Float:tg_z, 0, 0x59f060FF, MAPICON_GLOBAL); //Add a icon to the target position
                    iconMapPlayerCount[playerid]++; //Increment the player count icon id
                }
                else
                {
                    RemovePlayerMapIcon(playerid, iconMapPlayerCount[playerid]); //Remove the icon if the target disconnect
                }
            }
        }

        iconMapPlayerCount[playerid] = 0; //Set the count to 0
    }
}
I didn't have time to test the operation, but if you use it and some error occurs, just call me.
EDIT NOTE: The problem with this Icon is that only 100 can be used.
I'm already uses SetPlayerMapIcon for a lot of stuff
Even had to use a streammer to don't get to the 100

SetPlayerMarkerForPlayer was made for it
Idk what happen if i'm missing something or if it is bugged already

Anyways, ty to your try, i rep you
Reply
#10

I believe reducing the number of times you call SetPlayerMarkerForPlayer could help you with your problem.

I would call SetPlayerMarkerForPlayer in both OnPlayerStreamIn and in OnPlayerStreamOut and then do checks between them.

Instead of your timer, the following would work:

pawn Code:
public OnPlayerStreamOut(playerid, forplayerid)
{
    if(IsACop(forplayerid) && IsACop(playerid))
    {
          SetPlayerMarkerForPlayer(playerid, forplayerid, COLOR_LIMEGREEN);
    }

    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)