Raised This Month: $32 Target: $400
 8% 

show rank on connection


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
The RaiD.
Member
Join Date: Jul 2019
Old 06-28-2020 , 09:10   show rank on connection
Reply With Quote #1

Hello can someone edit this plugin, i want that this plugin shows the rankstats too from connected player example: Player connected. [Rank 20]. (using StatsX Shell plugin)
Code:
#include <amxmodx>

#define	PLUGIN	"Connect Announce"
#define	VERSION	"0.2"
#define	AUTHOR	"v3x"

new g_iMsgSayText, g_szSoundFile[] = "buttons/blip1.wav";

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR);
	g_iMsgSayText = get_user_msgid("SayText");
}

public plugin_precache()
{
	precache_sound(g_szSoundFile);
}

public client_authorized(id)
{
	if(is_user_bot(id)) return PLUGIN_CONTINUE;

	new szUserName[33];
	get_user_name(id, szUserName, 32);

	new szAuthID[33];
	get_user_authid(id , szAuthID , 32);

	new iPlayers[32], iNum, i;
	get_players(iPlayers, iNum);

	for(i = 0; i <= iNum; i++)
	{
		new x = iPlayers[i];

		if(!is_user_connected(x) || is_user_bot(x)) continue;

		client_cmd(x, "spk %s", g_szSoundFile);

		new szMessage[164];
		format(szMessage, 163, "^x04%s (^x01%s^x04) connected", szUserName , szAuthID);

		message_begin( MSG_ONE, g_iMsgSayText, {0,0,0}, x );
		write_byte  ( x );
		write_string( szMessage );
		message_end ();
	}

	return PLUGIN_CONTINUE;
}

Last edited by The RaiD.; 06-28-2020 at 10:21.
The RaiD. is offline
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 06-28-2020 , 12:47   Re: show rank on connection
Reply With Quote #2

Code:
#include <amxmodx> #include <csstats> #define PLUGIN   "Connect Announce" #define VERSION  "0.2" #define AUTHOR   "v3x" new g_iMsgSayText, g_szSoundFile[] = "buttons/blip1.wav"; public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR);     g_iMsgSayText = get_user_msgid("SayText"); } public plugin_precache() {     precache_sound(g_szSoundFile); } public client_authorized(id) {     if(is_user_bot(id)) return PLUGIN_CONTINUE;     new szUserName[33];     get_user_name(id, szUserName, 32);     new szAuthID[33];     get_user_authid(id , szAuthID , 32);     new iPlayers[32], iNum, i;     get_players(iPlayers, iNum);     for(i = 0; i <= iNum; i++)     {         new x = iPlayers[i];         if(!is_user_connected(x) || is_user_bot(x)) continue;         client_cmd(x, "spk %s", g_szSoundFile);                 new szRank;         new szStats[8];         new szBody[8];                 szRank = get_user_stats(id, szStats, szBody);         new szMessage[164];         format(szMessage, 163, "^x04%s ^x01Rank^x04:^x04[^x01%d^x04] (^x01%s^x04) connected", szUserName , szRank, szAuthID);         message_begin( MSG_ONE, g_iMsgSayText, {0,0,0}, x );         write_byte  ( x );         write_string( szMessage );         message_end ();     }     return PLUGIN_CONTINUE; }

Last edited by alferd; 06-28-2020 at 14:34.
alferd is offline
The RaiD.
Member
Join Date: Jul 2019
Old 06-28-2020 , 13:47   Re: show rank on connection
Reply With Quote #3

i have many errors i cant compile it
undefined smybol iRank
expression has not effect
expected token ";" but found "
too many error messages on one line
The RaiD. is offline
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 06-28-2020 , 14:35   Re: show rank on connection
Reply With Quote #4

fixed
alferd is offline
The RaiD.
Member
Join Date: Jul 2019
Old 06-28-2020 , 16:53   Re: show rank on connection
Reply With Quote #5

it works now but if someone connects it shows always Rank: 0 on all Players ..
The RaiD. is offline
ZaX
Senior Member
Join Date: Jan 2015
Old 06-28-2020 , 17:34   Re: show rank on connection
Reply With Quote #6

