AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get_user_userid help (https://forums.alliedmods.net/showthread.php?t=188548)

kkthx 06-27-2012 15:29

get_user_userid help
 
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 }
*/ 


Exolent[jNr] 06-27-2012 15:31

Re: get_user_userid help
 
%s - String formatting parameter
userid - Integer value

You are mixing 2 data types.
You should use %d or %i.

kkthx 06-27-2012 15:35

Re: get_user_userid help
 
Thanks m8

Aooka 06-27-2012 15:41

Re: get_user_userid help
 
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.

Exolent[jNr] 06-27-2012 16:00

Re: get_user_userid help
 
Quote:

Originally Posted by Aooka (Post 1737496)
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.

Aooka 06-27-2012 16:13

Re: get_user_userid help
 
Oh yes... edited. Thanks

Neeeeeeeeeel.- 06-27-2012 18:43

Re: get_user_userid help
 
Quote:

Originally Posted by Aooka (Post 1737496)
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.

Liverwiz 06-27-2012 19:11

Re: get_user_userid help
 
Quote:

Originally Posted by Neeeeeeeeeel.- (Post 1737601)
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.

^SmileY 06-27-2012 19:19

Re: get_user_userid help
 
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);



YamiKaitou 06-27-2012 20:19

Re: get_user_userid help
 
Quote:

Originally Posted by Liverwiz (Post 1737615)
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).


All times are GMT -4. The time now is 06:12.

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