AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   player name (https://forums.alliedmods.net/showthread.php?t=326835)

anakonda001 08-19-2020 05:42

player name
 
hi, how can I fix it? in the chat instead of the player's name writes Half Life Dedicated Server

Code:

new name[33]
get_user_name(0, name, 32)

ChatColor(0, "Player %s zeroed out the murders!", name)


Natsheh 08-19-2020 06:14

Re: player name
 
Show full code or at least the function

anakonda001 08-19-2020 06:47

Re: player name
 
Quote:

Originally Posted by Natsheh (Post 2714769)
Show full code or at least the function

look in your personal messages

DJEarthQuake 08-19-2020 07:13

Re: player name
 
Quote:

Originally Posted by anakonda001 (Post 2714768)
hi, how can I fix it? in the chat instead of the player's name writes Half Life Dedicated Server

Code:

new name[33]
get_user_name(0, name, 32)

ChatColor(0, "Player %s zeroed out the murders!", name)



get_user_name(0, name, 32)


get_user_name(id, name, 32)

Supremache 08-19-2020 07:28

Re: player name
 
Quote:

Originally Posted by anakonda001 (Post 2714768)
hi, how can I fix it? in the chat instead of the player's name writes Half Life Dedicated Server

Code:

new name[33]
get_user_name(0, name, 32)

ChatColor(0, "Player %s zeroed out the murders!", name)


try this
PHP Code:

static szName[32]
            
get_user_name(indexszNamecharsmax(szName))
ChatColor(0"Player %s zeroed out the murders!"szName


anakonda001 08-19-2020 07:30

Re: player name
 
Quote:

Originally Posted by DJEarthQuake (Post 2714772)
get_user_name(0, name, 32)


get_user_name(id, name, 32)

need 0, want that would nick player saw all

anakonda001 08-19-2020 07:42

Re: player name
 
do so
get_user_name(iPlayer, name, 32)

ZaX 08-19-2020 07:56

Re: player name
 
You need to provide a valid index for the player in the get_user_name. Index 0 is the server so it will get the servers name.
You dont use '0' index to get everyones name, however I dont think you need to get everyones name in here, what for? Show the function if you want to get help. Dont send in private message to someone

@Supremache
What you did already explained by DJEathQuake

anakonda001 08-19-2020 08:06

Re: player name
 
Quote:

Originally Posted by ZaX (Post 2714781)
You need to provide a valid index for the player in the get_user_name. Index 0 is the server so it will get the servers name.
You dont use '0' index to get everyones name, however I dont think you need to get everyones name in here, what for? Show the function if you want to get help. Dont send in private message to someone

do so
get_user_name (iPlayer, name, 32) seems to work

fysiks 08-19-2020 23:11

Re: player name
 
If you had posted the full code, or probably even just the function, this would have been solved with only one reply instead of 8.

Generally, the more information/code you provide, the better and quicker advice you will get.


All times are GMT -4. The time now is 13:52.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.