25.04.2012, 19:57
(
Последний раз редактировалось iggy1; 01.05.2012 в 09:42.
Причина: Added geoip FS link
)
Ip Locator 1.1
What does it do?Quite simple, it adds a callback that gets called just after a player connects. The players country and city are sent to a the callback as two strings. The data is retrieved from this site http://www.hostip.info/
When a player connects a HTTP get request is sent with the players ip to the site above, when the site responds OnRetrieveIpLocation will be called. (after everything in OnPlayerConnect)
Example FS
pawn Код:
#define FILTERSCRIPT
#include <a_samp>
#include <iploc>
public OnFilterScriptInit()
{
return 1;
}
public OnRetrieveIpLocation(playerid, country[])
{
new
szStr[ 64 ];
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;
}
If anyone spots any bugs please point them out and ill try fix em.
UPDATE 1.1
- Code re-written much more efficient and should hopefully work on linux.
- Callback no longer has city argument, it was too inaccurate on all free sites i could find.
Alternative:
If this isn't what your after try slices plugin free GeoIp filterscript.
Slices plugin free GeoIp: https://sampforum.blast.hk/showthread.php?tid=190699