02.05.2013, 01:01
Well like the title say, when i try to include 'GEO_IP_LITE' my pawno crashes. I was thinking that maybe it just was some wrong place bracket or so inside the include but im not so good in scripting yet so i couldnt find the problem.
I hope that one of you guys could help me with this?
Here is the code in the include
I hope that one of you guys could help me with this?
Here is the code in the include
pawn Код:
/*
_.-,=_""""--,_
.-" =/7" _ .3#"=.
,#7 " " ,//)#d#######=. GEO-IP Lite
,/ " # ,i-/###########= Version 2.0
/ _)#sm###=#=# #######\
/ (#/"_`;\//#=#\-#######\ FEATURES :
/ ,d####-_.._.)##P########\ + Gets Country of any IP Address
| .d##############b\##P' V | + SQLite Database
|\ '#################!", | + Faster Operation
|C. \###=############7 | + Uses No Plugins
'###. )#########/ '
\#( \#######| / CREDITS :
\B /#######7 / / Database (CSV) : http://db-ip.com
\ \######" /" / Script By : Abhinav Dabral
`. \###7' ,' (abhinavdabral)
"-_ `"' ,-' ALIAS : Code Wave
"-._ _.-" ******** : fb.me/codewave
""""---""""
*/
native GetPlayerLocation(playerid, Country[]);
native GetPlayerCountry(playerid);
stock GetPlayerLocation(playerid, Country[16])
{
new IPAddress[32];
new a,b,c,d,ipf;
new DB:IPDB;
new DBResult:Result;
new Q[256];
GetPlayerIp(playerid,IPAddress,sizeof(IPAddress));
new _parameters[4][8];
new Destination[8];
new SLen=strlen(IPAddress);
new at,pos=0,tp=0;
new tempo[256];
for(new i=0;i<4;i++) format(_parameters[i],sizeof(_parameters),"");
for(at=pos;at<=SLen;at++)
{
strmid(tempo,IPAddress,at,at+1,sizeof(tempo));
if(!strcmp(tempo,".",true))
{
if(tp<=10)
{
strmid(Destination,IPAddress,pos,at,sizeof(Destination));
format(_parameters[tp][0],256,"%s",Destination);
tp=tp+1;
}
pos=at+1;
}
}
a=strval(_parameters[0]);
b=strval(_parameters[1]);
c=strval(_parameters[2]);
d=strval(_parameters[3]);
if(a==127 && b==0 && c==0 && d==1)
{
format(Country,sizeof(Country),"Localhost");
return 0;
}
ipf = (16777216*a) + (65536*b) + (256*c) + d;
IPDB=db_open("IPList.db");
format(Q,sizeof(Q),"SELECT * FROM 'IPTable' WHERE start<=%d AND end>=%d",ipf,ipf);
Result=db_query(IPDB, Q);
if(db_num_rows(Result) == 1)
{
db_get_field(Result,2,Country,sizeof(Country));
}
db_free_result(Result);
db_close(IPDB);
return 1;
}
stock GetPlayerCountry(playerid)
{
new Country[16];
GetPlayerLocation(playerid,Country);
return Country;
}