Banning country - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Banning country (
/showthread.php?tid=254718)
Banning country -
Face9000 - 12.05.2011
Hi all,i get a name of a country that i need to ban.
I use GeoIP and i need to ban a specific country.
How to do this?
I want do:
When a player connects,it check if their country is banned and he got kicked.How?
I've
pawn Код:
GetCountryName(const ipaddress[], country[], size = sizeof country);
But,how to use it?Thanks.
Re: Banning country -
Seven_of_Nine - 12.05.2011
pawn Код:
new ip[30],country[30];
GetPlayerIp(playerid,ip,sizeof(ip));
GetCountryName(ip,country,sizeof(country));
if(country == "WTFAMERICAFUCKYEAH")
return Kick(playerid);
Re: Banning country -
Face9000 - 12.05.2011
error 033: array must be indexed (variable "country")
lol.
Re: Banning country -
Vince - 12.05.2011
Quote:
Originally Posted by Seven_of_Nine
pawn Код:
if(country == "WTFAMERICAFUCKYEAH")
|

If you want to give an answer, you should at least get your code right.
pawn Код:
new const stock
bannedCountries[][] = {
"name1",
"name2"
};
// OnPlayerConnect
GetCountryName(ip,country,sizeof(country));
for(new c; c < sizeof(bannedCountries); c++)
{
if(!strcmp(bannedCountries[c], country))
return Kick(playerid);
}
Untsted, but should work.
Re: Banning country -
Face9000 - 12.05.2011
LoL thanks a lot

This one works <33333333.