SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 15/07/2020, 03:28 AM   #1
Luckyyyyy
Little Clucker
 
Join Date: May 2020
Location: Philippines
Posts: 8
Reputation: 0
Post Playerid only in nametag?? Is that possible

Is theres a script that turns off playername in the nametag and the playerid not be removed.

Or its playerid only no names in nametag instead of

John_Smith(1)

It will become

(1)

For short playerid only?? Can someone help me

Last edited by Luckyyyyy; 15/07/2020 at 05:44 AM.
Luckyyyyy is offline   Reply With Quote
Old 15/07/2020, 06:08 AM   #2
GeorgeLimit
Big Clucker
 
GeorgeLimit's Avatar
 
Join Date: Mar 2018
Location: Jawa Timur, Indonesia
Posts: 153
Reputation: 0
Default Re: No nametag id only

https://wiki.sa-mp.com/wiki/ShowNameTags

OnPlayerConnect(playerid)
{
// create 3d text label
}
__________________

Quote:
That is perfectly fine, I'm just pointing out where you made mistakes what does hearing "good job" get you? Absolutely nothing. You need to hear the problems otherwise you'll keep making the same mistakes
GeorgeLimit is online now   Reply With Quote
Old 15/07/2020, 09:53 AM   #3
Luckyyyyy
Little Clucker
 
Join Date: May 2020
Location: Philippines
Posts: 8
Reputation: 0
Default Re: No nametag id only

Whats wrong?

#include <a_samp>
#define NAME_DRAWDISTANCE (20)
new Text3D:ID[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
ID[playerid] = Create3DTextLabel( playerid, 0xFFFFFFFF, 0, 0, 0, NAME_DRAWDISTANCE, 0, 1 );
Attach3DTextLabelToPlayer(ID[playerid], playerid, 0.0, 0.0, 0.2);
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
Delete3DTextLabel( ID[playerid] );
return 1;
}
Luckyyyyy is offline   Reply With Quote
Old 15/07/2020, 11:32 AM   #4
NaS
High-roller
 
NaS's Avatar
 
Join Date: Mar 2008
Location: 🇩🇪
Posts: 1,785
Reputation: 635
Default Re: No nametag id only

Quote:
Originally Posted by Luckyyyyy View Post
Whats wrong?

#include <a_samp>
#define NAME_DRAWDISTANCE (20)
new Text3D:ID[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
ID[playerid] = Create3DTextLabel( playerid, 0xFFFFFFFF, 0, 0, 0, NAME_DRAWDISTANCE, 0, 1 );
Attach3DTextLabelToPlayer(ID[playerid], playerid, 0.0, 0.0, 0.2);
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
Delete3DTextLabel( ID[playerid] );
return 1;
}
Please use [code] or [php] tags to show code. It also helps a lot posting the response of the compiler (and marking the error line).

You passed playerid to the "text" argument which is a string.

The playerid must be formatted into a string first, which you can then pass to the text argument:

Code:
new text[6]; // Max 5 chars
format(text, sizeof(text), "(%d)", playerid);
NaS is offline   Reply With Quote
Old 15/07/2020, 12:41 PM   #5
Luckyyyyy
Little Clucker
 
Join Date: May 2020
Location: Philippines
Posts: 8
Reputation: 0
Default Re: No nametag id only

Code:
#include <a_samp>
#define NAME_DRAWDISTANCE (20) 
new Text:ID[MAX_PLAYERS];
format(text, sizeof(text), "(%d)", playerid);

public OnPlayerConnect(playerid)
{
	ID[playerid] = CreateTextLabel( ID, 0xFFFFFFFF, 0, 0, 0, NAME_DRAWDISTANCE, 0, 1 );
    AttachTextLabelToPlayer(ID[playerid], playerid, 0.0, 0.0, 0.2);
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    DeleteTextLabel( ID[playerid] );
	return 1;
}
Is it now correct??
Luckyyyyy is offline   Reply With Quote
Old 15/07/2020, 01:07 PM   #6
algorhitmically
Little Clucker
 
Join Date: Feb 2020
Posts: 35
Reputation: 22
Default Re: No nametag id only

pawn Code:
#include <a_samp>

#define NAMETAG_DRAWDISTANCE (20)
#define NAMETAG_COLOR (0xFFFFFFFF)

new Text:pIDLabel[MAX_PLAYERS];

public OnGameModeInit()
{
    ShowNameTags(0);
}

public OnPlayerConnect(playerid)
{
    new text[7];
    format(text, sizeof text, "(%d)", playerid);
    pIDLabel[playerid] = Create3DTextLabel(text, NAMETAG_COLOR, 0, 0, 0, NAMETAG_DRAWDISTANCE, 0, 1);
    Attach3DTextLabelToPlayer(pIDLabel[playerid], playerid, 0.0, 0.0, 0.2);
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    Delete3DTextLabel(pIDLabel[playerid]);
    pIDLabel[playerid] = INVALID_3DTEXT_ID;
    return 1;
}
algorhitmically is offline   Reply With Quote
Old 16/07/2020, 02:50 AM   #7
Luckyyyyy
Little Clucker
 
Join Date: May 2020
Location: Philippines
Posts: 8
Reputation: 0
Default Re: No nametag id only

Thanks bro
Luckyyyyy is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Nametag Zeus666 Scripting Help 2 02/11/2018 09:09 PM
Nametag Johny32 Scripting Help 0 01/07/2016 01:41 PM
[Include] [INC] NameTag Fro1sha Релизы/Releases 2 06/05/2010 06:51 AM
NameTag FreeSoul Help Archive 1 28/05/2009 06:42 AM


All times are GMT. The time now is 11:49 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.