SA-MP Forums Archive
How to enable name tags for a specific playerid? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to enable name tags for a specific playerid? (/showthread.php?tid=501580)



How to enable radar blips for a specific playerid? - rangerxxll - 19.03.2014

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] --;
        }
    }



Re: How to enable name tags for a specific playerid? - MP2 - 19.03.2014

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


Re: How to enable name tags for a specific playerid? - rangerxxll - 19.03.2014

I meant radar blip, sorry.


Re: How to enable name tags for a specific playerid? - Aerotactics - 19.03.2014

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


Re: How to enable name tags for a specific playerid? - Raisingz - 19.03.2014

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


Re: How to enable name tags for a specific playerid? - rangerxxll - 19.03.2014

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?


Re: How to enable name tags for a specific playerid? - Raisingz - 19.03.2014

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


Re: How to enable name tags for a specific playerid? - rangerxxll - 19.03.2014

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...?


Re: How to enable name tags for a specific playerid? - Raisingz - 19.03.2014

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

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



Re: How to enable name tags for a specific playerid? - rangerxxll - 19.03.2014

Doesn't work either way bud.