SetPlayerMarkerForPlayer | NPC's
#1

Hello,

I've got a small problem with NPC's, its that i cant make their markers invisible on minimap.

I can't turn off the markers with ShowPlayerMarkers because i've got a minigame where i want markers on (npc's arent in that minigame), i've used a small function to do the job and it works, but the problem is, npc's markers still show as white (even tho i set their colour to white).

function (on spawn):
PHP код:
stock AdjustMarkers(playerid)
{    
    for(new 
=0iMAX_PLAYERSi++)
    {
        if(!
IsPlayerNPC(i))
        {
            if(
GPM(playerid)==&& GPM(i)==1)
            {
                
SetPlayerMarkerForPlayer(playeridi0x85170255DD);
            }
            else
            {
                
SetPlayerMarkerForPlayer(playeridi, ( GetPlayerColor) & 0xFFFFFF00 ));
            }    
        }
        else
        {
            
SetPlayerMarkerForPlayer(playeridi, ( GetPlayerColor) & 0xFFFFFF00 ));
        }
        
    }

setting npc's color on spawn:
PHP код:
if(IsPlayerNPC(playerid))
    {
        
SetPlayerColor(playerid,0xFFFFFF00);
    } 
Anyone got any idea how can i make the colour's invisible?
Reply
#2

Hai!

you did write the params in a wrrong way

SetPlayerMarkerForPlayer(playerid, showplayerid, color);

playerid The player that will see the player's changed blip/nametag color
showplayerid The player whose color will be changed

PHP код:
stock AdjustMarkers(playerid
{     
    for(new 
=0iMAX_PLAYERSi++) 
    { 
        if(!
IsPlayerNPC(i)) 
        { 
            if(
GPM(playerid)==&& GPM(i)==1
            { 
                
SetPlayerMarkerForPlayer(iplayerid0x85170255DD); 
            } 
            else 
            { 
                
SetPlayerMarkerForPlayer(iplayerid, ( GetPlayerColor) & 0xFFFFFF00 )); 
            }     
        } 
        else 
        { 
            
SetPlayerMarkerForPlayer(iplayerid, ( GetPlayerColor) & 0xFFFFFF00 )); 
        } 
         
    } 

Reply
#3

As i am using it under onplayerspwan, i want the playerid to see everyone else's color set as invisible.

Your code means, everyone will see that player's color as invisible.
Reply
#4

Quote:
Originally Posted by iLearner
Посмотреть сообщение
As i am using it under onplayerspwan, i want the playerid to see everyone else's color set as invisible.

Your code means, everyone will see that player's color as invisible.
oh sorry i did missunderstand.

why not use this vv

PHP код:
public OnPlayerStreamIn(playeridforplayerid

    if(
IsPlayerNPC(playerid)) 
    { 
        
SetPlayerMarkerForPlayer(forplayeridplayerid0x00000000); 
    } 
    else 
    { 
        if(!
IsPlayerNPC(i))   
        {   
            if(
GPM(playerid)==&& GPM(i)==1)   
            {   
                
SetPlayerMarkerForPlayer(forplayeridplayerid0x85170255DD);   
            }   
            else   
            {   
                
SetPlayerMarkerForPlayer(forplayeridplayerid, ( GetPlayerColor) & 0x00000000 ));   
            }     
        }  
    }   
    return 
1

0x00000000 = Invisible

instand of making loop everytime
Reply
#5

You do understand that I have been trying to set their color to white / grey yet they show as red on minimap.
Reply
#6

Quote:
Originally Posted by iLearner
Посмотреть сообщение
You do understand that I have been trying to set their color to white / grey yet they show as red on minimap.
did you used that stock up? and check if there any timer that set their colors again after spawn (or something like that)
Reply
#7

There's a timer that sets colors, but its for players not npc's:
Reply
#8

Quote:
Originally Posted by iLearner
Посмотреть сообщение
There's a timer that sets colors, but its for players not npc's:
can you debug that timer and this function? and check results for ever use?
Reply
#9

SetPlayerColor to white without alpha (0xFFFFFF00) should already do the job - which you do in OnPlayerSpawn. If that does not work there is already something wrong, or interfering.

Anyway this should work, if not you're doing something wrong, or having another issue.

Код:
public OnPlayerStreamIn(playerid, forplayerid) 
{ 
    if(IsPlayerNPC(playerid)) 
    { 
        SetPlayerMarkerForPlayer(forplayerid, playerid, 0x00000000); // Change to grey/white without Alpha
    }
(taken from XeonMaster's reply)

Btw are those default NPCs or are you using FCNPC?
Reply
#10

the function is pretty clear...
PHP код:
stock CheckPlayerColor(playerid)
{
    if(!
IsPlayerNPC(playerid))
    {
        if(
GetPlayerSkin(playerid) == BANDIT)
        {
            
SetPlayerColor(playerid,COLOR_RED);
        }
        if(
GetPlayerSkin(playerid) == HERO)
        {
            
SetPlayerColor(playerid,COLOR_BLUE);
        }
        if(
GetPlayerSkin(playerid) == NORMAL)
        {
            
SetPlayerColor(playerid,COLOR_WHITE);
        }
        if(
GetPlayerSkin(playerid) == FEMALE)
        {
            
SetPlayerColor(playerid,COLOR_PINK);
        }
        if(
GetPlayerSkin(playerid) == CIV)
        {
            
SetPlayerColor(playerid,COLOR_BROWN);
        }
        if(
GetPlayerSkin(playerid) == CIVSKIN)
        {
            
SetPlayerColor(playerid,0x19197000);
        }
        if(
GetPlayerSkin(playerid) == SNIP)
        {
            
SetPlayerColor(playerid,0xADFF2F00);
        }
    }
    return 
1;

@NaS: FCNPC, and nope still doesnt work.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)