Raised This Month: $ Target: $400
 0% 

Redirect by country


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
k007
BANNED
Join Date: Mar 2006
Location: bacon?
Old 06-29-2006 , 01:01   Re: Redirect by country
Reply With Quote #1

try countrywelcome by sweatybannana.
k007 is offline
Send a message via MSN to k007
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 06-30-2006 , 13:02   Re: Redirect by country
Reply With Quote #2

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 }
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
blackcat
Junior Member
Join Date: Oct 2005
Old 08-21-2006 , 00:42   Re: Redirect by country
Reply With Quote #3

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
blackcat is offline
Reply



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 07:58.


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