Raised This Month: $ Target: $400
 0% 

Rank message fail :/


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 04-29-2013 , 07:51   Re: Rank message fail :/
Reply With Quote #1

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 #2

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
zi443r
Senior Member
Join Date: Mar 2009
Location: Braila,Romania
Old 04-29-2013 , 09:35   Re: Rank message fail :/
Reply With Quote #3

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)
         
    }

__________________

Last edited by zi443r; 04-29-2013 at 09:36.
zi443r is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 04-29-2013 , 13:14   Re: Rank message fail :/
Reply With Quote #4

Are you guys kiding me? :/
You cant make things on client_putinserver
It didnt loaded rank yet. And with task it would be task like 5-10 seconds not 0.1
Try read all with attention please, before make things that i already tried....
__________________
Jhob94 is offline
Podarok
BANNED
Join Date: Jan 2011
Location: Narnia
Old 04-29-2013 , 13:39   Re: Rank message fail :/
Reply With Quote #5

Why not just to make it on client connect?
Podarok is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 04-29-2013 , 13:53   Re: Rank message fail :/
Reply With Quote #6

Quote:
Originally Posted by Podarok View Post
Why not just to make it on client connect?
Ranks not loaded yet
__________________
Jhob94 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-29-2013 , 13:56   Re: Rank message fail :/
Reply With Quote #7

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

#pragma semicolon 1

#define PLUGIN ""
#define VERSION "0.0.1"

public plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" );
    
register_logevent("LogEvent_EnteredTheGame"2"1=entered the game");
}

public 
LogEvent_EnteredTheGame()
{
    new 
id get_user_logindex();
    if( !
is_user_bot(id) )
    {
        new 
crap[8], rank get_user_stats(idcrapcrap);
    }
}

get_loguser_index()
{
    new 
szLog[80], szName[32];
    
read_logargv(0szLogcharsmax(szLog));
    
parse_loguser(szLogszNamecharsmax(szName));

    return 
get_user_index(szName);

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 04-29-2013 at 13:56.
ConnorMcLeod is offline
Strick3n
Member
Join Date: Apr 2013
Old 04-29-2013 , 15:22   Re: Rank message fail :/
Reply With Quote #8

Quote:
Originally Posted by ConnorMcLeod View Post
PHP Code:
#include < amxmodx >
#include < csx >

#pragma semicolon 1

#define PLUGIN ""
#define VERSION "0.0.1"

public plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" );
    
register_logevent("LogEvent_EnteredTheGame"2"1=entered the game");
}

public 
LogEvent_EnteredTheGame()
{
    new 
id get_user_logindex();
    if( !
is_user_bot(id) )
    {
        new 
crap[8], rank get_user_stats(idcrapcrap);
    }
}

get_loguser_index()
{
    new 
szLog[80], szName[32];
    
read_logargv(0szLogcharsmax(szLog));
    
parse_loguser(szLogszNamecharsmax(szName));

    return 
get_user_index(szName);

get_loguser_index is never used.
get_user_logindex ==> get_loguser_index.
Strick3n is offline
zi443r
Senior Member
Join Date: Mar 2009
Location: Braila,Romania
Old 04-29-2013 , 13:55   Re: Rank message fail :/
Reply With Quote #9

of course, doesn't work i will test it on live server in a few minutes
[IMG]http://img826.**************/img826/1424/clipboard1k.jpg[/IMG]
__________________

Last edited by zi443r; 04-29-2013 at 14:38.
zi443r 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