Code:
#include <amxmodx> #include <csx>   #define PLUGIN "Connect Announce" #define VERSION "0.2" #define AUTHOR "v3x" new g_iMsgSayText ,g_szSoundFile[] = "buttons/blip1.wav";   public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR);     g_iMsgSayText = get_user_msgid("SayText"); }   public plugin_precache() {     precache_sound(g_szSoundFile); }   public client_connect(id) {     set_task(0.5, "client_joined", id); } public client_joined(id) {     if(is_user_bot(id))     {         return PLUGIN_CONTINUE;     }       new szUserName[33];     get_user_name(id, szUserName, 32);       new szAuthID[33];     get_user_authid(id, szAuthID, 32);       new izStats[8], izBody[8];     new iRankPos = get_user_stats(id, izStats, izBody);     new iRankMax = get_statsnum();        new iPlayers[32], iNum, i;     get_players(iPlayers, iNum);     for(i = 0; i <= iNum; i++)     {         new x = iPlayers[i];           if(!is_user_connected(x) || is_user_bot(x))         {             continue;         }           client_cmd(x, "spk %s", g_szSoundFile);           new szMessage[164];         format(szMessage, 163, "^x04%s (^x01%s^x04) connected ^x01(RANK: %d of %d)", szUserName, szAuthID, iRankPos, iRankMax);           message_begin(MSG_ONE, g_iMsgSayText, {0,0,0}, x);         write_byte(x);         write_string(szMessage);         message_end();     }       return PLUGIN_CONTINUE; }
ZaX is offline
The RaiD.
Member
Join Date: Jul 2019
Old 06-28-2020 , 17:48   Re: show rank on connection
Reply With Quote #7

G | S.W.A.T (STEAM_1:0:2121689914) connected (RANK: 0 of 11129) still same rank 0
The RaiD. is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 06-28-2020 , 19:33   Re: show rank on connection
Reply With Quote #8

The rank is only updated after the player spawns, use a task of 0.5 to guarantee and everything is fine.
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
The RaiD.
Member
Join Date: Jul 2019
Old 06-29-2020 , 03:41   Re: show rank on connection
Reply With Quote #9

there is already a task of 0.5 but still the same problem
The RaiD. is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 06-29-2020 , 04:20   Re: show rank on connection
Reply With Quote #10

Quote:
Originally Posted by The RaiD. View Post
there is already a task of 0.5 but still the same problem
Try This:
PHP Code:
#include <amxmodx>
#include <csstats>


public plugin_init() 
{
    
register_plugin("InfoMessage""1.0""MrAbdoO");
}

public 
client_putinserver(iPlayer)
{
    
set_task(8.0"go_info"iPlayer""0""0);
}

public 
go_info(id)
{
    new 
stats], body], szName32 ], szAuth32 ];
    new 
rank_pos get_user_statsidstatsbody )
    new 
rank_max get_statsnum( )
    
get_user_nameidszName31 )
    
get_user_authid(id szAuth 31)
    
ChatColor(0"!tPlayer !t%s !g(%s) !nhas connected to server. Rank is !g%d!nfrom !g%d!n."szNameszAuthrank_posrank_max);
    return 
0;
}

// Colour Chat
stock ChatColor(const id, const input[], any:...)
{
    new 
count 1players[32];
    static 
msg[191];
    
vformat(msg190input3);
    
    
replace_all(msg190"!g""^x04"); // Green Color
    
replace_all(msg190"!n""^x01"); // Default Color
    
replace_all(msg190"!t""^x03"); // Team Color
    
    
if (idplayers[0] = id; else get_players(playerscount"ch");
    
    for (new 
0counti++)
    {
        if (
is_user_connected(players[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i]);
            
write_byte(players[i]);
            
write_string(msg);
            
message_end();
        }
    }


Last edited by Supremache; 06-29-2020 at 04:20.
Supremache is offline
Old 06-29-2020, 05:29
The RaiD.
This message has been deleted by The RaiD..
Reply


Thread Tools
Display Modes

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 02:39.


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