SA-MP Forums Archive
Help with COuntry Checker (rep +) - 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)
+--- Thread: Help with COuntry Checker (rep +) (/showthread.php?tid=381472)



Help with COuntry Checker (rep +) - Geeboi_Mehdi - 29.09.2012

I got this Filterscript and This what i get when i connect:
'


Re: Help with COuntry Checker (rep +) - [HK]Ryder[AN] - 29.09.2012

show the code.


Re: Help with COuntry Checker (rep +) - Geeboi_Mehdi - 29.09.2012

pawn Код:
#define FILTERSCRIPT

#include <a_samp>
#include <iploc>

public OnFilterScriptInit()
{
    return 1;
}

public OnRetrieveIpLocation(playerid, country[])
{

    new
        szStr[ 145 ];

    GetPlayerName( playerid, szStr, MAX_PLAYER_NAME );

    format( szStr, sizeof( szStr ), "<SERVER> Welcome %s to the server. From %s", szStr, country );

    SendClientMessageToAll( -1, szStr );

}

public OnPlayerConnect( playerid )
{
    return 1;
}



Re: Help with COuntry Checker (rep +) - [HK]Ryder[AN] - 29.09.2012

Not this...
search your code for Private Address and post the code around it.
If it isn't there post the include's code


Re: Help with COuntry Checker (rep +) - Geeboi_Mehdi - 29.09.2012

Ok here is the Hole Include Notepad
pawn Код:
#if !defined _samp_included
    #tryinclude <a_samp>

    #if !defined _samp_included
        #error "Can't find file "a_samp". Are your includes in the correct directory?"
    #endif
#endif


#if !defined HTTP
    #tryinclude <a_http>

    #if !defined HTTP
        #error "Can't find file "a_http". Are your includes in the correct directory?"
    #endif
#endif

#define MAX_COUNTRY_NAME                    (64)
#define MAX_CITY_NAME                       (64)

#define HTTP_REQUEST_IP                     ("api.hostip.info/get_html.php?ip=")

new g_HasORIL;

forward hostip_Response(playerid, response_code, data[]);
forward OnRetrieveIpLocation(playerid, country[]);

public hostip_Response(playerid, response_code, data[])
{

    if( g_HasORIL != -1 )
    {
        if( response_code == 200 )
        {
            new szCountryBuff[ MAX_COUNTRY_NAME ];
           
            if( data[0] != '(' )
            {
                new
                    _itr=9,
                    _citr
                ;

                while( data[ _itr ] != EOS )
                {
                    if( _itr == MAX_COUNTRY_NAME -1)
                    {

                        szCountryBuff[ _itr ] = EOS;
                        break;

                    }

                    if( data[ _itr ] == '\n')
                    {
                        szCountryBuff[ _itr ] = EOS;
                        break;
                    }

                    szCountryBuff[ _citr++ ] = data[ _itr++ ];

                }
            }
            else
            {

                strcat( szCountryBuff, "private country" );

            }

            CallLocalFunction( "OnRetrieveIpLocation", "ds", playerid, szCountryBuff );

        }
        else printf("<IPLocator Error> HTTP response code: %d", response_code );

    }
    else printf("<IPLocator Error> iploc included but the function OnRetrieveIpLocation was not found.");
}




////////////////////////////////////////////////////////////////////////////////
// CALLBACK HOOKS //////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
#if defined FILTERSCRIPT

    public OnFilterScriptInit()
    {
        print("\n--------------------------------------");
        print(" Iggys Ip Locator Loaded.");
        print("--------------------------------------\n");

        g_HasORIL = funcidx("OnRetrieveIpLocation");

        if(funcidx("iploc_OnFilterScriptInit") != -1)
        {
            return CallLocalFunction("iploc_OnFilterScriptInit", "");
        }

        return 1;
    }

    #if defined _ALS_OnFilterScriptInit
        #undef OnFilterScriptInit
    #else
        #define _ALS_OnFilterScriptInit
    #endif
    #define OnFilterScriptInit iploc_OnFilterScriptInit

    forward iploc_OnFilterScriptInit();

#else

    public OnGameModeInit()
    {
        print("\n--------------------------------------");
        print(" Iggys Ip Locator Loaded.");
        print("--------------------------------------\n");

        g_HasORIL = funcidx("OnRetrieveIpLocation");

        if (funcidx("iploc_OnGameModeInit") != -1)
        {
            return CallLocalFunction("iploc_OnGameModeInit", "");
        }
        return 1;
    }

    #if defined _ALS_OnGameModeInit
        #undef OnGameModeInit
    #else
        #define _ALS_OnGameModeInit
    #endif
    #define OnGameModeInit iploc_OnGameModeInit
    forward iploc_OnGameModeInit();

#endif

public OnPlayerConnect(playerid)
{
    if( g_HasORIL != -1 )
    {

        new
            _szIP[ 16 ],
            _szTmpStr[ 128 ];

        GetPlayerIp( playerid, _szIP, 16 );

        strcat( _szTmpStr, HTTP_REQUEST_IP );
        strcat( _szTmpStr, _szIP );

        HTTP( playerid, HTTP_GET, _szTmpStr, "", "hostip_Response");//request location of ip and send it to hostip_Response
    }

    if(funcidx("iploc_OnPlayerConnect") != -1)
    {
        return CallLocalFunction("iploc_OnPlayerConnect", "i", playerid) != -1;
    }
    return 1;

}

#if defined _ALS_OnPlayerConnect
    #undef OnPlayerConnect
#else
    #define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect iploc_OnPlayerConnect

forward iploc_OnPlayerConnect(playerid);

////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////



Re: Help with COuntry Checker (rep +) - [HK]Ryder[AN] - 29.09.2012

search ur gamemode for Private Address


Re: Help with COuntry Checker (rep +) - Geeboi_Mehdi - 29.09.2012

Hey Look At the Post weer i got it from maybe that could help
https://sampforum.blast.hk/showthread.php?tid=337304


Re: Help with COuntry Checker (rep +) - Niko_boy - 29.09.2012

it show private adreess because you are on a local ip i.e. if you upload this to some host then connect it will definitly show your country ,

since the ip of server is 192.168.1.... shows you connecting on your local host thats why it show private address


Re: Help with COuntry Checker (rep +) - Glint - 29.09.2012

Seriously didn't anybody notice this i mean most of you AS scripters should of noticed it but only Niko_boy did.

Here eat a cookie Niko :P


Re: Help with COuntry Checker (rep +) - M3mPHi$_S3 - 29.09.2012

Quote:
Originally Posted by [Lexi]
Посмотреть сообщение
Seriously didn't anybody notice this i mean most of you AS scripters should of noticed it but only Niko_boy did.

Here eat a cookie Niko :P
Yea nice niko and of course with your local ip addres it will show as " Private "