Raised This Month: $ Target: $400
 0% 

get_user_userid help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kkthx
Junior Member
Join Date: Jun 2012
Old 06-27-2012 , 15:29   get_user_userid help
Reply With Quote #1

Hello, this one shows no userid, why?

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "uid"
#define VERSION "0.1"
#define AUTHOR "kkthx"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say uid","uid",1,"- Shows userid")
}

public 
uid(id) {
    if(!
is_user_connected(id)) {
        return 
PLUGIN_HANDLED
    
}

    
client_print(idprint_chat,"-> %s"get_user_userid(id))

    return 
PLUGIN_HANDLED
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1257\\ deff0\\ deflang1063{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/ 
kkthx is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-27-2012 , 15:31   Re: get_user_userid help
Reply With Quote #2

%s - String formatting parameter
userid - Integer value

You are mixing 2 data types.
You should use %d or %i.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
kkthx
Junior Member
Join Date: Jun 2012
Old 06-27-2012 , 15:35   Re: get_user_userid help
Reply With Quote #3

Thanks m8
kkthx is offline
Aooka
Veteran Member
Join Date: Aug 2011
Location: Villeurbanne
Old 06-27-2012 , 15:41   Re: get_user_userid help
Reply With Quote #4

I do not understand what you are doing ^^

Why do you include amxmisc ? Because it's was here when you opened AmxStudioX ? lol

Code:
#include < amxmodx > public plugin_init( ) {     register_plugin( "AMXX Authid" , "1.0" , "Aooka" );         register_clcmd( "say /uid" , "ClientCommand_Userid" );     register_clcmd( "say_team /uid" , "ClientCommand_Userid" ); } public ClientCommand_Userid( const id ) {     if( !is_user_connected( id ) )         return 1;             else     {         new szAuthID[ 32 ];         get_user_authid( id , szAuthID , 31 );                 client_print( id , print_chat , "Your steam ID is -> %s" , szAuthID );     }     return 0; }

Read this and if you don't understand tel me.
__________________
Pawn ? Useless

Last edited by Aooka; 06-27-2012 at 16:13.
Aooka is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-27-2012 , 16:00   Re: get_user_userid help
Reply With Quote #5

Quote:
Originally Posted by Aooka View Post
Code:
        new szAuthID[ 32 ];         get_user_authid( id , szAuthID , 31 );                 client_print( id , print_chat , "Your steam ID is -> %d" , szAuthID );     }     return 0; }
You did it wrong, too. "szAuthID" is a string, so you should use %s.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Aooka
Veteran Member
Join Date: Aug 2011
Location: Villeurbanne
Old 06-27-2012 , 16:13   Re: get_user_userid help
Reply With Quote #6

Oh yes... edited. Thanks
__________________
Pawn ? Useless

Last edited by Aooka; 06-27-2012 at 16:13.
Aooka is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 06-27-2012 , 18:43   Re: get_user_userid help
Reply With Quote #7

Quote:
Originally Posted by Aooka View Post
I do not understand what you are doing ^^

Why do you include amxmisc ? Because it's was here when you opened AmxStudioX ? lol

Code:
#include < amxmodx > public plugin_init( ) { &nbsp;&nbsp;&nbsp;&nbsp;register_plugin( "AMXX Authid" , "1.0" , "Aooka" ); &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;register_clcmd( "say /uid" , "ClientCommand_Userid" ); &nbsp;&nbsp;&nbsp;&nbsp;register_clcmd( "say_team /uid" , "ClientCommand_Userid" ); } public ClientCommand_Userid( const id ) { &nbsp;&nbsp;&nbsp;&nbsp;if( !is_user_connected( id ) ) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;return 1; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp; &nbsp;&nbsp;&nbsp;&nbsp;else &nbsp;&nbsp;&nbsp;&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;new szAuthID[ 32 ]; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;get_user_authid( id , szAuthID , 31 ); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;client_print( id , print_chat , "Your steam ID is -> %s" , szAuthID ); &nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;&nbsp;&nbsp;return 0; }


Read this and if you don't understand tel me.
He wants to show userid, is not the same as steamid.
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 06-27-2012 , 19:11   Re: get_user_userid help
Reply With Quote #8

Quote:
Originally Posted by Neeeeeeeeeel.- View Post
He wants to show userid, is not the same as steamid.
in that case he should use just id, rather than calling get_user_userid(id) if i understand correctly....they'll be the same. Why that's in there, i don't know.
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 06-27-2012 , 19:19   Re: get_user_userid help
Reply With Quote #9

PHP Code:
#include <amxmodx>

public plugin_init()
{
    
register_plugin("My Info",AMXX_VERSION_STR,"SmileY");
    
    
register_clcmd("say .kickme","cmdKickMe");
    
register_clcmd("say .banme","cmdMySteam");
}


// Its returns a UserID in server (See the "status" command in console) Format: #ID (Not: STEAM_0:0:00000) !!
public cmdKickMe(idserver_cmd("kick #%d ^"See you later..^"",get_user_userid(id));

public 
cmdMySteam(id)
{
    new 
SteamID[35];
    
get_user_authid(id,SteamID,charsmax(SteamID));

    
server_cmd("amx_addban ^"%s^" 10 ^"Come back in 10 minutes..^"",SteamID); // Its a String! (Format: STEAM_0:0:00000)

    
cmdKickMe(id);

__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-27-2012 , 20:19   Re: get_user_userid help
Reply With Quote #10

Quote:
Originally Posted by Liverwiz View Post
in that case he should use just id, rather than calling get_user_userid(id) if i understand correctly....they'll be the same. Why that's in there, i don't know.
No they are not the same.

From the FuncWiki
A userid is incremented on each connect to the server. It's not an index into an edict list, like a player index (from 1-32).
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou 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 06:12.


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