|
Member
|

04-29-2013
, 09:36
Re: Rank message fail :/
|
#3
|
Quote:
Originally Posted by Jhob94
Ah?
Thats already fixed, the current problem isnt more about the rank 
But i will find some way to fix it. Maybe with task, but task wont be exactly when i want....
|
so what is your problem now ?
maybe we can help you.
Quote:
Originally Posted by zi443r
try this:
PHP Code:
#include <amxmodx>
#include <csx>
#include <csstats>
// thanks to: jsauce&Arkshine
#define MESSAGE_PREFIX "AMXX"
public plugin_init() {
register_plugin("Client Connect Rank", "0.0.1", "Jhob94")
}
public client_putinserver(id)
{
set_task(0.1,"get_rank",id)
}
public get_rank(id)
{
new name[32]
static iStats[8]
new Rank = get_user_stats(id, iStats, iStats)
get_user_name(id,name,31)
if(!is_user_bot(id))
{
if(Rank <= 15)
client_print(0, print_chat, "[%s] %s joined the server. Be careful his rank is %d !", MESSAGE_PREFIX, name, Rank)
else
client_print(0, print_chat, "[%s] %s joined the server. His rank is %d .", MESSAGE_PREFIX, name, Rank)
}
}
|
better way:
Code:
#include < amxmodx >
#include < csstats >
public plugin_init()
{
register_plugin( "Client Connect Rank", "0.0.1", "Jhob94" );
}
public client_putinserver( client )
{
static iStats[ 2 ][ 8 ], iRank;
iRank = get_user_stats( client, iStats[ 0 ], iStats[ 1 ] );
if( !is_user_bot( client ) )
{
if( iRank <= 15 )
PrintChat( 0, "%s joined the server. Be careful his rank is %i !", GetUserName( client ), iRank );
else
PrintChat( 0, "%s joined the server. His rank is %i.", GetUserName( client ), iRank );
}
}
GetUserName( const index )
{
static name[ 32 ];
get_user_name( index, name, charsmax( name ) );
return name;
}
PrintChat( const index, const string[], any:... )
{
new szMessage[ 192 ], iPlayers[ 32 ], iCount = 1;
static iPos; iPos = formatex( szMessage, charsmax( szMessage ), "[AMXX] " );
vformat( szMessage[ iPos ], charsmax( szMessage ) - iPos, string, 3 );
if( index ) iPlayers[ 0 ] = index;
else get_players( iPlayers, iCount, "ch" );
for( new i = 0; i < iCount; i++ )
client_print( iPlayers[ i ], print_chat, szMessage );
}
it works like a charm.
Last edited by Strick3n; 04-29-2013 at 09:40.
|
|