Banning country
#1

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.
Reply
#2

pawn Код:
new ip[30],country[30];
    GetPlayerIp(playerid,ip,sizeof(ip));
    GetCountryName(ip,country,sizeof(country));
    if(country == "WTFAMERICAFUCKYEAH")
        return Kick(playerid);
Reply
#3

error 033: array must be indexed (variable "country")

lol.
Reply
#4

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.
Reply
#5

LoL thanks a lot This one works <33333333.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)