AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with geoip and namechanging.. (https://forums.alliedmods.net/showthread.php?t=29302)

SweatyBanana 06-02-2006 19:40

Help with geoip and namechanging..
 
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 06-03-2006 11:29

Anyone want to take a look?


All times are GMT -4. The time now is 16:28.

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