Raised This Month: $51 Target: $400
 12% 

Plugin connect message problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
andre2843
Member
Join Date: Apr 2011
Old 03-10-2015 , 18:17   Plugin connect message problem
Reply With Quote #1

I have problem this plugin what solution,plugin not print in chat please help-me.

PHP Code:
#include <sourcemod> 
#include <geoip> 
#include <colors> 

#define PL_VERSION "1.0" 

public Plugin:myinfo =  

    
name "Connect Message"
    
author ""
    
description ""
    
version PL_VERSION
    
url "" 
}; 

public 
OnPluginStart() 

    
CreateConVar("sm_conn_msg_ver"PL_VERSION"Connect Msg Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY); 

    for (new 
1<= MaxClientsi++) { 
        if (!
IsClientInGame(i) || IsFakeClient(i)) 
            continue; 
         
        
OnClientPostAdminCheck(i); 
    } 


public 
OnClientPostAdminCheck(client)  

    new 
String:sName[32], String:sIP[17], String:sGeoIP[64], String:sAuth[33]; 

    
GetClientAuthString(clientsAuthsizeof(sAuth)); 
    
GetClientIP(clientsIPsizeof(sIP)); 
    
GeoipCountry(sIPsGeoIPsizeof(sGeoIP)); 
    
GetClientName(clientsName32); 

    
CPrintToChatAll("{limie}%N {default}({purple}%s{default}) connected from {green}%s"sNamesAuthsGeoIP); 

__________________
.

Last edited by andre2843; 03-10-2015 at 18:19.
andre2843 is offline
Darkness_
Veteran Member
Join Date: Nov 2014
Old 03-10-2015 , 18:48   Re: Plugin connect message problem
Reply With Quote #2

Since sName is a String and not a client index you should use the %s formatter.

CPrintToChatAll("{limie}%s {default}({purple}%s{default}) connected from {green}%s", sName, sAuth, sGeoIP);
Darkness_ is offline
Wliu
Veteran Member
Join Date: Apr 2013
Old 03-10-2015 , 18:51   Re: Plugin connect message problem
Reply With Quote #3

A better solution would instead be to get rid of GetClientName() and use client directly.
Code:
CPrintToChatAll("{lime}%N {default}({purple}%s{default}) connected from {green}%s", client, sAuth, sGeoIP);

I'm pretty sure the reason it's not working is 1) you misspelled 'lime' and 2) there's usually no one connected when the plugin is starting. Try using OnClientConnected() instead.
__________________
~Wliu
Wliu is offline
andre2843
Member
Join Date: Apr 2011
Old 03-10-2015 , 19:32   Re: Plugin connect message problem
Reply With Quote #4

Quote:
Originally Posted by Wliu View Post
A better solution would instead be to get rid of GetClientName() and use client directly.
Code:
CPrintToChatAll("{lime}%N {default}({purple}%s{default}) connected from {green}%s", client, sAuth, sGeoIP);

I'm pretty sure the reason it's not working is 1) you misspelled 'lime' and 2) there's usually no one connected when the plugin is starting. Try using OnClientConnected() instead.
My code now and it OnClientConnected()

PHP Code:
#include <sourcemod> 
#include <geoip> 
#include <colors> 

#define PL_VERSION "1.0" 

public Plugin:myinfo =  

    
name "Connect Message"
    
author ""
    
description ""
    
version PL_VERSION
    
url "" 
}; 

public 
OnPluginStart() 

    
CreateConVar("sm_conn_msg_ver"PL_VERSION"Connect Msg Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY); 

    for (new 
1<= MaxClientsi++) { 
        if (!
IsClientInGame(i) || IsFakeClient(i)) 
            continue; 
         
        
OnClientPostAdminCheck(i); 
    } 


public 
OnClientPostAdminCheck(client)  

    new 
String:sName[32], String:sIP[17], String:sGeoIP[64], String:sAuth[33]; 

    
GetClientAuthString(clientsAuthsizeof(sAuth)); 
    
GetClientIP(clientsIPsizeof(sIP)); 
    
GeoipCountry(sIPsGeoIPsizeof(sGeoIP)); 
    
GetClientName(clientsName32); 

    
CPrintToChatAll("{lime}%N {default}({purple}%s{default}) connected from {green}%s"sNamesAuthsGeoIP); 

__________________
.
andre2843 is offline
Wliu
Veteran Member
Join Date: Apr 2013
Old 03-10-2015 , 19:41   Re: Plugin connect message problem
Reply With Quote #5

That looks identical to your previous code with the exception of lime.
__________________
~Wliu
Wliu is offline
andre2843
Member
Join Date: Apr 2011
Old 03-10-2015 , 19:49   Re: Plugin connect message problem
Reply With Quote #6

Quote:
Originally Posted by Wliu View Post
That looks identical to your previous code with the exception of lime.
You could write the code please
__________________
.
andre2843 is offline
Wliu
Veteran Member
Join Date: Apr 2013
Old 03-10-2015 , 20:44   Re: Plugin connect message problem
Reply With Quote #7

Before I or someone else decides to: Is there any reason you aren't using Connect Announce?
__________________
~Wliu
Wliu is offline
andre2843
Member
Join Date: Apr 2011
Old 03-10-2015 , 22:31   Re: Plugin connect message problem
Reply With Quote #8

I test plugin connect announce not good,I do not understand what should I change
__________________
.
andre2843 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 09:14.


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