AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Redirect by country (https://forums.alliedmods.net/showthread.php?t=40544)

blackcat 06-29-2006 00:54

Redirect by country
 
I had an idea to make my server redirect people that are not from our country when the server is full, and a new player connects. Anyone who has ever done any redirecting by ip/domain and has an idea where to start?

k007 06-29-2006 01:01

Re: Redirect by country
 
try countrywelcome by sweatybannana.

Hawk552 06-30-2006 13:02

Re: Redirect by country
 
Try this:

Cvars:
amx_redirect_country - your country in 3 letters. Mine, for example, is CAN for Canada.
amx_redirect_ip - server to redirect to. Give IP and port.

Code:
#include <amxmodx> #include <amxmisc> #include <geoip> new g_pRedirect new g_pRedirectIP new g_iMaxPlayers public plugin_init() {     register_plugin("Redirect by Country","1.0","Hawk552")         g_pRedirect = register_cvar("amx_redirect_country","CAN")     g_pRedirectIP = register_cvar("amx_redirect_ip","123.456.789.0")         g_iMaxPlayers = get_maxplayers() }     public client_authorized(id) {     if(g_iMaxPlayers - get_playersnum() > 1)         return PLUGIN_CONTINUE         static szIP[18],szCountry[4],szCvar[4],szRedirectIP[24]         get_user_ip(id,szIP,17,true)     geoip_code3(szIP,szCountry)     get_pcvar_string(g_pRedirect,szCvar,3)         if(!equali(szCountry,szCvar))     {         get_pcvar_string(g_pRedirectIP,szRedirectIP,23)         client_cmd(id,"connect %s",szRedirectIP)     }         return PLUGIN_CONTINUE }

blackcat 08-21-2006 00:42

Re: Redirect by country
 
Thanks a lot. Will try this, and maybe also try to combine it with a reserved slot system, so that it only redirects if the rest of the users on the server is from the "allowed" country :)


All times are GMT -4. The time now is 07:58.

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