Raised This Month: $ Target: $400
 0% 

Rank message fail :/


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
zi443r
Senior Member
Join Date: Mar 2009
Location: Braila,Romania
Old 04-29-2013 , 04:38   Re: Rank message fail :/
Reply With Quote #1

try
PHP Code:
#include <csstats> 
__________________
zi443r is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 04-29-2013 , 07:51   Re: Rank message fail :/
Reply With Quote #2

Quote:
Originally Posted by zi443r View Post
try
PHP Code:
#include <csstats> 
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....
__________________
Jhob94 is offline
Strick3n
Member
Join Date: Apr 2013
Old 04-29-2013 , 09:36   Re: Rank message fail :/
Reply With Quote #3

Quote:
Originally Posted by Jhob94 View Post
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 View Post
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(idiStatsiStats)
    
get_user_name(id,name,31)
    
    if(!
is_user_bot(id))
    {
        if(
Rank <= 15)
         
client_print(0print_chat"[%s] %s joined the server. Be careful his rank is %d !"MESSAGE_PREFIXnameRank)
              
        else
          
client_print(0print_chat"[%s] %s joined the server. His rank is %d ."MESSAGE_PREFIXnameRank)
         
    }

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.
Strick3n 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 10:53.


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