Raised This Month: $ Target: $400
 0% 

Getting user name from menu?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JocAnis
Veteran Member
Join Date: Jun 2010
Old 05-16-2011 , 07:00   Getting user name from menu?
Reply With Quote #1

hi, title said all, here is the code:
PHP Code:
#include <amxmodx>
#include <amxmisc>

new bool:ima_hook33 ]

public 
plugin_init() 
{
    
register_plugin"GiveHook""1.2""serbia delux" )
    
    
register_clcmd"say /givehook""givehook" )
}    
public 
client_putinserverid )
    
ima_hookid ] = false
    
public givehookid )
{
    if( !
is_user_adminid ) )
    {
        
set_hudmessage1701601500.10.40_3.0__, - )
        
show_hudmessageid"Nece da moze, moras admin da budes za tu komandu" )
        return 
PLUGIN_HANDLED
    
}    
    new 
p32 ], nname32 ], tempid10 ], admin_je500 ]
    new 
menu menu_create"\yIzaberi igraca^n\dkome hoces hook da das:""HookKeys" )
    
    
menu_setpropmenuMPROP_NEXTNAME"Sledeca" )
    
menu_setpropmenuMPROP_BACKNAME"Vrati se" )
    
menu_setpropmenuMPROP_EXITNAME"Exit \d     |\y     @16. Maj 11." )
    
    
get_playerspn"c" )
    for( new 
igracigrac nigrac++ )
    {
        if( 
is_user_connectedpigrac ] ) )
        {
            
get_user_namepigrac ], name31 )
            if( 
is_user_adminpigrac ] ) )
            {
                if( 
ima_hookpigrac ] ] )
                {
                    
formatadmin_jecharsmaxadmin_je ), "\d%s\y%s"nameequalname"fshiju" ) ? "BOT" "*" )
                }
                else
                {
                    
formatadmin_jecharsmaxadmin_je ), "\w%s\y*"name )
                }
            }
            else
            {
                if( 
ima_hookpigrac ] ] )
                {
                    
formatadmin_jecharsmaxadmin_je ), "\d%s"name )
                }
                else
                {
                    
formatadmin_jecharsmaxadmin_je ), "\w%s %s"nameequalname"JocA" ) ? "\yPRO!" "" )
                }
            }
            
menu_additemmenuadmin_jetempid )
        }
    }
    
menu_displayidmenu )
    return 
PLUGIN_HANDLED
}
public 
HookKeysidmenuitem )
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroymenu )
        return 
PLUGIN_HANDLED
    
}
    new 
data6], szName[64 ], name32 ]
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,charsmax(data), szName,charsmax(szName), callback);

    
/*i think this line is prob:*/new tempid str_to_num(data); get_user_nameget_user_useridtempid ), namecharsmaxname ) )
    
    if( 
is_user_connectedtempid ) )
    {
/*codes from down aren't showed at all :s*/
        
client_printidprint_chat"id odabranog igraca je: %d"get_user_useridtempid ) )
        
client_printidprint_chat"[SD-KZ] %s sad ima hook."name )
        
server_cmd"kz_hook %s on"name )
        
ima_hooktempid ] = true
    
}
    
givehookid )
    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.
JocAnis is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-16-2011 , 13:00   Re: Getting user name from menu?
Reply With Quote #2

The tempid string in give_hook() is never assigned any values. You need to use num_to_str() with p[ igrac ].

Also, with get_user_name() you should NOT use get_user_userid(). You should use tempid.

P.S. Title did not say all. Always describe your issue in detail; never assume we can understand anything from the title.
__________________

Last edited by fysiks; 05-16-2011 at 13:10.
fysiks is offline
Reply



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

Forum Jump


All times are GMT -4. The time now is 04:21.


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