Include makes pawno crash
#1

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
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;
}
Reply
#2

Код:
+ Uses No Plugins
pawn Код:
native GetPlayerLocation(playerid, Country[]);
native GetPlayerCountry(playerid);
Why?
Reply
#3

huh?
Reply
#4

First of all "native"s are used to access functions inside plugins, and they aren't meant to redeclare stocks at all.
By the way I wouldn't use static array sizes for stocks anyway.

Код:
+ Faster Operation
I want to see speed results!
This have to be prooven by the include writer itself, and I assume that he/she didnt even test his/her own include.
Reply
#5

So that means you can help me?
Reply
#6

bump
Reply
#7

You can request for scripts here: https://sampforum.blast.hk/showthread.php?tid=413556
Reply
#8

I dont want to request a script, i want to get help to fix this include
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)