Raised This Month: $ Target: $400
 0% 

CountryChat error


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
lashsh
BANNED
Join Date: Jun 2010
Location: Georgia, Tbilisi
Old 06-24-2010 , 12:38   Re: CountryChat error
Reply With Quote #3

Quote:
Originally Posted by Owner123 View Post
PHP Code:
new SzIP[33][16];
new 
szGeoIP[33][4]; 
So?
PHP Code:
#include <amxmodx>
#include <geoip>

#define VERSION    "2.4"

new SzCountryLengthSzMaxPlayersSzSayText;
new 
SzName[33][32];
new 
SzIP[33][16];
new 
szGeoIP[33][4];
new 
SzGeoIP2[4][3];
new 
SzGeoIP3[5][4];
new 
SzCountry[33][46];

new 
SzGTeam[3][] = {
    
"Spectator",
    
"Terrorist",
    
"Counter-Terrorist"
}

public 
plugin_init()
{
    
register_plugin("Country Chat"VERSION"Virtual.New.BG");
    
register_clcmd("say""hook_say");
    
register_clcmd("say_team""hook_say_team");
    
    
SzCountryLength register_cvar("country_chat_length""1");
    
    
register_cvar("country_chat_version",    VERSIONFCVAR_SERVER|FCVAR_SPONLY);
    
set_cvar_string("country_chat_version",    VERSION);
    
    
SzSayText get_user_msgid ("SayText");
    
SzMaxPlayers get_maxplayers();
    
    
register_message(SzSayText"MsgDuplicate");
}

public 
MsgDuplicate(id){ return PLUGIN_HANDLED; }

public 
hook_say(id){
    new 
Messages[192];
    new 
SzAlive is_user_alive(id);
    
    
read_args(Messages191);
    
remove_quotes(Messages);
    
get_user_name(idSzName[id], 31);
    
get_user_ip(idSzIP[id], 15);
    
geoip_country(SzIP[id], SzCountry[id]);
    
geoip_code2(SzIP[id], SzGeoIP2[id]);
    
geoip_code3(SzIP[id], SzGeoIP3[id]);    
    
    if(!
is_valid_msg(Messages))
        return 
PLUGIN_CONTINUE;

    switch(
get_pcvar_num(SzCountryLength)){
        case 
1: { (SzAlive format(Messages191"^4[%s] ^3%s : ^1%s"SzCountry[id], SzName[id], Messages) : format(Messages191"^1*DEAD* ^4[%s] ^3%s : ^1%s"SzCountry[id], SzName[id], Messages)); }
        case 
2: { (SzAlive format(Messages191"^4[%s] ^3%s : ^1%s"SzGeoIP2[id], SzName[id], Messages) : format(Messages191"^1*DEAD* ^4[%s] ^3%s : ^1%s"SzGeoIP2[id], SzName[id], Messages)); }
        case 
3: { (SzAlive format(Messages191"^4[%s] ^3%s : ^1%s"SzGeoIP3[id], SzName[id], Messages) : format(Messages191"^1*DEAD* ^4[%s] ^3%s : ^1%s"SzGeoIP3[id], SzName[id], Messages)); }}
    
    for(new 
1<= SzMaxPlayersi++){
        if(!
is_user_connected(i))
            continue;
        if(
SzAlive && is_user_alive(i) || !SzAlive && !is_user_alive(i)){
            
message_begin(MSG_ONESzSayText, {000}, i);
            
write_byte(id);
            
write_string(Messages);
            
message_end();} }
    return 
PLUGIN_CONTINUE;
}

