AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Country Kicker Exception (https://forums.alliedmods.net/showthread.php?t=82954)

noisydude 01-01-2009 19:25

Country Kicker Exception
 
Hi, i was wondering if you can help me with my little big problem :)
I am using EKS's country kicker ( http://forums.alliedmods.net/showthread.php?t=11412 ), it works great but i would want to add some exceptions from the rule. It's setted for romanians only, but I have friends on other countrys who would like to enter too. I don't want to let the whole country to enter my server, just that specific person's IP or IP range. Is this possible?
I would be very greatfull if you can help me :)

P.S. I need it for Counter-Strike 1.6 if this thing matters.

Spunky 01-01-2009 20:37

Re: Country Kicker Exception
 
It's called an if statement.

PHP Code:

new szID[20]
get_user_authid(idszID19)

if (!
equal(szID"STEAM_0:x:xxxxxxx"))
    
server_cmd("kick #%d"id


noisydude 01-02-2009 06:20

Re: Country Kicker Exception
 
Can you make it by IP, not by STEAMID please? :D

Spunky 01-02-2009 06:27

Re: Country Kicker Exception
 
You can't figure that out? -_-

PHP Code:

new szIP[20]
get_user_ip(idszIP191)

if (!
equal(szIP"Enter IP here"))
    
server_cmd("kick #%d"id

If you want multiple exceptions, you could do something like this...

PHP Code:

new szIP[20]
get_user_ip(idszIP191)

if (!
equal(szIP"Enter first IP") && !equal(szIP"Enter second IP") && !equal(szIP"Enter third IP"))
    
server_cmd("kick #%d"id

Pretty much without limit.

Bad_Bud 01-02-2009 07:05

Re: Country Kicker Exception
 
You sure you want to do that? Unless you're trying to play WON or something, your solution may only be temporary. IP addresses can change, but Steam ID's will not.

Spunky 01-02-2009 07:20

Re: Country Kicker Exception
 
He's just modifying a plugin, and I don't think he's very experienced. So this is probably best for him at the moment.

Bad_Bud 01-02-2009 20:15

Re: Country Kicker Exception
 
I force my suggestion upon ye!

PHP Code:

public client_connect(id)
{
 new 
usersteamid[37]
 
get_user_authid(id,usersteamid,36)
 
 if(!
equal("Your friend's steam ID here",usersteamid)&&!equal("Your second friend's steam ID here",usersteamid))
 {
  new 
userip[32]
  new 
CC[4]
  
get_user_ip(id,userip,31,1)
 
  
geoip_code3(userip,CC)
  if(
strlen(userip) == 0)
  {
   
get_user_ip(id,userip,31,1)  
   if(!
IsLocalIp(userip))
    
log_amx("%s made a error when passed though geoip",userip)
   return 
PLUGIN_HANDLED
  
}
 
  if(
g_Mode == && !IsConInArray(CC))
  {
   
server_cmd("kick #%d Only ppl from %s are allowed",get_user_userid(id),CountyList)
 
   new 
Name[32]
   
get_user_name(id,Name,31)
   
client_print(0,print_chat,"%s was kicked because he is not from %s",Name,CountyList)
  }
  else if(
g_Mode == && IsConInArray(CC))
  {
   
server_cmd("kick #%d No %s are allowed on this server",get_user_userid(id),CC)
 
   new 
Name[32]
   
get_user_name(id,Name,31)
   
client_print(0,print_chat,"%s was kicked because he is from %s",Name,CC)
  }
 }
 
 return 
PLUGIN_HANDLED


Replace this function with the code above, and add in the steamid's of your friends within the quotes.


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

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