Getting user name from menu?
hi, title said all, here is the code:
PHP Code:
#include <amxmodx>
#include <amxmisc>
new bool:ima_hook[ 33 ]
public plugin_init()
{
register_plugin( "GiveHook", "1.2", "serbia delux" )
register_clcmd( "say /givehook", "givehook" )
}
public client_putinserver( id )
ima_hook[ id ] = false
public givehook( id )
{
if( !is_user_admin( id ) )
{
set_hudmessage( 170, 160, 150, 0.1, 0.4, 0, _, 3.0, _, _, - 1 )
show_hudmessage( id, "Nece da moze, moras admin da budes za tu komandu" )
return PLUGIN_HANDLED
}
new p[ 32 ], n, name[ 32 ], tempid[ 10 ], admin_je[ 500 ]
new menu = menu_create( "\yIzaberi igraca^n\dkome hoces hook da das:", "HookKeys" )
menu_setprop( menu, MPROP_NEXTNAME, "Sledeca" )
menu_setprop( menu, MPROP_BACKNAME, "Vrati se" )
menu_setprop( menu, MPROP_EXITNAME, "Exit \d |\y @16. Maj 11." )
get_players( p, n, "c" )
for( new igrac; igrac < n; igrac++ )
{
if( is_user_connected( p[ igrac ] ) )
{
get_user_name( p[ igrac ], name, 31 )
if( is_user_admin( p[ igrac ] ) )
{
if( ima_hook[ p[ igrac ] ] )
{
format( admin_je, charsmax( admin_je ), "\d%s\y%s", name, equal( name, "fshiju" ) ? "BOT" : "*" )
}
else
{
format( admin_je, charsmax( admin_je ), "\w%s\y*", name )
}
}
else
{
if( ima_hook[ p[ igrac ] ] )
{
format( admin_je, charsmax( admin_je ), "\d%s", name )
}
else
{
format( admin_je, charsmax( admin_je ), "\w%s %s", name, equal( name, "JocA" ) ? "\yPRO!" : "" )
}
}
menu_additem( menu, admin_je, tempid )
}
}
menu_display( id, menu )
return PLUGIN_HANDLED
}
public HookKeys( id, menu, item )
{
if( item == MENU_EXIT )
{
menu_destroy( menu )
return PLUGIN_HANDLED
}
new data[ 6], szName[64 ], name[ 32 ]
new access, callback;
menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback);
/*i think this line is prob:*/new tempid = str_to_num(data); get_user_name( get_user_userid( tempid ), name, charsmax( name ) )
if( is_user_connected( tempid ) )
{/*codes from down aren't showed at all :s*/
client_print( id, print_chat, "id odabranog igraca je: %d", get_user_userid( tempid ) )
client_print( id, print_chat, "[SD-KZ] %s sad ima hook.", name )
server_cmd( "kz_hook %s on", name )
ima_hook[ tempid ] = true
}
givehook( id )
return PLUGIN_CONTINUE
}
if anybody know any solution pls post here, thanks <3
ps: i m trying to add '*' to player's nick in menu, and grey color if player already have hook.
|