Raised This Month: $ Target: $400
 0% 

client print_console


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
J4CK
Member
Join Date: Dec 2008
Location: India
Old 12-01-2010 , 14:00   client print_console
Reply With Quote #1

I want when player join my server, all players can see in console:

[user connect] Name from Country

why dont works ?
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <geoip>

public client_putinserver(id) {

        static 
putin_name[32]
        
get_user_name(id,putin_name,32)

        static 
ip[17],country[46]
        
get_user_ip(id,ip,16,1)
    
        
geoip_country(ip,country,45)
        
        if(
equal(country,"error"))
            
client_print(0print_console"[user connect] %s from [%s]",putin_name"unknown")
        else
            
client_print(0print_console"[user connect] %s from [%s]",putin_name,country)

J4CK is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 12-01-2010 , 15:09   Re: client print_console
Reply With Quote #2

You might have to loop through all the players and send it individually.

I know that with console_print, sending 0 sends it to the server console.

I don't know if client_print with print_console and using 0 as the id, if it actually sends it to all players or just the console.

Since it doesn't seem to be working, you might want to just loop through all players.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-01-2010 , 16:53   Re: client print_console
Reply With Quote #3

client_print() will use 0 for all players regardless of where it is printed.

Code:
static cell AMX_NATIVE_CALL client_print(AMX *amx, cell *params) /* 3 param */
{
	int len = 0;
	char *msg;
	
	// if id = 0
	if (params[1] == 0)
	{
		// print to all players
		for (int i = 1; i <= gpGlobals->maxClients; ++i)
		{
			CPlayer *pPlayer = GET_PLAYER_POINTER_I(i);
			
			if (pPlayer->ingame)
			{
				g_langMngr.SetDefLang(i);
				msg = format_amxstring(amx, params, 3, len);
				msg[len++] = '\n';
				msg[len] = 0;
				UTIL_ClientPrint(pPlayer->pEdict, params[2], msg);
			}
		}
	} else {// id is not 0
		// print to id
		int index = params[1];
		
		if (index < 1 || index > gpGlobals->maxClients)
		{
			LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);
			return 0;
		}
		
		CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
		g_langMngr.SetDefLang(index);
		
		msg = format_amxstring(amx, params, 3, len);
		msg[len++] = '\n';
		msg[len] = 0;
		
		if (pPlayer->ingame)
			UTIL_ClientPrint(pPlayer->pEdict, params[2], msg);		//format_amxstring(amx, params, 3, len));
	}
	
	return len;
}
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Old 12-01-2010, 18:04
fysiks
This message has been deleted by fysiks. Reason: Oops, I'm wrong. FuncWiki for the win.
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 11:16.


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