public 
hook_say_team(id){
    new 
Messages[192];
    new 
SzPlayerTeam get_user_team(id);
    new 
SzAlive is_user_alive(id);
    
    
read_args(Messages191);
    
remove_quotes(Messages);
    
get_user_name(idSzName[id], 31);
    
get_user_ip(idSzIP[id], 15)
    
geoip_country(SzIP[id], SzCountry[id]);
    
geoip_code2(SzIP[id], SzGeoIP2[id]);
    
geoip_code3(SzIP[id], SzGeoIP3[id]);
    
    if(!
is_valid_msg(Messages))
        return 
PLUGIN_CONTINUE;
    
    switch(
get_pcvar_num(SzCountryLength)){
        case 
1: { (SzAlive format(Messages191"^1(%s) ^4[%s] ^3%s : ^1%s"SzGTeam[SzPlayerTeam], SzCountry[id], SzName[id], Messages) : format(Messages191"^1*DEAD* (%s) ^4[%s] ^3%s : ^1%s"SzGTeam[SzPlayerTeam], SzCountry[id], SzName[id], Messages)); }
        case 
2: { (SzAlive format(Messages191"^1(%s) ^4[%s] ^3%s : ^1%s"SzGTeam[SzPlayerTeam], SzGeoIP2[id], SzName[id], Messages) : format(Messages191"^1*DEAD* (%s) ^4[%s] ^3%s : ^1%s"SzGTeam[SzPlayerTeam], SzGeoIP2[id], SzName[id], Messages)); } 
        case 
3: { (SzAlive format(Messages191"^1(%s) ^4[%s] ^3%s : ^1%s"SzGTeam[SzPlayerTeam], SzGeoIP3[id], SzName[id], Messages) : format(Messages191"^1*DEAD* (%s) ^4[%s] ^3%s : ^1%s"SzGTeam[SzPlayerTeam], SzGeoIP3[id], SzName[id], Messages)); } }
    
    for(new 
1<= SzMaxPlayersi++){
        if(!
is_user_connected(i))
            continue;
        if(
get_user_team(i) != SzPlayerTeam)
            continue;
        if(
SzAlive && is_user_alive(i) || !SzAlive && !is_user_alive(i)){
            
message_begin(MSG_ONESzSayText, {000}, i);
            
write_byte(id);
            
write_string(Messages);
            
message_end();} }
    return 
PLUGIN_CONTINUE;
}

bool:is_valid_msg(const Messages[]){
    if( 
Messages[0] == '@'
    
|| !strlen(Messages)){ return false; }
    return 
true;} 
If so

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

#define VERSION    "2.4" 

new SzCountryLengthSzMaxPlayersSzSayText
new 
SzName[33][32]; 
new 
SzGeoIP2[4][3]; 
new 
SzGeoIP3[5][4]; 
new 
SzCountry[33][46]; 

