Raised This Month: $ Target: $400
 0% 

Help with geoip and namechanging..


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 06-02-2006 , 19:40   Help with geoip and namechanging..
Reply With Quote #1

I made this plugin with the help of a few of the amazing coders at amxmodx..

It is suposed to change a players name to include their 3 letter country when they connect to the server.


ANYWAY..I cant get it to always work correctly.


Code:
#include <amxmodx> #include <amxmisc> #include <geoip> new g_pShowAll new g_pShowMethod new g_pShowWhere public plugin_init() {     register_plugin("Country Welcome","1.8","SweatyBanana")     register_logevent("round_start", 2, "0=World triggered", "1=Round_Start");     g_pShowAll = register_cvar("amx_country_showall", "0")     g_pShowMethod = register_cvar("amx_country_method", "5")     g_pShowWhere = register_cvar("amx_country_where", "0") } public round_start(id) {     static szName[33],szIp[16],szShortCountry[4]     get_user_name(id,szName,32)     geoip_code3(szIp,szShortCountry)     fnChangeName(id,szName,szShortCountry) } public client_infochanged(id) {     static szName[33],szIp[16],szCountry[4],szCurName[33]     get_user_info(id,"name",szName,32)     get_user_name(id,szCurName,32)     if(equali(szName,szCurName))         return PLUGIN_CONTINUE     get_user_ip(id,szIp,15,true)     geoip_code3(szIp,szCountry)     fnChangeName(id,szName,szCountry)     return PLUGIN_CONTINUE } public client_putinserver(id) {     new iShowAll = get_pcvar_num(g_pShowAll),iShowMethod = get_pcvar_num(g_pShowMethod)     static szName[33],szCountry[33],szIp[16],szShortCountry[4]     get_user_ip(id,szIp,31,true)     get_user_name(id,szName,32)     geoip_country(szIp,szCountry)     geoip_code3(szIp,szShortCountry)     fnChangeName(id,szName,szShortCountry)     if(iShowAll)     {         fnShowMessages(0,iShowMethod,szName,szCountry)         return PLUGIN_CONTINUE     }     static iPlayers[32],iPlayersnum,iPlayer     get_players(iPlayers,iPlayersnum,"c")     for(new iCount = 0;iCount < iPlayersnum;iCount++)     {         iPlayer = iPlayers[iCount]         if(is_user_admin(iPlayer) && iPlayer != id)             fnShowMessages(iPlayer,iShowMethod,szName,szCountry)     }     return PLUGIN_CONTINUE } fnShowMessages(id,iShowMethod,szName[],szCountry[]) {     if(iShowMethod & 1)         client_print(id, print_console, "%s is ready to play.^n%s is from %s.",szName,szName,szCountry)     if(iShowMethod & 2)         client_print(id, print_chat, "%s is ready to play.^n%s is from %s.",szName,szName,szCountry)     if(iShowMethod & 4) // TSAY     {         set_hudmessage(id, 225, 0, 0.05, 0.45, 0, 6.0, 6.0, 0.5, 0.15, 3)         show_hudmessage(id, "%s is ready to play.^n%s is from %s.",szName,szName,szCountry)     }     if(iShowMethod & 8) // CSAY     {         set_hudmessage(id, 255, 0, -1.0, 0.3, 0, 1.0, 5.0, 0.1, 0.2, 4)         show_hudmessage(id,"%s is ready to play.^n%s is from %s.",szName,szName,szCountry)     } } fnChangeName(id,szName[],szShortCountry[])     if(containi(szName,szShortCountry)<0 && containi(szShortCountry,"err")<0)     {         copy(szName,23,szName)         remove_quotes(szName)         if(get_pcvar_num(g_pShowWhere))             client_cmd(id,"name ^"%s [%s]^"",szName,szShortCountry)         else             client_cmd(id,"name ^"[%s] %s^"",szShortCountry,szName)     }
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 06-03-2006 , 11:29  
Reply With Quote #2

Anyone want to take a look?
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
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 16:28.


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