How to enable name tags for a specific playerid?
#1

I'm creating a dynamic area and I'd like everyone who is within the area to have their name tags shown to the person who created the area. I'm a tad confused on how to do this - Any help would be appreciated.

This is what I have so far:

pawn Код:
public OnPlayerEnterDynamicArea(playerid, areaid)
{
    for(new i; i != GetMaxPlayers(); i++)
    {
        if(areaid == OBJECT_PROXIMITY_AREA[i]) //Just ignore this, as it works properly.
        {
            SCM(playerid,COLOR_RED, "You've stepped on a proximity bomb.");
            new Float:x, Float:y, Float:z;
            GetPlayerPos(playerid, Float:x, Float:y, Float:z);
            CreateExplosion(x, y, z, 2, 10.0);
            DestroyDynamicObject(OBJECT_PROXIMITY[i]);
            DestroyDynamicArea(OBJECT_PROXIMITY_AREA[i]);
        }
        if(areaid == OBJECT_SENSOR_AREA[i]) //This is the area we are looking at
        {
            SCM(playerid,COLOR_RED, "You've entered a monitored area.");
            SetPlayerMarkerForPlayer( i, i, ( GetPlayerColor( 1 ) | 0x000000FF )); // <---
        }
    }
    return 1;
}

public OnPlayerLeaveDynamicArea(playerid, areaid)
{
    foreach(Player, i)
    {
        ShowPlayerNameTagForPlayer(i, i, 0);
    }
    SCM(playerid,COLOR_GREEN, "You've exited a monitored area.");
}


//This is when a player creates the actual area.
if(dialogid == INVENTORY_MOTIONSENSOR) //
    {
        if(!response) return ShowPlayerDialog(playerid,INVENTORY_MAIN,DIALOG_STYLE_LIST, "Inventory", invstring, "Select", "Cancel");
        if(motionsensor[playerid] == 0) return SCM(playerid,COLOR_GREY, "Error: You don't have any motion sensors");
        if(listitem == 0) //lay sensor
        {
            new Float:x, Float:y, Float:z;
            GetPlayerPos(playerid, Float:x, Float:y, Float:z);
            OBJECT_SENSOR[playerid] = CreateObject(16782, x, y, z-0.8,   0.00000, -90.00000, 0.00000);
            OBJECT_SENSOR_AREA[playerid] = CreateDynamicCircle(x, y, 15.0, -1, -1, -1);
            TogglePlayerDynamicArea(playerid, OBJECT_SENSOR_AREA[playerid], 1);
            SCM(playerid,COLOR_GREEN, "You've activated your motion sensor. Anyone near it will show on your radar.");
            motionsensor[playerid] --;
        }
    }
Reply
#2

SetPlayerMarkerForPlayer only affects the player's radar blip - not their nametag. Use ShowPlayerNameTagForPlayer.
Reply
#3

I meant radar blip, sorry.
Reply
#4

Quote:
Originally Posted by rangerxxll
Посмотреть сообщение
I meant radar blip, sorry.
This is what I was going to suggest, thanks for clarification.
Reply
#5

Have you set the player's color before? Important Note: GetPlayerColor will return nothing unless SetPlayerColor has been used!
Reply
#6

Quote:
Originally Posted by Raisingz
Посмотреть сообщение
Have you set the player's color before? Important Note: GetPlayerColor will return nothing unless SetPlayerColor has been used!
It's used in a admin filterscript my team has developed. Could I add it under OnPlayerEnterDynamicArea?
Reply
#7

Why not OnPlayerConnect? You could just set his color for White in the beggining, doesn't hurt I guess.
Reply
#8

I've added it under onplayer connect, then attempted to show their blip when they enter the area. Nothing happens as usual. Any other fix...?
Reply
#9

Wait, wtf you're doing
Код:
SetPlayerMarkerForPlayer( i, i, ( GetPlayerColor( 1 ) | 0x000000FF ));
~

when it should be
Код:
SetPlayerMarkerForPlayer( playerid, i, ( GetPlayerColor( 1 ) | 0x000000FF ));
Reply
#10

Doesn't work either way bud.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)