
   /*
   * AMX Mod script.
   * Countrynames Back v0.2
   * Author: JGHG
   * Based off St4life's Countrynames
   *
   * Versions:
   *  v0.1  -  Only change from Countrynames is that country tag is added
   behind name
   * Like this: JGHG[SE]
   * v0.2 - Really found a bug(!), if you had a really short name you got
   a runtime
   * error. Should be fixed.
   */
   #include <amxmod>
   #include <geoip>
   public client_infochanged(id) {
       if (is_user_connected(id)) {
           new newname[33]
           get_user_info(id,"name",newname,32)
           check_name(id,newname)
       }
       return PLUGIN_CONTINUE
   }
   public check_name(id,username[33]) {
       new ip[32], country[3], stra[4], strb[33], pruef[5]
       get_user_ip(id,ip,31)
       if (geoip_code2(ip,country)) {
           format(stra,4,"[%s]",country)
           // Change this to check last 4 characters instead.
           // Check them against stra.
           new len = strlen(username), bool:addcode = false
           if (len >= 4)
               copy(pruef,4,username[len - 4])
           else
               addcode = true
           if (addcode || !equal(stra,pruef)) {
               geoip_code2(ip,country)
               format(strb,32,"%s[%s]",username,country)
               set_user_info(id,"name",strb)
           }
       }
       return PLUGIN_CONTINUE
   }
   public plugin_init() {
       register_plugin("CountryNames Back","0.2","jghg")
   }