new 
SzGTeam[3][] = { 
    
"Spectator"
    
"Terrorist"
    
"Counter-Terrorist" 


public 
plugin_init() 

    
register_plugin("Country Chat"VERSION"Virtual.New.BG"); 
    
register_clcmd("say""hook_say"); 
    
register_clcmd("say_team""hook_say_team"); 
     
    
SzCountryLength register_cvar("country_chat_length""1"); 
     
    
register_cvar("country_chat_version",    VERSIONFCVAR_SERVER|FCVAR_SPONLY); 
    
set_cvar_string("country_chat_version",    VERSION); 
     
    
SzSayText get_user_msgid ("SayText"); 
    
SzMaxPlayers get_maxplayers(); 
     
    
register_message(SzSayText"MsgDuplicate"); 


public 
MsgDuplicate(id){ return PLUGIN_HANDLED; } 

public 
hook_say(id){ 
    new 
Messages[192]; 
    new 
SzAlive is_user_alive(id); 
     
    
read_args(Messages191); 
    
remove_quotes(Messages); 
    
get_user_name(idSzName[id], 31); 
    
get_user_ip(idSzIP[id], 15); 
    
geoip_country(SzIP[id], SzCountry[id]); 
    
geoip_code2(SzIP[id], SzGeoIP2[id]); 
    
geoip_code3(SzIP[id], SzGeoIP3[id]);     
     
    if(!
is_valid_msg(Messages)) 
        return 
PLUGIN_CONTINUE

    switch(
get_pcvar_num(SzCountryLength)){ 
        case 
1: { (SzAlive format(Messages191"^4[%s] ^3%s : ^1%s"SzCountry[id], SzName[id], Messages) : format(Messages191"^1*DEAD* ^4[%s] ^3%s : ^1%s"SzCountry[id], SzName[id], Messages)); } 
        case 
2: { (SzAlive format(Messages191"^4[%s] ^3%s : ^1%s"SzGeoIP2[id], SzName[id], Messages) : format(Messages191"^1*DEAD* ^4[%s] ^3%s : ^1%s"SzGeoIP2[id], SzName[id], Messages)); } 
        case 
3: { (SzAlive format(Messages191"^4[%s] ^3%s : ^1%s"SzGeoIP3[id], SzName[id], Messages) : format(Messages191"^1*DEAD* ^4[%s] ^3%s : ^1%s"SzGeoIP3[id], SzName[id], Messages)); }} 
     
    for(new 
1<= SzMaxPlayersi++){ 
        if(!
is_user_connected(i)) 
            continue; 
        if(
SzAlive && is_user_alive(i) || !SzAlive && !is_user_alive(i)){ 
            
message_begin(MSG_ONESzSayText, {000}, i); 
            
write_byte(id); 
            
write_string(Messages); 
            
message_end();} } 
    return 
PLUGIN_CONTINUE


public 
hook_say_team(id){ 
    new 
Messages[192]; 
    new 
SzPlayerTeam get_user_team(id); 
    new 
SzAlive is_user_alive(id); 
     
    
read_args(Messages191); 
    
remove_quotes(Messages); 
    
get_user_name(idSzName[id], 31); 
    
get_user_ip(idSzIP[id], 15
    
geoip_country(SzIP[id], SzCountry[id]); 
    
geoip_code2(SzIP[id], SzGeoIP2[id]); 
    
geoip_code3(SzIP[id], SzGeoIP3[id]); 
     
    if(!
is_valid_msg(Messages)) 
        return 
PLUGIN_CONTINUE
     
    switch(
get_pcvar_num(SzCountryLength)){ 
        case 
1: { (SzAlive format(Messages191"^1(%s) ^4[%s] ^3%s : ^1%s"SzGTeam[SzPlayerTeam], SzCountry[id], SzName[id], Messages) : format(Messages191"^1*DEAD* (%s) ^4[%s] ^3%s : ^1%s"SzGTeam[SzPlayerTeam], SzCountry[id], SzName[id], Messages)); } 
        case 
2: { (SzAlive format(Messages191"^1(%s) ^4[%s] ^3%s : ^1%s"SzGTeam[SzPlayerTeam], SzGeoIP2[id], SzName[id], Messages) : format(Messages191"^1*DEAD* (%s) ^4[%s] ^3%s : ^1%s"SzGTeam[SzPlayerTeam], SzGeoIP2[id], SzName[id], Messages)); }  
        case 
3: { (SzAlive format(Messages191"^1(%s) ^4[%s] ^3%s : ^1%s"SzGTeam[SzPlayerTeam], SzGeoIP3[id], SzName[id], Messages) : format(Messages191"^1*DEAD* (%s) ^4[%s] ^3%s : ^1%s"SzGTeam[SzPlayerTeam], SzGeoIP3[id], SzName[id], Messages)); } } 
     
    for(new 
1<= SzMaxPlayersi++){ 
        if(!
is_user_connected(i)) 
            continue; 
        if(
get_user_team(i) != SzPlayerTeam
            continue; 
        if(
SzAlive && is_user_alive(i) || !SzAlive && !is_user_alive(i)){ 
            
message_begin(MSG_ONESzSayText, {000}, i); 
            
write_byte(id); 
            
write_string(Messages); 
            
message_end();} } 
    return 
PLUGIN_CONTINUE


bool:is_valid_msg(const Messages[]){ 
    if( 
Messages[0] == '@' 
    
|| !strlen(Messages)){ return false; } 
    return 
true;} 

Last edited by lashsh; 06-24-2010 at 12:43.
lashsh is offline
Send a message via Skype™ to lashsh
 



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 14:50.


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