hi, i have tried to write small and simple plugin by myself, which should make welcome hud massege. I think there are some useless code. Is it possible to make it better?
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#define PLUGIN "hud_welcome"
#define VERSION "1.0"
#define AUTHOR "neverminde111"
new bool:g_first[33]
public plugin_init()
{
register_plugin( PLUGIN, VERSION, AUTHOR )
}
public client_connect(id)
{
g_first[id]=true;
}
public client_disconnect(iPlayer)
{
if(task_exists(iPlayer))
{
remove_task(iPlayer)
}
}
public client_putinserver( id )
{
set_task(0.5,"welcome",id,_,_,"a",7)
}
public welcome(iPlayer)
{
if(g_first[iPlayer]==true)
{
g_first[iPlayer]=false
new szName[ 32 ]
get_user_name( iPlayer, szName, 31 )
set_hudmessage(0, 255, 0, 0.05, 0.63, 2, 1.0, 3.5, 0.05, 0.05)
show_hudmessage(iPlayer, "Hi, %s, nice to see you",szName)
}
return PLUGIN_HANDLED
}