insert includes

This commit is contained in:
Lorenc 2017-01-02 13:24:53 +11:00
parent 80d5cad9b2
commit d4264227ff
5 changed files with 21417 additions and 1 deletions

252
pawno/include/a_ig.inc Normal file
View File

@ -0,0 +1,252 @@
/*
*
* Irresistible Gaming
*
* Founded by Lorenc
*
* * Settings to be used with Irresistible Gaming SA-MP Servers
*
*
*/
/* ** MySQL Config ** */
#if !defined DEBUG_MODE
#define MYSQL_HOST "127.0.0.1"
#define MYSQL_USER "service"
#define MYSQL_PASS "M8aHnYxJEFmw6ubK" // "82JA8LDL1JAG2GF69"
#define MYSQL_DB "sa-mp"
#else
#define MYSQL_HOST "127.0.0.1"
#define MYSQL_USER "root"
#define MYSQL_PASS ""
#define MYSQL_DB "sa-mp"
#endif
//mysqldump -u service -p82JA8LDL1JAG2GF69 sa-mp > ~/dump01.sql
/* ** Defines ** */
#define IRC_SERVER "foco.ca.irc.tl" // test "maple.nl.eu.gtanet.com"
#define GetPlayerFPS(%1) p_FPS[%1]
// Client messages
#define SendUsage(%0,%1)\
(SendClientMessageFormatted(%0,-1,"{FFAF00}[USAGE]{FFFFFF} " # %1))
#define SendError(%0,%1)\
(SendClientMessageFormatted(%0,-1,"{F81414}[ERROR]{FFFFFF} " # %1))
#define SendServerMessage(%0,%1)\
(SendClientMessageFormatted(%0,-1,"{C0C0C0}[SERVER]{FFFFFF} " # %1))
/* ** RADIO SYSTEM ** */
enum E_RADIO_DATA
{
E_NAME [ 20 ],
E_URL [ 60 ]
};
new
g_RadioData[ ] [ E_RADIO_DATA ] =
{
{ "Country", "http://yp.shoutcast.com/sbin/tunein-station.pls?id=446371" },
{ "Drum n' Bass", "http://yp.shoutcast.com/sbin/tunein-station.pls?id=114517" },
{ "Electronic", "http://yp.shoutcast.com/sbin/tunein-station.pls?id=201767" },
{ "Metal", "http://yp.shoutcast.com/sbin/tunein-station.pls?id=558051" },
{ "Hip Hop", "http://yp.shoutcast.com/sbin/tunein-station.pls?id=366480" },
{ "Pop", "http://yp.shoutcast.com/sbin/tunein-station.pls?id=8318" },
{ "Reggae", "http://yp.shoutcast.com/sbin/tunein-station.pls?id=580756" },
{ "Rock", "http://yp.shoutcast.com/sbin/tunein-station.pls?id=37586" },
{ "Trance", "http://yp.shoutcast.com/sbin/tunein-station.pls?id=83468" },
{ "Techno", "http://yp.shoutcast.com/sbin/tunein-station.pls?id=702264" },
{ "House", "http://yp.shoutcast.com/sbin/tunein-station.pls?id=99194448" },
{ "SKY.FM Hits", "http://yp.shoutcast.com/sbin/tunein-station.pls?id=595424" },
{ "Party 181.FM", "http://yp.shoutcast.com/sbin/tunein-station.pls?id=508962" },
{ "Top 40 181.FM", "http://yp.shoutcast.com/sbin/tunein-station.pls?id=872" },
{ ".977 Hits", "http://7609.live.streamtheworld.com:80/977_HITS_SC" }
},
g_RadioStations [ 190 ]
;
/* ** Donation ** */
#define szRedemptionSalt "7resta#ecacakumedeM=yespawr!d@et"
enum E_DONATION_DATA
{
E_TRANSACTION_ID[ 64 ],
E_EMAIL[ 256 ],
E_AMOUNT[ 11 ],
E_PURPOSE[ 64 ],
E_DATE
}
new stock
Float: a_vipCoinRequirements[ ] = { 0.0, 500.0, 1200.0, 1800.0, 2500.0, 5000.0, 10000.0 }
;
/* ** Variables ** */
new
// Textdraws
Text: g_AdminOnDutyTD = Text: INVALID_TEXT_DRAW,
Text: p_FPSCounterTD [ MAX_PLAYERS ] = { Text: INVALID_TEXT_DRAW, ... },
// Player
p_RconLoginFails [ MAX_PLAYERS char ],
bool: p_FPSCounter [ MAX_PLAYERS char ],
p_FPS_DrunkLevel [ MAX_PLAYERS ],
p_FPS [ MAX_PLAYERS ]
;
/* ** Callbacks ** */
public OnRconLoginAttempt(ip[], password[], success)
{
new
playerid = INVALID_PLAYER_ID,
szIP[ 16 ]
;
foreach(new i : Player)
{
if( GetPlayerIp( i, szIP, sizeof( szIP ) ) )
{
if( !strcmp( szIP, ip, true ) )
{
playerid = i;
break;
}
}
}
if( !success )
{
if( IsPlayerConnected( playerid ) )
{
p_RconLoginFails{ playerid } ++;
SendClientMessageFormatted( playerid, -1, "{FF0000}[ERROR]{FFFFFF} You have entered an invalid rcon password. {C0C0C0}[%d/2]", p_RconLoginFails{ playerid } );
if( p_RconLoginFails{ playerid } >= 2 ) {
SendServerMessage( playerid, "If you are not the server operator or manager, don't bother trying!" );
Kick( playerid );
}
}
}
else
{
if( IsPlayerConnected( playerid ) )
{
new
name[ 24 ];
GetPlayerName( playerid, name, sizeof( name ) );
if( strcmp( name, "Lorenc", true ) )
{
#if defined CNR_SERVER
BanPlayerISP( playerid );
#else
RangeBanPlayer( playerid );
#endif
return 0;
}
}
}
return 1;
}
#if defined DEBUG_MODE
public OnIncomingConnection( playerid, ip_address[ ], port ) {
SendRconCommand( "reloadbans" );
}
#endif
/* ** Commands ** */
CMD:fps( playerid, params[ ] )
{
if( ( p_FPSCounter{ playerid } = !p_FPSCounter{ playerid } ) == true )
{
formatFPSCounter( playerid );
TextDrawShowForPlayer( playerid, p_FPSCounterTD[ playerid ] );
SendClientMessage( playerid, 0x84aa63ff, "-> FPS counter enabled" );
}
else
{
TextDrawHideForPlayer( playerid, p_FPSCounterTD[ playerid ] );
SendClientMessage( playerid, 0x84aa63ff, "-> FPS counter disabled" );
}
return 1;
}
/* ** Functions ** */
new const
g_igServerNames[ 2 ] [ 28 ] = { "San Fierro Cops And Robbers", "Call Of Duty For SA-MP" };
#define GetServerName(%0) g_igServerNames[%0]
stock InitializeIGTextdraws( )
{
g_AdminOnDutyTD = TextDrawCreate(552.000000, 66.500000, "ADMIN ON DUTY");
TextDrawBackgroundColor(g_AdminOnDutyTD, 255);
TextDrawFont(g_AdminOnDutyTD, 1);
TextDrawLetterSize(g_AdminOnDutyTD, 0.180000, 0.899999);
TextDrawColor(g_AdminOnDutyTD, -65281);
TextDrawSetOutline(g_AdminOnDutyTD, 1);
TextDrawSetProportional(g_AdminOnDutyTD, 1);
for(new playerid; playerid != MAX_PLAYERS; playerid ++)
{
p_FPSCounterTD[ playerid ] = TextDrawCreate(636.000000, 2.000000, "_");
TextDrawAlignment(p_FPSCounterTD[ playerid ], 3);
TextDrawBackgroundColor(p_FPSCounterTD[ playerid ], 255);
TextDrawFont(p_FPSCounterTD[ playerid ], 3);
TextDrawLetterSize(p_FPSCounterTD[ playerid ], 0.300000, 1.500000);
TextDrawColor(p_FPSCounterTD[ playerid ], -1);
TextDrawSetOutline(p_FPSCounterTD[ playerid ], 1);
TextDrawSetProportional(p_FPSCounterTD[ playerid ], 1);
}
}
stock formatFPSCounter( playerid ) {
if( !p_FPSCounter{ playerid } )
return;
static
iFPS,
szColor[ 10 ],
szFPS[ sizeof( szColor ) + 4 ]
;
switch( ( iFPS = p_FPS[ playerid ] ) ) {
case 32 .. 120: szColor = "~g~~h~~h~";
case 18 .. 31: szColor = "~y~~h~";
case 0 .. 17: szColor = "~r~~h~~h~";
default: szColor = "~g~~h~~h~";
}
format( szFPS, sizeof( szFPS ), "%s%d", szColor, iFPS );
TextDrawSetString( p_FPSCounterTD[ playerid ], szFPS );
}
stock trimString( strSrc[ ] )
{
new
strPos
;
for( strPos = strlen( strSrc ); strSrc[ strPos ] <= ' '; )
strPos--;
strSrc[ strPos + 1 ] = EOS;
for( strPos = 0; strSrc[ strPos ] <= ' '; )
strPos++;
strdel( strSrc, 0, strPos );
}
stock Float: GetDistanceBetweenPlayers( iPlayer1, iPlayer2, &Float: fDistance = Float: 0x7F800000 )
{
static
Float: fX, Float: fY, Float: fZ;
if( GetPlayerVirtualWorld( iPlayer1 ) == GetPlayerVirtualWorld( iPlayer2 ) && GetPlayerPos( iPlayer2, fX, fY, fZ ) && !IsPlayerNPC( iPlayer1 ) && !IsPlayerNPC( iPlayer2 ) )
fDistance = GetPlayerDistanceFromPoint( iPlayer1, fX, fY, fZ );
return fDistance;
}

View File

@ -491,7 +491,6 @@
vAutoCbugKeyState ( playerid, newkeys, oldkeys );
}
#if defined SAMPAC_OnPlayerKeyStateChange
return SAMPAC_OnPlayerKeyStateChange(playerid, newkeys, oldkeys);
#else

View File

@ -0,0 +1,379 @@
/*
attachments.inc
- This include fixes the attachments bug, which is expierenced while zooming with snipers, camera, RPGs..
- The attached object info now can be retrieved from GetPlayerAttachedObject
- This include also restores player attachments on Spawn, so they will remain!
- Disconnect fix; Destroys the attachments on Disconnect.
Author:
- Gammix
(c) Copyright 2015
- This file is provided as is (no warranties).
*/
/*
native SetPlayerAttachedObject(playerid, index, modelid, bone, Float:fOffsetX = 0.0, Float:fOffsetY = 0.0, Float:fOffsetZ = 0.0, Float:fRotX = 0.0, Float:fRotY = 0.0, Float:fRotZ = 0.0, Float:fScaleX = 1.0, Float:fScaleY = 1.0, Float:fScaleZ = 1.0, materialcolor1 = 0, materialcolor2 = 0);
native GetPlayerAttachedObject(playerid, index, &modelid, &bone, &Float:fOffsetX, &Float:fOffsetY, &Float:fOffsetZ, &Float:fRotX, &Float:fRotY, &Float:fRotZ, &Float:fScaleX, &Float:fScaleY, &Float:fScaleZ, &materialcolor1, &materialcolor2);
native RemovePlayerAttachedObject(playerid, index);
*/
#define att_modelid (0)
#define att_bone (1)
#define att_offset_x (2)
#define att_offset_y (3)
#define att_offset_z (4)
#define att_rot_x (5)
#define att_rot_y (6)
#define att_rot_z (7)
#define att_scale_x (8)
#define att_scale_y (9)
#define att_scale_z (10)
#define att_color_1 (11)
#define att_color_2 (12)
#define att_used (13)
new
g_AttachmentData[][45] =
{
"att_modelid",
"att_bone",
"att_offset_x",
"att_offset_y",
"att_offset_z",
"att_rot_x",
"att_rot_y",
"att_rot_z",
"att_scale_x",
"att_scale_y",
"att_scale_z",
"att_color_1",
"att_color_2",
"att_used"
};
stock static ATT_SetInt(playerid, index, type, val)
{
new
s_String[45]
;
format(s_String, sizeof(s_String), "%i_%s", index, g_AttachmentData[type]);
return SetPVarInt(playerid, s_String, val);
}
stock static ATT_GetInt(playerid, index, type)
{
new
s_String[45]
;
format(s_String, sizeof(s_String), "%i_%s", index, g_AttachmentData[type]);
return GetPVarInt(playerid, s_String);
}
stock static ATT_SetFloat(playerid, index, type, Float:val)
{
new
s_String[45]
;
format(s_String, sizeof(s_String), "%i_%s", index, g_AttachmentData[type]);
return SetPVarFloat(playerid, s_String, val);
}
stock static Float:ATT_GetFloat(playerid, index, type)
{
new
s_String[45]
;
format(s_String, sizeof(s_String), "%i_%s", index, g_AttachmentData[type]);
return GetPVarFloat(playerid, s_String);
}
public OnPlayerSpawn(playerid)
{
for(new i; i < MAX_PLAYER_ATTACHED_OBJECTS; i++)
{
if(ATT_GetInt(playerid, i, att_used))
{
SetPlayerAttachedObject( playerid,
i,
ATT_GetInt(playerid, i, att_modelid),
ATT_GetInt(playerid, i, att_bone),
ATT_GetFloat(playerid, i, att_offset_x),
ATT_GetFloat(playerid, i, att_offset_y),
ATT_GetFloat(playerid, i, att_offset_z),
ATT_GetFloat(playerid, i, att_rot_x),
ATT_GetFloat(playerid, i, att_rot_y),
ATT_GetFloat(playerid, i, att_rot_z),
ATT_GetFloat(playerid, i, att_scale_x),
ATT_GetFloat(playerid, i, att_scale_y),
ATT_GetFloat(playerid, i, att_scale_z),
ATT_GetInt(playerid, i, att_color_1),
ATT_GetInt(playerid, i, att_color_2)
);
}
}
#if defined ATT_OnPlayerSpawn
return ATT_OnPlayerSpawn(playerid);
#else
return 1;
#endif
}
#if defined _ALS_OnPlayerSpawn
#undef OnPlayerSpawn
#else
#define _ALS_OnPlayerSpawn
#endif
#define OnPlayerSpawn ATT_OnPlayerSpawn
#if defined ATT_OnPlayerSpawn
forward ATT_OnPlayerSpawn(playerid);
#endif
public OnPlayerConnect(playerid)
{
for(new i; i < MAX_PLAYER_ATTACHED_OBJECTS; i++)
{
ATT_SetInt(playerid, i, att_used, false);
}
#if defined ATT_OnPlayerConnect
return ATT_OnPlayerConnect(playerid);
#else
return 1;
#endif
}
#if defined _ALS_OnPlayerConnect
#undef OnPlayerConnect
#else
#define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect ATT_OnPlayerConnect
#if defined ATT_OnPlayerConnect
forward ATT_OnPlayerConnect(playerid);
#endif
public OnPlayerDisconnect(playerid, reason)
{
for(new i; i < MAX_PLAYER_ATTACHED_OBJECTS; i++)
{
ATT_SetInt(playerid, i, att_used, false);
if(IsPlayerAttachedObjectSlotUsed(playerid, i))
{
RemovePlayerAttachedObject(playerid, i);
}
}
#if defined ATT_OnPlayerDisconnect
return ATT_OnPlayerDisconnect(playerid, reason);
#else
return 1;
#endif
}
#if defined _ALS_OnPlayerDisconnect
#undef OnPlayerDisconnect
#else
#define _ALS_OnPlayerDisconnect
#endif
#define OnPlayerDisconnect ATT_OnPlayerDisconnect
#if defined ATT_OnPlayerDisconnect
forward ATT_OnPlayerDisconnect(playerid, reason);
#endif
#if ! defined HOLDING
#define HOLDING(%0) ((newkeys & (%0)) == (%0))
#endif
#if ! defined RELEASED
#define RELEASED(%0) (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
#endif
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if ( ! IsPlayerNPC( playerid ) )
{
if (HOLDING(128))
{
switch (GetPlayerWeapon(playerid))
{
case WEAPON_SNIPER, WEAPON_ROCKETLAUNCHER, WEAPON_HEATSEEKER, WEAPON_CAMERA:
{
for (new i; i < MAX_PLAYER_ATTACHED_OBJECTS; i++)
{
if (IsPlayerAttachedObjectSlotUsed(playerid, i) &&
ATT_GetInt(playerid, i, att_used))
{
RemovePlayerAttachedObject(playerid, i);
}
}
}
}
}
if(RELEASED(128))
{
for (new i; i < MAX_PLAYER_ATTACHED_OBJECTS; i++)
{
if (! IsPlayerAttachedObjectSlotUsed(playerid, i) &&
ATT_GetInt(playerid, i, att_used))
{
SetPlayerAttachedObject( playerid,
i,
ATT_GetInt(playerid, i, att_modelid),
ATT_GetInt(playerid, i, att_bone),
ATT_GetFloat(playerid, i, att_offset_x),
ATT_GetFloat(playerid, i, att_offset_y),
ATT_GetFloat(playerid, i, att_offset_z),
ATT_GetFloat(playerid, i, att_rot_x),
ATT_GetFloat(playerid, i, att_rot_y),
ATT_GetFloat(playerid, i, att_rot_z),
ATT_GetFloat(playerid, i, att_scale_x),
ATT_GetFloat(playerid, i, att_scale_y),
ATT_GetFloat(playerid, i, att_scale_z),
ATT_GetInt(playerid, i, att_color_1),
ATT_GetInt(playerid, i, att_color_2)
);
}
}
}
}
#if defined ATT_OnPlayerKeyStateChange
return ATT_OnPlayerKeyStateChange(playerid, newkeys, oldkeys);
#else
return 1;
#endif
}
#if defined _ALS_OnPlayerKeyStateChange
#undef OnPlayerKeyStateChange
#else
#define _ALS_OnPlayerKeyStateChange
#endif
#define OnPlayerKeyStateChange ATT_OnPlayerKeyStateChange
#if defined ATT_OnPlayerKeyStateChange
forward ATT_OnPlayerKeyStateChange(playerid, newkeys, oldkeys);
#endif
public OnPlayerEditAttachedObject(playerid, response, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ)
{
ATT_SetInt(playerid, index, att_modelid, modelid);
ATT_SetInt(playerid, index, att_bone, boneid);
ATT_SetFloat(playerid, index, att_offset_x, fOffsetX);
ATT_SetFloat(playerid, index, att_offset_y, fOffsetY);
ATT_SetFloat(playerid, index, att_offset_z, fOffsetZ);
ATT_SetFloat(playerid, index, att_rot_x, fRotX);
ATT_SetFloat(playerid, index, att_rot_y, fRotY);
ATT_SetFloat(playerid, index, att_rot_z, fRotZ);
ATT_SetFloat(playerid, index, att_scale_x, fScaleX);
ATT_SetFloat(playerid, index, att_scale_y, fScaleY);
ATT_SetFloat(playerid, index, att_scale_z, fScaleZ);
#if defined ATT_OnPlayerEditAttachedObject
return ATT_OnPlayerEditAttachedObject(playerid, response, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ);
#else
return 1;
#endif
}
#if defined _ALS_OnPlayerEditAttachedObject
#undef OnPlayerEditAttachedObject
#else
#define _ALS_OnPlayerEditAttachedObject
#endif
#define OnPlayerEditAttachedObject ATT_OnPlayerEditAttachedObject
#if defined ATT_OnPlayerEditAttachedObject
forward ATT_OnPlayerEditAttachedObject(playerid, response, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ);
#endif
stock ATT_SetPlayerAttachedObject(playerid, index, modelid, bone, Float:fOffsetX = 0.0, Float:fOffsetY = 0.0, Float:fOffsetZ = 0.0, Float:fRotX = 0.0, Float:fRotY = 0.0, Float:fRotZ = 0.0, Float:fScaleX = 1.0, Float:fScaleY = 1.0, Float:fScaleZ = 1.0, materialcolor1 = 0, materialcolor2 = 0)
{
if(SetPlayerAttachedObject(playerid, index, modelid, bone, fOffsetX, fOffsetY, fOffsetZ, fRotX, fRotY, fRotZ, fScaleX, fScaleY, fScaleZ, materialcolor1, materialcolor2))
{
ATT_SetInt(playerid, index, att_modelid, modelid);
ATT_SetInt(playerid, index, att_bone, bone);
ATT_SetFloat(playerid, index, att_offset_x, fOffsetX);
ATT_SetFloat(playerid, index, att_offset_y, fOffsetY);
ATT_SetFloat(playerid, index, att_offset_z, fOffsetZ);
ATT_SetFloat(playerid, index, att_rot_x, fRotX);
ATT_SetFloat(playerid, index, att_rot_y, fRotY);
ATT_SetFloat(playerid, index, att_rot_z, fRotZ);
ATT_SetFloat(playerid, index, att_scale_x, fScaleX);
ATT_SetFloat(playerid, index, att_scale_y, fScaleY);
ATT_SetFloat(playerid, index, att_scale_z, fScaleZ);
ATT_SetInt(playerid, index, att_color_1, materialcolor1);
ATT_SetInt(playerid, index, att_color_2, materialcolor2);
ATT_SetInt(playerid, index, att_used, true);
return true;
}
return false;
}
#if defined _ALS_SetPlayerAttachedObject
#undef SetPlayerAttachedObject
#else
#define _ALS_SetPlayerAttachedObject
#endif
#define SetPlayerAttachedObject ATT_SetPlayerAttachedObject
stock GetPlayerAttachedObject(playerid, index, &modelid, &bone, &Float:fOffsetX, &Float:fOffsetY, &Float:fOffsetZ, &Float:fRotX, &Float:fRotY, &Float:fRotZ, &Float:fScaleX, &Float:fScaleY, &Float:fScaleZ, &materialcolor1, &materialcolor2)
{
if(gAttachment[playerid][index][att_used])
{
modelid = ATT_GetInt(playerid, i, att_modelid);
bone = ATT_GetInt(playerid, i, att_bone);
fOffsetX = ATT_GetFloat(playerid, i, att_offset_x);
fOffsetY = ATT_GetFloat(playerid, i, att_offset_y);
fOffsetZ = ATT_GetFloat(playerid, i, att_offset_z);
fRotX = ATT_GetFloat(playerid, i, att_rot_x);
fRotY = ATT_GetFloat(playerid, i, att_rot_y);
fRotZ = ATT_GetFloat(playerid, i, att_rot_z);
fScaleX = ATT_GetFloat(playerid, i, att_scale_x);
fScaleY = ATT_GetFloat(playerid, i, att_scale_y);
fScaleZ = ATT_GetFloat(playerid, i, att_scale_z);
materialcolor1 = ATT_GetInt(playerid, i, att_color_1);
materialcolor2 = ATT_GetInt(playerid, i, att_color_2);
return true;
}
return false;
}
stock ATT_RemovePlayerAttachedObject(playerid, index)
{
if(RemovePlayerAttachedObject(playerid, index))
{
ATT_SetInt(playerid, index, att_used, false);
return true;
}
return false;
}
#if defined _ALS_RemovePlayerAttachedObject
#undef RemovePlayerAttachedObject
#else
#define _ALS_RemovePlayerAttachedObject
#endif
#define RemovePlayerAttachedObject ATT_RemovePlayerAttachedObject
#undef att_modelid
#undef att_bone
#undef att_offset_x
#undef att_offset_y
#undef att_offset_z
#undef att_rot_x
#undef att_rot_y
#undef att_rot_z
#undef att_scale_x
#undef att_scale_y
#undef att_scale_z
#undef att_color_1
#undef att_color_2
#undef att_used

111
pawno/include/lookupffs.inc Normal file
View File

@ -0,0 +1,111 @@
/*
* Lookupffs.inc
* Edited by Lorenc_
*
*/
// Macros
#define GetPlayerHost(%1) (g_lookup_PlayerData[%1][E_HOST])
#define GetPlayerISP(%1) (g_lookup_PlayerData[%1][E_ISP])
#define GetPlayerCountryCode(%1) (g_lookup_PlayerData[%1][E_CODE])
#define GetPlayerCountryName(%1) (g_lookup_PlayerData[%1][E_COUNTRY])
#define GetPlayerCountryRegion(%1) (g_lookup_PlayerData[%1][E_REGION])
#define IsProxyUser(%1) (g_lookup_PlayerData[%1][E_PROXY])
#define IsProxyEnabledForPlayer(%1) (g_lookup_Success{%1})
// Variables
enum E_LOOKUP_DATA
{
E_HOST[ 60 ], E_CODE[ 3 ], E_COUNTRY[ 45 ],
E_REGION[ 43 ], E_ISP[ 128 ], E_PROXY
};
stock
g_lookup_PlayerData[ MAX_PLAYERS ] [ E_LOOKUP_DATA ],
g_lookup_Success[ MAX_PLAYERS char ],
g_lookup_Retry[ MAX_PLAYERS char ]
;
// Forwards
public OnLookupResponse( playerid, response, data[ ] );
public OnLookupComplete( playerid, success );
// Hooks
public OnPlayerConnect( playerid ) {
if ( ! IsPlayerNPC( playerid ) ) {
g_lookup_Retry{ playerid } = 0;
LookupPlayerIP( playerid );
}
return CallLocalFunction("Lookup_OnPlayerConnect", "i", playerid);
}
// Functions
stock LookupPlayerIP( playerid ) {
if( IsPlayerNPC( playerid ) )
return 0;
static
szIP[ 16 ], szQuery[ 50 ];
GetPlayerIp( playerid, szIP, sizeof( szIP ) );
format( szQuery, sizeof( szQuery ), "iphub.info/api.php?ip=%s&showtype=2", szIP );
return HTTP( playerid, HTTP_GET, szQuery, "", "OnLookupResponse" );
}
stock ResetPlayerIPData( playerid ) {
format( g_lookup_PlayerData[ playerid ] [ E_HOST ], 10, "Unknown" );
format( g_lookup_PlayerData[ playerid ] [ E_CODE ], 3, "XX" );
format( g_lookup_PlayerData[ playerid ] [ E_COUNTRY ], 10, "Unknown" );
format( g_lookup_PlayerData[ playerid ] [ E_REGION ], 10, "Unknown" );
format( g_lookup_PlayerData[ playerid ] [ E_ISP ], 10, "Unknown" );
g_lookup_PlayerData[ playerid ] [ E_PROXY ] = 0;
g_lookup_Success{ playerid } = 0;
}
// Callbacks
public OnLookupResponse( playerid, response, data[ ] ) {
if( !IsPlayerConnected( playerid ) )
return 0;
if( response != 200 ) // Fail
{
if( !g_lookup_Retry{ playerid } ) {
g_lookup_Retry{ playerid } = 1;
return LookupPlayerIP( playerid );
} else {
ResetPlayerIPData( playerid );
}
}
else
{
if( sscanf( data, "p< >e<s[60]s[3]s[45]s[43]s[128]d>", g_lookup_PlayerData[ playerid ] ) )
{
if( !g_lookup_Retry{ playerid } ) {
g_lookup_Retry{ playerid } = 1;
return LookupPlayerIP( playerid );
} else {
ResetPlayerIPData( playerid );
}
}
else
{
strreplacechar( g_lookup_PlayerData[ playerid ] [ E_COUNTRY ], '_', ' ' );
strreplacechar( g_lookup_PlayerData[ playerid ] [ E_ISP ], '_', ' ' );
g_lookup_Success{ playerid } = 1;
}
}
return CallLocalFunction( "OnLookupComplete", "ii", playerid, g_lookup_Success{ playerid } );
}
// Hook
#if defined _ALS_OnPlayerConnect
#undef OnPlayerConnect
#else
#define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect Lookup_OnPlayerConnect
forward Lookup_OnPlayerConnect( playerid );

20675
pawno/include/sf-cnr.inc Normal file

File diff suppressed because it is too large Load Diff