PHP Code:
#include <amxmodx>
public client_putinserver(id)
set_task(2.0, "showName", id, _, _, "b")
public client_disconnect(id)
remove_task(id)
public showName(id)
{
new szName[32]
get_user_name(id, szName, charsmax(szName))
set_hudmessage(210, 105, 30, 0.01, 0.76, 0, _, 1.9, _, 0.1, -1)
show_hudmessage(id, "Your name: %s", szName)
}
hectorz0r, your code will not work how he wants because your task will execute only once.. he wants the nick to be constantly printed... also, what's the deal with read_data() over there ? O.o
And also no codes would work because you two forgot a " in the set_task() and also you don't remove the task and there will be some serious load after many player connects and disconnects.
Also...
Quote:
Originally Posted by worldspawn
this script must show you some hudmess with your name, but when new player connects in hudmess you will see his name and hudmess will be shown to all players.
Can anybody tell me how to prevent this?
|
That's because your global variable doesn't have indexes for every player, but for one, when a player connects the variable will be overwrite... if you want to use global string variables for each players you should do something like:
PHP Code:
new g_szName[33][32] /* 33 because counting starts from 0 */
/* in a function that has a player id */
get_user_name(id, g_szName[id], charsmax(g_szName[])
__________________