PDA

View Full Version : [HELP] PHP file for achievements.


Airkish
12-12-2016, 09:53
Hey guys,

I understand this isn't web languages forum but it's kinda related.

I managed to install Hns achievements by xPaw to my server and it's working.
However it needs a .php file which isn't provided and I lack php/sql knowledge to build it by myself.

So if there's anyone who could give me a code, I would really appreciate it.

I'm currently using these plugins:

AchievementsAPI (https://github.com/xPaw/AMXX-Plugins/blob/master/plugins/Achievements/AchievementsAPI.sma)
#include < amxmodx >
#include < sqlx >
#include < time >
#include < chatcolor >

// #define DEBUG
//#define USE_TUTOR
//#define SHOW_TUTOR_ON_SPAWN

#pragma semicolon 1

new const LogFile[ ] = "Achievements.log";
new const MotdTitle[ ] = "[ mY.RuN ] Achievements by xPaw";
new const Prefix[ ] = "[ mY.RuN Achievements ]";

new const TutorTask = 4562853;

#define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )
#define IsAchievement(%1) ( 0 <= %1 <= g_iTotalAchievs )
#define IsUserAuthorized(%1) ( g_iConnected[ %1 ] & FULL_STATUS == FULL_STATUS )

#define SteamPlaytime formatex( szTime, 6, "%.1f", iPlayTime / 60.0 );

enum _:AchievementData {
Achv_Name[ 32 ],
Achv_NeededToGain,
Achv_ProgressModule,
Achv_SqlIndex
};

enum _:ProgressData {
Progress_Num,
Progress_Bits
};

enum _:Forwards {
Fwd_Connect,
Fwd_Unlock
};

enum ( <<= 1 ) {
CONNECTED = 1,
AUTHORIZED
};

const FULL_STATUS = CONNECTED|AUTHORIZED;

new Array:g_aAchievements;
new Array:g_aProgress[ 33 ];
new Trie:g_tSqlIndexes;

new Handle:g_hSqlConnection;
new Handle:g_hSqlTuple;

new g_iMaxPlayers;
new g_iTotalAchievs;
new g_szDummy[ 2 ];
new g_iPlayerId[ 33 ];
new g_iPlayTime[ 33 ];
new g_iConnected[ 33 ];
new g_iForwards[ Forwards ];

new TABLE_GLOBAL[ 32 ], TABLE_ACHIEVS[ 32 ], TABLE_PLAYERS[ 32 ], TABLE_PROGRESS[ 32 ];

new g_szHTML[ 364 ] = "<html><head><meta http-equiv='Refresh' content='0; URL=%link%'></head><body bgcolor=black><center><img src=http://my-run.de/l.png>";

#if defined USE_TUTOR
enum TutorColors {
TUTOR_GREEN = 1, // Info
TUTOR_RED = 2, // Skull
TUTOR_BLUE = 4, // Skull
TUTOR_YELLOW = 8 // Info
};

new g_iMsgTutorText, g_iMsgTutorClose;

#include < hamsandwich >
#endif

public plugin_init( ) {
register_plugin( "Achievements API", "3.0", "xPaw" );

register_dictionary( "time.txt" );

#if defined USE_TUTOR
g_iMsgTutorText = get_user_msgid( "TutorText" );
g_iMsgTutorClose = get_user_msgid( "TutorClose" );

#if defined SHOW_TUTOR_ON_SPAWN
RegisterHam( Ham_Spawn, "player", "FwdHamPlayerSpawn", 1 );
#endif
#endif

// Read config file
new szFile[ 256 ];
get_localinfo( "amxx_configsdir", szFile, 127 );
add( szFile, 127, "/achievements.cfg" );

new iFile = fopen( szFile, "rt" );

if( !iFile )
SetFailState( "Failed to open config file." );

new iPos, szHost[ 32 ], szUser[ 32 ], szPass[ 32 ], szDb[ 32 ], szStatsLink[ 128 ];

while( !feof( iFile ) ) {
fgets( iFile, szFile, 255 );
trim( szFile );

if( !szFile[ 0 ] || szFile[ 0 ] == ';' )
continue;

if( ( iPos = contain( szFile, "=" ) ) < 0 )
continue;

if( equal( szFile, "TABLE_ACHIEVS", 12 ) )
copy( TABLE_ACHIEVS, 31, szFile[ iPos + 2 ] );
else if( equal( szFile, "TABLE_PLAYERS", 12 ) )
copy( TABLE_PLAYERS, 31, szFile[ iPos + 2 ] );
else if( equal( szFile, "TABLE_PROGRESS", 13 ) )
copy( TABLE_PROGRESS, 31, szFile[ iPos + 2 ] );
else if( equal( szFile, "TABLE_GLOBAL", 11 ) )
copy( TABLE_GLOBAL, 31, szFile[ iPos + 2 ] );
else if( equal( szFile, "STATS_LINK", 9 ) )
copy( szStatsLink, 127, szFile[ iPos + 2 ] );

else if( equal( szFile, "SQL_HOST", 7 ) )
copy( szHost, 31, szFile[ iPos + 2 ] );
else if( equal( szFile, "SQL_USER", 7 ) )
copy( szUser, 31, szFile[ iPos + 2 ] );
else if( equal( szFile, "SQL_PASS", 7 ) )
copy( szPass, 31, szFile[ iPos + 2 ] );
else if( equal( szFile, "SQL_DB", 5 ) )
copy( szDb, 31, szFile[ iPos + 2 ] );
}

fclose( iFile );

// Open sql
new szError[ 128 ], i;

g_hSqlTuple = SQL_MakeDbTuple( szHost, szUser, szPass, szDb );
g_hSqlConnection = SQL_Connect( g_hSqlTuple, i, szError, 127 );

if( g_hSqlConnection == Empty_Handle )
SetFailState( szError );

g_iMaxPlayers = get_maxplayers( );
g_aAchievements = ArrayCreate( AchievementData );
g_tSqlIndexes = TrieCreate( );

for( i = 1; i <= g_iMaxPlayers; i++ )
g_aProgress[ i ] = ArrayCreate( 2 );

register_clcmd( "say", "CmdSay" );
register_clcmd( "say /ach", "CmdAchievements" );
register_clcmd( "say /played", "CmdPlayedTime" );
register_clcmd( "say /playtime", "CmdPlayedTime" );
register_clcmd( "say /achievements", "CmdAchievements" );

// Forwards
g_iForwards[ Fwd_Connect ] = CreateMultiForward( "Achv_Connect", ET_IGNORE, FP_CELL, FP_CELL, FP_CELL );
g_iForwards[ Fwd_Unlock ] = CreateMultiForward( "Achv_Unlock", ET_IGNORE, FP_CELL, FP_CELL );

// Generate this
replace( g_szHTML, 363, "%link%", szStatsLink );

// Reset players
SQL_QueryMe( "UPDATE `%s` SET `Status` = '0'", TABLE_PLAYERS );
}

SetFailState( const szError[ ] ) {
new iReturn, iForward = CreateMultiForward( "Achv_CoreGoneWrong", ET_IGNORE );

ExecuteForward( iForward, iReturn );
DestroyForward( iForward );
set_fail_state( szError );
}

public plugin_precache( ) {
precache_sound( "events/task_complete.wav" );

#if defined USE_TUTOR
new const szTutorPrecache[ ][ ] = {
"gfx/career/icon_!.tga",
"gfx/career/icon_!-bigger.tga",
"gfx/career/icon_i.tga",
"gfx/career/icon_i-bigger.tga",
"gfx/career/icon_skulls.tga",
"gfx/career/round_corner_ne.tga",
"gfx/career/round_corner_nw.tga",
"gfx/career/round_corner_se.tga",
"gfx/career/round_corner_sw.tga",
"resource/TutorScheme.res",
"resource/UI/TutorTextWindow.res"
};

for( new i; i < sizeof szTutorPrecache; i++ )
precache_generic( szTutorPrecache[ i ] );
#endif
}

public plugin_end( ) {
ArrayDestroy( g_aAchievements );
TrieDestroy( g_tSqlIndexes );

new i;
for( i = 1; i <= g_iMaxPlayers; i++ )
ArrayDestroy( g_aProgress[ i ] );

for( i = 0; i < Forwards; i++ )
DestroyForward( g_iForwards[ i ] );

SQL_FreeHandle( g_hSqlTuple );
SQL_FreeHandle( g_hSqlConnection );
}

public plugin_natives( ) {
register_library( "Achievements" );

register_native( "SetAchievementComponentBit", "NativeSetComponentBit" );
register_native( "RegisterAchievement", "NativeRegisterAchievement" );
register_native( "AchievementProgress", "NativeAchievementProgress" );
register_native( "HaveAchievement", "NativeHaveAchievement" );
register_native( "GetProgress", "NativeGetProgress" );
register_native( "GetUnlocksCount", "NativeGetUnlocksCount" );
register_native( "SetLeaderBoard", "NativeSetLeaderBoard" );
register_native( "GetPlayerId", "NativeGetPlayerId" );
}

public client_authorized( id )
if( ( g_iConnected[ id ] |= AUTHORIZED ) & CONNECTED )
UserHasBeenAuthorized( id );

public client_putinserver( id )
if( !is_user_bot( id ) && ( g_iConnected[ id ] |= CONNECTED ) & AUTHORIZED )
UserHasBeenAuthorized( id );

UserHasBeenAuthorized( const id ) {
new szAuthid[ 40 ], EmptyProgress[ ProgressData ];
get_user_authid( id, szAuthid, 39 );

for( new i = 0; i < g_iTotalAchievs; i++ )
ArraySetArray( g_aProgress[ id ], i, EmptyProgress );

new szQuery[ 128 ], szId[ 1 ]; szId[ 0 ] = id;
formatex( szQuery, 127, "SELECT `Id` FROM `GlobalPlayers` WHERE `SteamId` = '%s'", szAuthid );

SQL_ThreadQuery( g_hSqlTuple, "HandlePlayerConnect", szQuery, szId, 1 );
}

public HandlePlayerConnect( iFailState, Handle:hQuery, szError[ ], iError, szData[ ], iSize, Float:flQueueTime ) {
if( SQL_IsFail( iFailState, iError, szError ) )
return;

#if defined DEBUG
log_amx( "[DEBUG] Query finished in %.2f seconds. (Player)", flQueueTime );
#endif

new id = szData[ 0 ];

if( !IsUserAuthorized( id ) )
return;

new szIp[ 16 ], szName[ 32 ], iSysTime = get_systime( 0 );
get_user_name( id, szName, 31 );
get_user_ip( id, szIp, 15, 1 );

if( !SQL_NumResults( hQuery ) ) { // This player doesnt have any entry in db
new szQuery[ 256 ], szAuthid[ 40 ];
get_user_authid( id, szAuthid, 39 );
formatex( szQuery, 255, "INSERT INTO `%s` (`SteamId`, `Ip`, `Nick`, `FirstJoin`, `LastJoin`) \
VALUES ('%s', '%s', ^"%s^", '%i', '%i')",
TABLE_GLOBAL, szAuthid, szIp, szName, iSysTime, iSysTime );

SQL_ThreadQuery( g_hSqlTuple, "HandlePlayerInsert", szQuery, szData, 1 );

return;
}

g_iPlayerId[ id ] = SQL_ReadResult( hQuery, 0 );

SQL_QueryMe( "UPDATE `%s` SET `Nick` = ^"%s^", `Ip` = '%s', `LastJoin` = '%i' WHERE `Id` = '%i'",
TABLE_GLOBAL, szName, szIp, iSysTime, g_iPlayerId[ id ] );

SQL_QueryMe( "INSERT INTO `%s` (`Id`,`Status`,`FirstJoin`,`LastJoin`,`Connec ts`) \
VALUES ('%i','1','%i','%i','1') ON DUPLICATE KEY UPDATE `Connects`=`Connects`+1,`Status`='1',`LastJoi n`='%i'",
TABLE_PLAYERS, g_iPlayerId[ id ], iSysTime, iSysTime, iSysTime );

// Select player progress
hQuery = SQL_PrepareQuery( g_hSqlConnection, "SELECT `Progress`, `Achievement`, `Bits` \
FROM `%s` WHERE `Id` = '%i' ORDER BY `Achievement` ASC", TABLE_PROGRESS, g_iPlayerId[ id ] );

if( !SQL_Execute( hQuery ) ) {
new szQuery[ 256 ];
SQL_QueryError( hQuery, szQuery, 255 );

log_to_file( LogFile, "[Error] %s", szQuery );

SQL_FreeHandle( hQuery );

return;
}

if( SQL_NumResults( hQuery ) ) {
new iAchievement, Progress[ ProgressData ];

while( SQL_MoreResults( hQuery ) ) {
iAchievement = 0;
g_szDummy[ 0 ] = SQL_ReadResult( hQuery, 1 );

if( !TrieGetCell( g_tSqlIndexes, g_szDummy, iAchievement ) ) {
SQL_NextRow( hQuery );
continue;
}

Progress[ Progress_Num ] = SQL_ReadResult( hQuery, 0 );
Progress[ Progress_Bits ] = SQL_ReadResult( hQuery, 2 );

ArraySetArray( g_aProgress[ id ], iAchievement, Progress );

SQL_NextRow( hQuery );
}
}

SQL_FreeHandle( hQuery );

// Select player from server table
hQuery = SQL_PrepareQuery( g_hSqlConnection, "SELECT `PlayTime`, `Connects` FROM `%s` WHERE `Id` = '%i'", TABLE_PLAYERS, g_iPlayerId[ id ] );

if( !SQL_Execute( hQuery ) ) {
new szQuery[ 256 ];
SQL_QueryError( hQuery, szQuery, 255 );

log_to_file( LogFile, "[Error] %s", szQuery );

SQL_FreeHandle( hQuery );

return;
}

new iConnects;

if( !SQL_NumResults( hQuery ) ) {
g_iPlayTime[ id ] = 0;
} else {
g_iPlayTime[ id ] = SQL_ReadResult( hQuery, 0 );
iConnects = SQL_ReadResult( hQuery, 1 );
}

SQL_FreeHandle( hQuery );

new iReturn;
ExecuteForward( g_iForwards[ Fwd_Connect ], iReturn, id, g_iPlayTime[ id ], iConnects );
}

public HandlePlayerInsert( iFailState, Handle:hQuery, szError[ ], iError, szData[ ], iSize, Float:flQueueTime ) {
if( SQL_IsFail( iFailState, iError, szError ) )
return;

#if defined DEBUG
log_amx( "[DEBUG] Query finished in %.2f seconds. (Player Insert)", flQueueTime );
#endif

new id = szData[ 0 ];

if( !IsUserAuthorized( id ) )
return;

new szQuery[ 128 ], szAuthid[ 40 ], iReturn;
get_user_authid( id, szAuthid, 39 );
formatex( szQuery, 127, "SELECT `Id` FROM `GlobalPlayers` WHERE `SteamId` = '%s'", szAuthid );

SQL_ThreadQuery( g_hSqlTuple, "HandlePlayerInsert2", szQuery, szData, 1 );

ExecuteForward( g_iForwards[ Fwd_Connect ], iReturn, id, 0, 0 );
}

public HandlePlayerInsert2( iFailState, Handle:hQuery, szError[ ], iError, szData[ ], iSize, Float:flQueueTime ) {
if( SQL_IsFail( iFailState, iError, szError ) )
return;

#if defined DEBUG
log_amx( "[DEBUG] Query finished in %.2f seconds. (Player Insert #2)", flQueueTime );
#endif

new id = szData[ 0 ];

if( !IsUserAuthorized( id ) )
return;

g_iPlayerId[ id ] = SQL_ReadResult( hQuery, 0 );

new iSysTime = get_systime( 0 );

SQL_QueryMe( "INSERT INTO `%s` (`Id`,`Status`,`FirstJoin`,`LastJoin`,`Connec ts`) \
VALUES ('%i','1','%i','%i','1') ON DUPLICATE KEY UPDATE `Connects`=`Connects`+1,`Status`='1',`LastJoi n`='%i'",
TABLE_PLAYERS, g_iPlayerId[ id ], iSysTime, iSysTime, iSysTime );
}

public client_disconnect( id ) {
g_iPlayTime[ id ] = 0;
g_iConnected[ id ] = 0;

if( !g_iPlayerId[ id ] )
return;

new iPlayTime = ( get_user_time( id ) / 60 ),
iSysTime = get_systime( 0 );

SQL_QueryMe( "UPDATE `%s` SET `Status` = '0', `LastJoin` = '%i', `PlayTime` = `PlayTime` + '%i' WHERE `Id` = '%i'",
TABLE_PLAYERS, iSysTime, iPlayTime, g_iPlayerId[ id ] );

SQL_QueryMe( "UPDATE `%s` SET `LastJoin` = '%i', `PlayTime` = `PlayTime` + '%i' WHERE `Id` = '%i'",
TABLE_GLOBAL, iSysTime, iPlayTime, g_iPlayerId[ id ] );

g_iPlayerId[ id ] = 0;
}

public client_infochanged( id ) {
if( !g_iPlayerId[ id ] )
return;

new szOldName[ 32 ], szNewName[ 32 ];
get_user_name( id, szOldName, 31 );
get_user_info( id, "name", szNewName, 31 );

if( !equali( szNewName, szOldName ) )
SQL_QueryMe( "UPDATE `%s` SET `Nick` = ^"%s^" WHERE `Id` = '%i'", TABLE_GLOBAL, szNewName, g_iPlayerId[ id ] );
}

public NativeAchievementProgress( const iPlugin, const iParams ) {
new id = get_param( 1 );

if( !IsPlayer( id ) ) {
log_error( AMX_ERR_BOUNDS, "AchievementProgress: index out of bounds for id (%i)", id );
return 0;
}
else if( !g_iPlayerId[ id ] )
return 0;

new iAchievement = get_param( 2 );

if( !IsAchievement( iAchievement ) ) {
log_error( AMX_ERR_BOUNDS, "AchievementProgress: index out of bounds for iAchievement (%i)", id );
return 0;
}

new Achievement[ AchievementData ], Progress[ ProgressData ];
ArrayGetArray( g_aAchievements, iAchievement, Achievement );
ArrayGetArray( g_aProgress[ id ], iAchievement, Progress );

// Lets check if he already has achievement
if( Progress[ Progress_Num ] >= Achievement[ Achv_NeededToGain ] ) {
#if defined DEBUG
ColorChat( 0, Red, "^1Achievement progress for^3 #%i^1 -^4 ^"%s^" (%i)^1 -^3 Already unlocked!",
id, Achievement[ Achv_Name ], Achievement[ Achv_SqlIndex ] );
#endif

return 1;
}

new iProgress = get_param( 3 );
new iTotalProgress = iProgress + Progress[ Progress_Num ];

if( iTotalProgress >= Achievement[ Achv_NeededToGain ] ) {
iTotalProgress = Achievement[ Achv_NeededToGain ];

AwardAchievement( id, iAchievement, Achievement );
}
else if( Achievement[ Achv_ProgressModule ] > 0 && ( iTotalProgress % Achievement[ Achv_ProgressModule ] ) == 0 ) {
ShowProgressNotification( id, iTotalProgress, Achievement[ Achv_Name ], Achievement[ Achv_NeededToGain ] );
}

Progress[ Progress_Num ] = iTotalProgress;

ArraySetArray( g_aProgress[ id ], iAchievement, Progress );

UTIL_UpdateProgress( id, Achievement[ Achv_SqlIndex ], iProgress, Progress[ Progress_Bits ] );

#if defined DEBUG
ColorChat( 0, Red, "^1Achievement progress for^3 #%i^1 -^4 ^"%s^" (%i)^1 - Progress:^4 %i^1 (%i/%i)",
id, Achievement[ Achv_Name ], Achievement[ Achv_SqlIndex ], iProgress, iTotalProgress, Achievement[ Achv_NeededToGain ] );
#endif

return 0;
}

UTIL_SetProgress( const id, const iSqlIndex, const iProgress, const iBits ) {
new iSysTime = get_systime( 0 );
SQL_QueryMe( "INSERT INTO `%s` VALUES('%i', '%i', '%i', '%i', '%i') ON DUPLICATE KEY UPDATE `Progress` = '%i', `Bits` = '%i', `Date` = '%i'",
TABLE_PROGRESS, g_iPlayerId[ id ], iSqlIndex, iProgress, iBits, iSysTime, iProgress, iBits, iSysTime );
}

UTIL_UpdateProgress( const id, const iSqlIndex, const iProgress, const iBits ) {
new iSysTime = get_systime( 0 );
SQL_QueryMe( "INSERT INTO `%s` VALUES('%i', '%i', '%i', '%i', '%i') ON DUPLICATE KEY UPDATE `Progress` = `Progress` + '%i', `Bits` = '%i', `Date` = '%i'",
TABLE_PROGRESS, g_iPlayerId[ id ], iSqlIndex, iProgress, iBits, iSysTime, iProgress, iBits, iSysTime );
}

ShowProgressNotification( const id, const iProgress, const szName[ ], const iNeededToGain ) {
client_cmd( id, "spk ^"events/tutor_msg^"" );

#if defined USE_TUTOR
UTIL_ShowTutor( id, TUTOR_RED, 6.0, "Achievement progress:^n%s (%i/%i)", szName, iProgress, iNeededToGain );
#else
engclient_print( id, engprint_center, "^nAchievement Progress:^n%s (%i/%i)", szName, iProgress, iNeededToGain );
#endif
}

AwardAchievement( const id, const iAchievement, const Achievement[ AchievementData ] ) {
#if defined USE_TUTOR
UTIL_ShowTutor( id, TUTOR_GREEN, 8.0, "Achievement unlocked:^n%s", Achievement[ Achv_Name ] );
#endif

new szName[ 32 ];
get_user_name( id, szName, 31 );

ColorChat( 0, Red, "%s %s^1 has earned the achievement^4 %s^1.", Prefix, szName, Achievement[ Achv_Name ] );

if( is_user_alive( id ) )
emit_sound( id, CHAN_VOICE, "events/task_complete.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
else
client_cmd( id, "spk ^"events/task_complete.wav^"" );

new iReturn;
ExecuteForward( g_iForwards[ Fwd_Unlock ], iReturn, id, iAchievement );
}

public NativeHaveAchievement( const iPlugin, const iParams ) {
new id = get_param( 1 );
new iAchievement = get_param( 2 );

if( !IsPlayer( id ) ) {
log_error( AMX_ERR_BOUNDS, "HaveAchievement: index out of bounds for id (%i)", id );
return 0;
}
else if( !IsAchievement( iAchievement ) ) {
log_error( AMX_ERR_BOUNDS, "HaveAchievement: index out of bounds for iAchievement (%i)", id );
return 0;
}

new Achievement[ AchievementData ], Progress[ ProgressData ];
ArrayGetArray( g_aAchievements, iAchievement, Achievement );
ArrayGetArray( g_aProgress[ id ], iAchievement, Progress );

return bool:( Progress[ Progress_Num ] >= Achievement[ Achv_NeededToGain ] );
}

public NativeSetLeaderBoard( const iPlugin, const iParams ) {
new id = get_param( 1 );

if( !IsPlayer( id ) ) {
log_error( AMX_ERR_BOUNDS, "SetLeaderBoard: index out of bounds for id (%i)", id );
return 0;
}
else if( !g_iPlayerId[ id ] )
return 0;

log_to_file( LogFile, "[Warning] SetLeaderBoard called! This function is not implented yet!" );

// new szName[ 32 ], iValue = get_param( 3 );
// get_string( 2, szName, 31 );

// SQL_QueryMe( "INSERT INTO `Leaderboard` VALUES ('%i','%s','%i') ON DUPLICATE KEY UPDATE `Value` = '%i'",
// g_iPlayerId[ id ], szName, iValue, iValue );

return 1;
}

public NativeGetPlayerId( const iPlugin, const iParams ) {
new id = get_param( 1 );

if( !IsPlayer( id ) ) {
log_error( AMX_ERR_BOUNDS, "GetPlayerId: index out of bounds for id (%i)", id );
return 0;
}

return g_iPlayerId[ id ];
}

public NativeGetProgress( const iPlugin, const iParams ) {
new id = get_param( 1 );
new iAchievement = get_param( 2 );

if( !IsPlayer( id ) ) {
log_error( AMX_ERR_BOUNDS, "GetProgress: index out of bounds for id (%i)", id );
return 0;
}
else if( !IsAchievement( iAchievement ) ) {
log_error( AMX_ERR_BOUNDS, "GetProgress: index out of bounds for iAchievement (%i)", id );
return 0;
}

new Progress[ ProgressData ];
ArrayGetArray( g_aProgress[ id ], iAchievement, Progress );

return Progress[ Progress_Num ];
}

public NativeGetUnlocksCount( const iPlugin, const iParams ) {
new id = get_param( 1 );

if( id == 0 ) {
return g_iTotalAchievs;
}
else if( !IsPlayer( id ) ) {
log_error( AMX_ERR_BOUNDS, "GetUnlocksCount: index out of bounds for id (%i)", id );
return 0;
}

return UTIL_CountUnlocks( id );
}

public NativeRegisterAchievement( const iPlugin, const iParams ) {
new Achievement[ AchievementData ], iPos = ArraySize( g_aAchievements );

new szName[ 64 ];
get_string( 1, Achievement[ Achv_Name ], 31 );
SQL_QuoteString( g_hSqlConnection, szName, 63, Achievement[ Achv_Name ] );

new Handle:hQuery = SQL_PrepareQuery( g_hSqlConnection, "SELECT `Id`, `NeededToGain`, `ProgressModule` \
FROM `%s` WHERE `Name` = '%s'", TABLE_ACHIEVS, szName );

if( !SQL_Execute( hQuery ) ) {
new szQuery[ 256 ];
SQL_QueryError( hQuery, szQuery, 255 );

log_to_file( LogFile, "[Error] %s", szQuery );

SQL_FreeHandle( hQuery );

return -1;
}

if( !SQL_NumResults( hQuery ) ) {
Achievement[ Achv_NeededToGain ] = get_param( 3 );
Achievement[ Achv_ProgressModule ] = CalcProgressMsgIncrement( Achievement[ Achv_NeededToGain ] );

new szDesc[ 128 ];
get_string( 2, szDesc, 127 );
SQL_QuoteString( g_hSqlConnection, szDesc, 127, szDesc );

hQuery = SQL_PrepareQuery( g_hSqlConnection, "INSERT INTO `%s` (`Name`, `Description`, `NeededToGain`, `ProgressModule`) VALUES ('%s', '%s', '%i', '%i')",
TABLE_ACHIEVS, szName, szDesc, Achievement[ Achv_NeededToGain ], Achievement[ Achv_ProgressModule ] );

if( !SQL_Execute( hQuery ) ) {
new szQuery[ 256 ];
SQL_QueryError( hQuery, szQuery, 255 );

log_to_file( LogFile, "[Error] %s", szQuery );

SQL_FreeHandle( hQuery );

return -1;
}

hQuery = SQL_PrepareQuery( g_hSqlConnection, "SELECT `Id` FROM `%s` WHERE `Name` = '%s'", TABLE_ACHIEVS, szName );

if( !SQL_Execute( hQuery ) ) {
new szQuery[ 256 ];
SQL_QueryError( hQuery, szQuery, 255 );

log_to_file( LogFile, "[Error] %s", szQuery );

SQL_FreeHandle( hQuery );

return -1;
}

new szPlugin[ 32 ];
get_plugin( iPlugin, szPlugin, 31 );

log_to_file( LogFile, "[%s] Registering new achievement: %s", szPlugin, Achievement[ Achv_Name ] );
} else {
Achievement[ Achv_NeededToGain ] = SQL_ReadResult( hQuery, 1 );
Achievement[ Achv_ProgressModule ] = SQL_ReadResult( hQuery, 2 );
}

g_szDummy[ 0 ] = Achievement[ Achv_SqlIndex ] = SQL_ReadResult( hQuery, 0 );

SQL_FreeHandle( hQuery );
TrieSetCell( g_tSqlIndexes, g_szDummy, iPos );
ArrayPushArray( g_aAchievements, Achievement );

new EmptyProgress[ ProgressData ];

for( new i = 1; i <= g_iMaxPlayers; i++ )
ArrayPushArray( g_aProgress[ i ], EmptyProgress );

g_iTotalAchievs++; // g_iTotalAchievs = iPos + 1;

return iPos;
}

public CmdPlayedTime( const id ) {
new szTime[ 128 ], iPlayTime = ( get_user_time( id ) / 60 ) + g_iPlayTime[ id ];

get_time_length( id, iPlayTime, timeunit_minutes, szTime, 127 );

if( !szTime[ 0 ] )
szTime = "...";

ColorChat( id, Red, "%s^1 You have played for^4 %s", Prefix, szTime );
}

public CmdAchievements( const id ) {
new szAuthId[ 30 ], szLink[ 364 ];
get_user_authid( id, szAuthId, 39 );

format( szAuthId, 355, "%s&r=%i", szAuthId, random_num( 1000, 9999 ) ); // Avoid stupid IE caching

copy( szLink, 363, g_szHTML );
replace( szLink, 363, "%steam%", szAuthId );

show_motd( id, szLink, MotdTitle );
}

public CmdSay( const id ) {
new szSaid[ 50 ];
read_args( szSaid, 49 );
remove_quotes( szSaid );

if( szSaid[ 0 ] == '/' || szSaid[ 0 ] == '.' )
{
new szCmd[ 8 ], szNick[ 32 ];
parse( szSaid, szCmd, 7, szNick, 31 );

if( equali( szCmd[ 1 ], "stats" ) ) {
new iPlayer;

if( szNick[ 0 ] && !( iPlayer = FindPlayer( id, szNick ) ) )
return;

if( !iPlayer ) iPlayer = id;

if( !g_iPlayerId[ iPlayer ] ) {
ColorChat( id, Red, "%s^1 You can't view stats of this player.", Prefix );
return;
}

new szAuthId[ 30 ], szLink[ 364 ];
get_user_authid( iPlayer, szAuthId, 39 );

format( szAuthId, 355, "%s&r=%i", szAuthId, random_num( 1000, 9999 ) ); // Avoid stupid IE caching

copy( szLink, 363, g_szHTML );
replace( szLink, 363, "%steam%", szAuthId );

show_motd( id, szLink, MotdTitle );
}
else if( equali( szCmd[ 1 ], "rank" ) ) {
if( !g_iTotalAchievs ) {
ColorChat( id, Red, "%s^1 There are no achievements.", Prefix );
return;
}

new iPlayer;

if( szNick[ 0 ] && !( iPlayer = FindPlayer( id, szNick ) ) )
return;

if( !iPlayer ) iPlayer = id;

if( !g_iPlayerId[ iPlayer ] ) {
ColorChat( id, Red, "%s^1 You can't view rank of this player.", Prefix );
return;
}

new iCount = UTIL_CountUnlocks( iPlayer ),
iPercent = iCount * 100 / g_iTotalAchievs, szTime[ 7 ],
iPlayTime = ( get_user_time( iPlayer ) / 60 ) + g_iPlayTime[ iPlayer ];

SteamPlaytime

if( iPlayer != id ) {
new szName[ 32 ];
get_user_name( iPlayer, szName, 31 );

ColorChat( id, Red, "%s %s^1 : Achievements earned:^4 %i/%i^1.^3 (%i%%).^1 Play Time:^4 %s hours^1.",
Prefix, szName, iCount, g_iTotalAchievs, iPercent, szTime );
} else
ColorChat( id, Red, "%s^1 Achievements earned:^4 %i/%i^1.^3 (%i%%).^1 Play Time:^4 %s hours^1.",
Prefix, iCount, g_iTotalAchievs, iPercent, szTime );
}
}
}

FindPlayer( id, const szArg[ ] ) {
new iPlayer = find_player( "bl", szArg );

if( iPlayer ) {
if( iPlayer != find_player( "blj", szArg ) ) {
ColorChat( id, Red, "%s^1 There are more clients matching to your argument.", Prefix );

return 0;
}
}
else if( szArg[ 0 ] == '#' && szArg[ 1 ] ) {
iPlayer = find_player( "k", str_to_num( szArg[ 1 ] ) );
}

if( !iPlayer ) {
ColorChat( id, Red, "%s^1 Player with that name or userid not found.", Prefix );

return 0;
}

if( !g_iPlayerId[ id ] ) {
ColorChat( id, Red, "%s^1 You can't see rank of this player.", Prefix );

return 0;
}

return iPlayer;
}

#if defined USE_TUTOR
#if defined SHOW_TUTOR_ON_SPAWN
public FwdHamPlayerSpawn( const id ) {
if( is_user_alive( id ) ) {
if( !g_iPlayerId[ id ] ) {
return;
}

new szTime[ 7 ], iPlayTime = ( get_user_time( id ) / 60 ) + g_iPlayTime[ id ];

SteamPlaytime

UTIL_ShowTutor( id, TUTOR_BLUE, 7.0, "You have played %s hours^nYou have %i of %i achievements^n^nVisit us at www.my-run.de",
szTime, UTIL_CountUnlocks( id ), g_iTotalAchievs );
}
}
#endif // SHOW_TUTOR_ON_SPAWN

public TaskCloseTutor( id ) {
id -= TutorTask;

if( g_iPlayerId[ id ] ) {
message_begin( MSG_ONE_UNRELIABLE, g_iMsgTutorClose, _, id );
message_end( );
}
}

UTIL_ShowTutor( const id, const TutorColors:iColor, const Float:flStayTime = 5.0, const szText[ ], any:... ) {
remove_task( id + TutorTask );

new szMessage[ 128 ];
vformat( szMessage, 127, szText, 5 );

message_begin( MSG_ONE_UNRELIABLE, g_iMsgTutorText, _, id );
write_string( szMessage );
write_byte( 0 );
write_short( -1 );
write_short( 0 ); // id && !is_user_alive(id)
write_short( _:iColor );
message_end( );

set_task( flStayTime, "TaskCloseTutor", id + TutorTask );
}
#endif // USE_TUTOR

SQL_QueryMe( const szQuery[ ], any:... ) {
new szMessage[ 256 ];
vformat( szMessage, 255, szQuery, 2 );

SQL_ThreadQuery( g_hSqlTuple, "HandleQuery", szMessage );
}

SQL_IsFail( const iFailState, const iError, const szError[ ] ) {
if( iFailState == TQUERY_CONNECT_FAILED ) {
log_to_file( LogFile, "[Error] Could not connect to SQL database: %s", szError );
return true;
}
else if( iFailState == TQUERY_QUERY_FAILED ) {
log_to_file( LogFile, "[Error] Query failed: %s", szError );
return true;
}
else if( iError ) {
log_to_file( LogFile, "[Error] Error on query: %s", szError );
return true;
}

return false;
}

public HandleQuery( iFailState, Handle:hQuery, szError[ ], iError, szData[ ], iSize, Float:flQueueTime ) {
SQL_IsFail( iFailState, iError, szError );
}

//-----------------------------------------------------------------------------
// Purpose: calculates at how many steps we should show a progress notification
// Function was found in Steam API :-)
//-----------------------------------------------------------------------------
CalcProgressMsgIncrement( const iGoal ) {
// by default, show progress at every 25%
new iIncrement = iGoal / 4;
// if goal is not evenly divisible by 4, try some other values
if( 0 != ( iGoal % 4 ) ) {
if( 0 == ( iGoal % 3 ) ) {
iIncrement = iGoal / 3;
}
else if( 0 == ( iGoal % 5 ) ) {
iIncrement = iGoal / 5;
}
// otherwise stick with divided by 4, rounded off
}

// don't show progress notifications for less than 5 things
return ( iIncrement < 5 ? 0 : iIncrement );
}

//-----------------------------------------------------------------------------
// Purpose: sets the specified component bit # if it is not already.
// If it does get set, evaluate if this satisfies an achievement
// Function was found in Steam API :-)
//-----------------------------------------------------------------------------
public NativeSetComponentBit( const iPlugin, const iParams ) {
new id = get_param( 1 );
new iAchievement = get_param( 2 );

if( !IsPlayer( id ) ) {
log_error( AMX_ERR_BOUNDS, "SetAchievementComponentBit: index out of bounds for id (%i)", id );
return;
}
else if( !IsAchievement( iAchievement ) ) {
log_error( AMX_ERR_BOUNDS, "SetAchievementComponentBit: index out of bounds for iAchievement (%i)", id );
return;
}

new Achievement[ AchievementData ], Progress[ ProgressData ];
ArrayGetArray( g_aAchievements, iAchievement, Achievement );
ArrayGetArray( g_aProgress[ id ], iAchievement, Progress );

// check if we already have this achievement...
if( Progress[ Progress_Num ] >= Achievement[ Achv_NeededToGain ] )
return;

if( get_playersnum( ) <= 2 ) {
#if defined USE_TUTOR
UTIL_ShowTutor( id, TUTOR_RED, 4.0, "Ignoring achievement progress^ndue to lack of players." );
#endif

return;
}

// calculate which bit this component corresponds to
new iBitMask = ( 1 << get_param( 3 ) );

// see if we already have gotten this component
if( 0 == ( iBitMask & Progress[ Progress_Bits ] ) ) {
// new component, set the bit and increment the count
Progress[ Progress_Bits ] |= iBitMask;

new iCount = Progress[ Progress_Num ] = UTIL_CountNumBitsSet( Progress[ Progress_Bits ] );

if( iCount == Achievement[ Achv_NeededToGain ] ) {
AwardAchievement( id, iAchievement, Achievement );
} else {
#if defined DEBUG
ColorChat( 0, Red, "^1Component^4 %d^1 for achievement^3 %s^1 found. (plr: %i)", iBitMask, Achievement[ Achv_Name ], id );
#endif

ShowProgressNotification( id, iCount, Achievement[ Achv_Name ], Achievement[ Achv_NeededToGain ] );
}

ArraySetArray( g_aProgress[ id ], iAchievement, Progress );

UTIL_SetProgress( id, Achievement[ Achv_SqlIndex ], iCount, Progress[ Progress_Bits ] );
}
#if defined DEBUG
else
ColorChat( 0, Red, "^1Component^4 %d^1 for achievement^3 %s^1 found, but already had that component. (plr: %i)",
iBitMask, Achievement[ Achv_Name ], id );
#endif
}

UTIL_CountNumBitsSet( nVar ) { // C++ Convert
new const gNumBitsInNibble[ 16 ] = {
0, // 0000 = 0
1, // 0001 = 1
1, // 0010 = 2
2, // 0011 = 3
1, // 0100 = 4
2, // 0101 = 5
2, // 0110 = 6
3, // 0111 = 7
1, // 1000 = 8
2, // 1001 = 9
2, // 1010 = 10
3, // 1011 = 11
2, // 1100 = 12
3, // 1101 = 13
3, // 1110 = 14
4, // 1111 = 15
};

new nNumBits;

while( nVar > 0 ) {
// Look up and add in bits in the bottom nibble
nNumBits += gNumBitsInNibble[ nVar & 0x0f ];

// Shift one nibble to the right
nVar >>= 4;
}

return nNumBits;
}

UTIL_CountUnlocks( const id ) {
if( !g_iPlayerId[ id ] )
return 0;

new iCount, Achievement[ AchievementData ], Progress[ ProgressData ];

for( new i; i < g_iTotalAchievs; i++ ) {
ArrayGetArray( g_aAchievements, i, Achievement );
ArrayGetArray( g_aProgress[ id ], i, Progress );

if( Progress[ Progress_Num ] >= Achievement[ Achv_NeededToGain ] )
iCount++;
}

return iCount;
}

HnsAchievements (https://github.com/xPaw/AMXX-Plugins/blob/master/plugins/Achievements/HnsAchievements.sma)
#include < amxmodx >
#include < achievements >
#include < hamsandwich >
#include < fakemeta >
#include < cstrike >
#include < engine >
#include < csx >
#include < xs >

// JUMPSTATS
enum
{
JUMP_LONG,
JUMP_HIGH,
JUMP_WEIRD,

JUMP_BHOP,
JUMP_STAND_BHOP,
JUMP_DROPBHOP,
JUMP_STAND_DROPBHOP,

JUMP_COUNT,
JUMP_DOUBLECOUNT,
JUMP_MULTICOUNT,
JUMP_DROP_COUNT,

JUMP_LADDERJUMP,
JUMP_LADDERBHOP
};

#define UnitsToMeters(%1) ( %1 * 0.0254 )
#define IsUserOnGround(%1) ( entity_get_int( %1, EV_INT_flags ) & FL_ONGROUND )
#define IsUserOnLadder(%1) ( entity_get_int( %1, EV_INT_movetype ) == MOVETYPE_FLY )

new g_iHS[ 33 ];
new g_iJumps[ 33 ];
new g_iPlayTime[ 33 ];
new g_iRoundKills[ 33 ];
new g_iCounterKills[ 33 ];
new g_iWins[ 33 ];

new bool:g_bJB[ 33 ];
new bool:g_bEB[ 33 ];

new Float:g_flGameStart;
new Float:g_flLastKill[ 33 ];
new Float:g_flDistance[ 33 ];
new Float:g_flFlashedAt[ 33 ];
new Float:g_vOldOrigin[ 33 ][ 3 ];
new Float:g_vDeathOrigin[ 33 ][ 3 ];

new const Float:g_vNullOrigin[ 3 ];

new ACH_KILL_1ST,
ACH_LADDER,
ACH_SURVIVE,
ACH_AIR_BORNE,
ACH_FLASHED,
ACH_EDGEBUG_1HP,
ACH_EDGEBUG_2TH,
ACH_HIGH_EDGE;

new ACH_DISTANCE,
ACH_FAST_ASSASINS,
ACH_ADDICT,
ACH_PLAY_AROUND,
ACH_DAY_MARATHON,
ACH_3HS_IN_ROW,
ACH_TRHOW_NADE;
// +1

new ACH_EB_JB,
ACH_JUMPBUG,
ACH_JUMPBUGS,
ACH_JUMPBUG_1HP,
ACH_EDGEBUG_DBL,
ACH_EDGEBUG_DBL2,
ACH_1HP_SURVIVE,
ACH_3CT_SURVIVE;

new ACH_MAP_SURVIVE,
ACH_LADDER_JUMP,
ACH_KILL_FIVE,
ACH_THREE_MIN,
ACH_MAP_JUMPS;

new ACH_LJ_PRE_BHOP,
ACH_LJ_260CJ,
ACH_LJ_250LJ,
ACH_LJ_240BJ,
ACH_LJ_WOOT;

new ACH_SPRAY,
ACH_HUMILIATE,
ACH_TERRORIST,
ACH_NADE_CT,
ACH_DAMAGE;

public plugin_init( )
{
register_plugin( "HNS: Achievements", "1.0", "xPaw & master4life" );

ACH_SURVIVE = RegisterAchievement( "Catch me if you can", "Survive 50 rounds as a Terrorist", 50 );
ACH_DISTANCE = RegisterAchievement( "Far, far away", "Walk 10000 meters", 10000 );

ACH_AIR_BORNE = RegisterAchievement( "Air Show", "Kill 50 enemies while they are in air", 50 );
ACH_FLASHED = RegisterAchievement( "Blind Ambition", "Kill 5 Terrorists while they are fully flashed", 5 );
ACH_FAST_ASSASINS = RegisterAchievement( "Double Cross", "Kill 2 Terrorists in 2 seconds or less", 1 );
ACH_LADDER = RegisterAchievement( "Ladderlicious", "Kill 15 Terrorists while they are on a ladder", 15 );

ACH_DAMAGE = RegisterAchievement( "Does It Hurt When I Do This?", "Get killed 100 times by environmental damage", 100 );
ACH_TERRORIST = RegisterAchievement( "Your Experience", "Kill 500 Terrorists", 500 );
ACH_NADE_CT = RegisterAchievement( "No Hard Feelings", "Kill 15 Counter-Terrorists with a grenade", 15 );
ACH_SPRAY = RegisterAchievement( "Urban Designer", "Spray 100 decals", 100 );
ACH_HUMILIATE = RegisterAchievement( "Who Cares? They're dead!", "Spray 15 decals on dead bodies of Counter-Terrorists", 15 );

ACH_3HS_IN_ROW = RegisterAchievement( "Eviction Notice", "Get 3 headshots in a row", 1 );
ACH_1HP_SURVIVE = RegisterAchievement( "Wounded But Steady", "Survive a round while having 1 HP left", 1 );
ACH_3CT_SURVIVE = RegisterAchievement( "Against The Odds", "Survive a round against 3 or more Counter-Terrorists", 1 );
ACH_MAP_SURVIVE = RegisterAchievement( "Still Alive", "Survive 10 rounds before a map change", 1 );
ACH_MAP_JUMPS = RegisterAchievement( "Super Mario Brothers", "Make 2000 jumps before map change", 1 );

ACH_EB_JB = RegisterAchievement( "Old School", "Make a edgebug and jumpbug in same round", 1 );
ACH_EDGEBUG_1HP = RegisterAchievement( "Asking for Trouble", "Make a edgebug from a height of 1000 units while at 1 HP", 1 );
ACH_EDGEBUG_2TH = RegisterAchievement( "Basic Science", "Make a edgebug from a height of 1500 or higher", 1 );
ACH_HIGH_EDGE = RegisterAchievement( "Edgebug Veteran", "Perform 25 successful edgebugs", 25 );
ACH_EDGEBUG_DBL = RegisterAchievement( "New Innovation", "Make a double edgebug", 1 );
ACH_EDGEBUG_DBL2 = RegisterAchievement( "Double Edgebug Veteran", "Perform 10 successful double edgebugs", 10 );

ACH_JUMPBUG_1HP = RegisterAchievement( "Preservation of Mass", "Make a jumpbug while at 1 HP", 1 );
ACH_JUMPBUG = RegisterAchievement( "Pit Boss", "Make a jumpbug", 1 );
ACH_JUMPBUGS = RegisterAchievement( "Jumpbug Veteran", "Perform 25 successful jumpbugs", 25 );

ACH_KILL_1ST = RegisterAchievement( "Serial Killer", "Acquire 30 kills before map change", 1 );
ACH_THREE_MIN = RegisterAchievement( "Party of Three", "Acquire 3 kills within 60 seconds after round start", 1 );

ACH_KILL_FIVE = RegisterAchievement( "Take No Prisoners", "Get 5 kills in single round", 1 );
ACH_LADDER_JUMP = RegisterAchievement( "Vertically Unchallenged", "Kill 5 Terrorists that are on ladder, while you are in air", 5 );
ACH_TRHOW_NADE = RegisterAchievement( "Potato Layer", "Throw 1000 grenades", 1000 );

ACH_LJ_PRE_BHOP = RegisterAchievement( "Stranger Than Friction", "Get prestrafe speed of 299 on bhop and successfully make the jump", 1 );
ACH_LJ_260CJ = RegisterAchievement( "Count Jump", "Jump 260 countjump 5 times", 5 );
ACH_LJ_250LJ = RegisterAchievement( "Long Jump", "Jump 250 longjump 5 times", 5 );
ACH_LJ_240BJ = RegisterAchievement( "Bhop Jump", "Jump 240 bhopjump 5 times", 5 );
ACH_LJ_WOOT = RegisterAchievement( "Triple Crown", "Unlock 3 achievements: Count Jump, Long Jump and Bhop Jump", 3 );

ACH_ADDICT = RegisterAchievement( "Addict", "Join to the server 500 times", 500 );
ACH_PLAY_AROUND = RegisterAchievement( "Play Around", "Spent 1 hour playing on server", 1 );
ACH_DAY_MARATHON = RegisterAchievement( "Day Marathon", "Spent 1 day playing on server", 1 );

RegisterHam( Ham_Spawn, "player", "FwdHamPlayerSpawnPost", true );
RegisterHam( Ham_Player_PreThink, "player", "FwdHamPlayerPreThink", true );

register_event( "ScreenFade", "EventScreenFade", "be", "1>4096", "4=255", "5=255", "6=255", "7>199" );
register_event( "DeathMsg", "EventDeathMsg", "a", "2>0" );
register_event( "SendAudio", "EventSendAudio", "a", "2=%!MRAD_terwin" ); // "2=%!MRAD_ctwin"
register_event( "HLTV", "EventRoundStart", "a", "1=0", "2=0" );
register_event( "23", "EventSpray", "a", "1=112" );
register_event( "ClCorpse", "EventClCorpse", "a" );
}

public Achv_Unlock( const id, const iAchievement )
{
new i = -1;

if( iAchievement == ACH_LJ_260CJ ) i = 0;
else if( iAchievement == ACH_LJ_250LJ ) i = 1;
else if( iAchievement == ACH_LJ_240BJ ) i = 2;

if( i > -1 )
{
SetAchievementComponentBit( id, ACH_LJ_WOOT, i );
}

if( is_user_alive( id ) )
{
new iOrigin[ 3 ];
get_user_origin( id, iOrigin );

message_begin( MSG_PVS, SVC_TEMPENTITY, iOrigin );
write_byte( TE_IMPLOSION );
write_coord( iOrigin[ 0 ] );
write_coord( iOrigin[ 1 ] );
write_coord( iOrigin[ 2 ] );
write_byte( 400 );
write_byte( 100 );
write_byte( 7 );
message_end( );
}
}

ResetStats( id )
{
g_flDistance[ id ] = 0.0;
g_vOldOrigin[ id ] = g_vNullOrigin;
}

public client_putinserver( id )
{
ResetStats( id );

g_iCounterKills[ id ]
= g_iJumps[ id ]
= g_iWins[ id ]
= g_iHS[ id ]
= g_iRoundKills[ id ] = 0;
}

public Achv_Connect( const id, const iPlayTime, const iConnects )
{
g_iPlayTime[ id ] = iPlayTime;

AchievementProgress( id, ACH_ADDICT );
}

public EventRoundStart( )
{
g_flGameStart = get_gametime( ) + 60.0;
}

public grenade_throw( id, iEntity, iNadeType )
{
AchievementProgress( id, ACH_TRHOW_NADE );
}

public EventSendAudio( )
{
new iPlayers[ 32 ], iNum;
get_players( iPlayers, iNum, "c" );

if( iNum < 2 )
{
return;
}

new i, id, iTS[ 32 ], iTNum, iCTNum, CsTeams:iTeam;

for( i = 0; i < iNum; i++ )
{
id = iPlayers[ i ];

iTeam = cs_get_user_team( id );

if( iTeam == CS_TEAM_CT )
{
if( is_user_alive( id ) )
{
iCTNum++;
}
}
else if( iTeam == CS_TEAM_T && is_user_alive( id ) )
{
iTS[ iTNum++ ] = id;

AchievementProgress( id, ACH_SURVIVE );

if( get_user_health( id ) == 1 )
{
AchievementProgress( id, ACH_1HP_SURVIVE );
}

if( ++g_iWins[ id ] == 10 )
{
AchievementProgress( id, ACH_MAP_SURVIVE );
}
}
}

if( iTNum && iCTNum >= 3 )
{
for( i = 0; i < iTNum; i++ )
{
AchievementProgress( iTS[ i ], ACH_3CT_SURVIVE );
}
}
}

public EventClCorpse( )
{
if( read_data( 11 ) != 2 ) // CS_TEAM_CT
{
return;
}

new id = read_data( 12 );

read_data( 2, g_vDeathOrigin[ id ][ 0 ] );
read_data( 3, g_vDeathOrigin[ id ][ 1 ] );
read_data( 4, g_vDeathOrigin[ id ][ 2 ] );

g_vDeathOrigin[ id ][ 0 ] /= 128.0;
g_vDeathOrigin[ id ][ 1 ] /= 128.0;
g_vDeathOrigin[ id ][ 2 ] /= 128.0;
}

public EventSpray( )
{
new id = read_data( 2 );

AchievementProgress( id, ACH_SPRAY );

if( cs_get_user_team( id ) != CS_TEAM_T )
{
return;
}

new Float:vOrigin[ 3 ], iPlayers[ 32 ], iNum, iPlayer;

entity_get_vector( id, EV_VEC_origin, vOrigin );
get_players( iPlayers, iNum, "be", "CT" );

for( new i = 0; i < iNum; i++ )
{
iPlayer = iPlayers[ i ];

if( get_distance_f( vOrigin, g_vDeathOrigin[ iPlayer ] ) < 80.0 )
{
AchievementProgress( id, ACH_HUMILIATE );

break;
}
}
}

public EventScreenFade( const id )
{
g_flFlashedAt[ id ] = get_gametime( ) + ( read_data( 1 ) >> 12 );
}

public EventDeathMsg( )
{
new iVictim = read_data( 2 ),
iKiller = read_data( 1 );

if( !iKiller || iKiller == iVictim )
{
AchievementProgress( iVictim, ACH_DAMAGE );

return;
}

g_iHS[ iVictim ] = 0;

new CsTeams:iTeam = cs_get_user_team( iKiller );

if( iTeam == CS_TEAM_CT )
{
entity_get_vector( iVictim, EV_VEC_origin, g_vDeathOrigin[ iVictim ] );

AchievementProgress( iKiller, ACH_TERRORIST );

if( ++g_iCounterKills[ iKiller ] == 30 )
{
AchievementProgress( iKiller, ACH_KILL_1ST );
}

if( ++g_iRoundKills[ iKiller ] == 5 )
{
AchievementProgress( iKiller, ACH_KILL_FIVE );
}
else if( g_iRoundKills[ iKiller ] == 3 && g_flGameStart >= get_gametime( ) )
{
AchievementProgress( iKiller, ACH_THREE_MIN );
}

if( !IsUserOnGround( iKiller ) && IsUserOnLadder( iVictim ) )
{
AchievementProgress( iKiller, ACH_LADDER_JUMP );
}

if( read_data( 3 ) )
{
if( ++g_iHS[ iKiller ] == 3 )
{
AchievementProgress( iKiller, ACH_3HS_IN_ROW );
}
}
else
{
g_iHS[ iKiller ] = 0;
}

if( g_flFlashedAt[ iVictim ] > get_gametime( ) )
{
AchievementProgress( iKiller, ACH_FLASHED );
}

if( IsUserOnLadder( iVictim ) )
{
AchievementProgress( iKiller, ACH_LADDER );
}
else if( !IsUserOnGround( iVictim ) )
{
AchievementProgress( iKiller, ACH_AIR_BORNE );
}

new Float:flGameTime = get_gametime( );

if( g_flLastKill[ iKiller ] >= flGameTime )
{
AchievementProgress( iKiller, ACH_FAST_ASSASINS );
}

g_flLastKill[ iKiller ] = flGameTime + 2.0;
}
else if( iTeam == CS_TEAM_T )
{
new szWeapon[ 5 ];
read_data( 4, szWeapon, 4 );

if( szWeapon[ 0 ] == 'g' && szWeapon[ 3 ] == 'n' ) // grenade
{
AchievementProgress( iKiller, ACH_NADE_CT );
}
}
}

public AddStats( id )
{
if( !is_user_connected( id ) )
{
return;
}

new iDistance = floatround( UnitsToMeters( g_flDistance[ id ] ) );

if( iDistance > 0 && cs_get_user_team( id ) == CS_TEAM_T )
{
AchievementProgress( id, ACH_DISTANCE, iDistance );
}

ResetStats( id );
}

public FwdHamPlayerSpawnPost( const id )
{
if( !is_user_alive( id ) )
{
return;
}

if( g_iPlayTime[ id ] )
{
#define ONE_HOUR 60
#define ONE_DAY 1440

if( g_iPlayTime[ id ] >= ONE_HOUR )
{
AchievementProgress( id, ACH_PLAY_AROUND );

if( g_iPlayTime[ id ] >= ONE_DAY )
{
AchievementProgress( id, ACH_DAY_MARATHON );
}
}

g_iPlayTime[ id ] = 0;
}

set_task( 2.0, "AddStats", id );

g_iRoundKills[ id ] = 0;
g_flFlashedAt[ id ] = 0.0;
g_bEB[ id ] = g_bJB[ id ] = false;
g_vDeathOrigin[ id ] = g_vNullOrigin;
}

public FwdHamPlayerPreThink( const id )
{
if( is_user_alive( id ) )
{
#define m_afButtonPressed 246

if( IsUserOnGround( id )
&& get_pdata_int( id, m_afButtonPressed ) & IN_JUMP
&& ++g_iJumps[ id ] == 2000 )
{
AchievementProgress( id, ACH_MAP_JUMPS );
}

if( cs_get_user_team( id ) != CS_TEAM_T )
{
return;
}

static Float:vOrigin[ 3 ];
entity_get_vector( id, EV_VEC_origin, vOrigin );

vOrigin[ 2 ] = 0.0;

if( !xs_vec_equal( g_vOldOrigin[ id ], g_vNullOrigin ) )
{
g_flDistance[ id ] += get_distance_f( vOrigin, g_vOldOrigin[ id ] );
}

g_vOldOrigin[ id ] = vOrigin;
}
}

public kz_edgebug( const id, const iDistance, const iSpeed, const iEngineFps, const iTimes )
{
if( iDistance < 150 )
{
return;
}

AchievementProgress( id, ACH_HIGH_EDGE );

if( iTimes == 2 )
{
AchievementProgress( id, ACH_EDGEBUG_DBL );
AchievementProgress( id, ACH_EDGEBUG_DBL2 );
}

if( iDistance >= 1000 && get_user_health( id ) == 1 )
{
AchievementProgress( id, ACH_EDGEBUG_1HP );
}

if( iDistance >= 1500 )
{
AchievementProgress( id, ACH_EDGEBUG_2TH );
}

g_bEB[ id ] = true;

CheckEB_JB( id );
}

public kz_jumpbug( const id, const iDistance, const iSpeed, const iEngineFps )
{
AchievementProgress( id, ACH_JUMPBUG );
AchievementProgress( id, ACH_JUMPBUGS );

if( get_user_health( id ) == 1 )
{
AchievementProgress( id, ACH_JUMPBUG_1HP );
}

g_bJB[ id ] = true;

CheckEB_JB( id );
}

CheckEB_JB( id )
{
if( g_bEB[ id ] && g_bJB[ id ] )
{
AchievementProgress( id, ACH_EB_JB );
}
}

public js_jump( id, iType, iDirection, Float:flDistance, Float:flPreStrafe, Float:flMaxSpeed, iStrafes, iSync )
{
if( flDistance >= 260.0 && ( iType == JUMP_COUNT || iType == JUMP_DOUBLECOUNT || iType == JUMP_MULTICOUNT ) )
{
AchievementProgress( id, ACH_LJ_260CJ );
}

if( flPreStrafe >= 299.0 && ( iType == JUMP_BHOP || iType == JUMP_STAND_BHOP ) )
{
AchievementProgress( id, ACH_LJ_PRE_BHOP );
}

if( flDistance >= 250.0 && ( iType == JUMP_LONG || iType == JUMP_HIGH ) )
{
AchievementProgress( id, ACH_LJ_250LJ );
}

if( flDistance >= 240.0 && ( iType == JUMP_BHOP || iType == JUMP_STAND_BHOP ) )
{
AchievementProgress( id, ACH_LJ_240BJ );
}
}

config - Achievements (https://github.com/xPaw/AMXX-Plugins/blob/master/plugins/Achievements/achievements.cfg) (I have edited it for my needs, this is primary code).


TABLE_ACHIEVS = Drun_Achievements
TABLE_PLAYERS = Drun_Players
TABLE_PROGRESS = Drun_Progress
TABLE_GLOBAL = GlobalPlayers
STATS_LINK = http://achievements.my-run.de/index.php?server=drun&steamid=%steam%

; SQL Connection Info
SQL_HOST = localhost
SQL_USER = root
SQL_PASS = root
SQL_DB = achievements


schema.sql (https://github.com/xPaw/AMXX-Plugins/blob/master/plugins/Achievements/schema.sql)
I have tried to write php looking through hns table and some .php examples but ended up failing
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLI ENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RE SULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECT ION */;
/*!40101 SET NAMES utf8 */;


CREATE TABLE IF NOT EXISTS `Drun_Achievements` (
`Id` int(11) NOT NULL,
`Name` varchar(32) NOT NULL DEFAULT '',
`Description` varchar(128) NOT NULL DEFAULT '',
`NeededToGain` int(10) NOT NULL DEFAULT '0',
`ProgressModule` int(10) NOT NULL DEFAULT '0',
`Icon` varchar(64) NOT NULL DEFAULT 'default'
) ENGINE=InnoDB AUTO_INCREMENT=52 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `Drun_Players` (
`Id` int(11) NOT NULL,
`Status` tinyint(1) NOT NULL DEFAULT '0',
`PlayTime` int(10) NOT NULL,
`LastJoin` int(20) NOT NULL DEFAULT '0',
`FirstJoin` int(20) NOT NULL DEFAULT '0',
`Connects` int(6) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `Drun_Progress` (
`Id` int(11) NOT NULL DEFAULT '0',
`Achievement` int(11) NOT NULL DEFAULT '0',
`Progress` int(11) NOT NULL DEFAULT '0',
`Bits` int(11) NOT NULL DEFAULT '0',
`Date` int(20) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `Dust2_Achievements` (
`Id` int(11) NOT NULL,
`Name` varchar(32) NOT NULL DEFAULT '',
`Description` varchar(128) NOT NULL DEFAULT '',
`NeededToGain` int(10) NOT NULL DEFAULT '0',
`ProgressModule` int(10) NOT NULL DEFAULT '0',
`Icon` varchar(64) NOT NULL DEFAULT 'default'
) ENGINE=InnoDB AUTO_INCREMENT=54 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `Dust2_Players` (
`Id` int(11) NOT NULL,
`Status` tinyint(1) NOT NULL DEFAULT '0',
`PlayTime` int(10) NOT NULL,
`LastJoin` int(20) NOT NULL DEFAULT '0',
`FirstJoin` int(20) NOT NULL DEFAULT '0',
`Connects` int(6) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `Dust2_Progress` (
`Id` int(11) NOT NULL DEFAULT '0',
`Achievement` int(11) NOT NULL DEFAULT '0',
`Progress` int(11) NOT NULL DEFAULT '0',
`Bits` int(11) NOT NULL DEFAULT '0',
`Date` int(20) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `GlobalPlayers` (
`Id` int(11) NOT NULL,
`SteamId` varchar(34) NOT NULL DEFAULT '',
`Ip` varchar(16) NOT NULL DEFAULT '',
`Nick` varchar(64) NOT NULL,
`PlayTime` int(10) NOT NULL DEFAULT '0',
`LastJoin` int(20) NOT NULL DEFAULT '0',
`FirstJoin` int(20) NOT NULL DEFAULT '0',
`Invited` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB AUTO_INCREMENT=155070 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `Hns_Achievements` (
`Id` int(11) NOT NULL,
`Name` varchar(32) NOT NULL DEFAULT '',
`Description` varchar(128) NOT NULL DEFAULT '',
`NeededToGain` int(10) NOT NULL DEFAULT '0',
`ProgressModule` int(10) NOT NULL DEFAULT '0',
`Icon` varchar(64) NOT NULL DEFAULT 'default'
) ENGINE=InnoDB AUTO_INCREMENT=40 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `Hns_Players` (
`Id` int(11) NOT NULL,
`Status` tinyint(1) NOT NULL DEFAULT '0',
`PlayTime` int(10) NOT NULL,
`LastJoin` int(20) NOT NULL DEFAULT '0',
`FirstJoin` int(20) NOT NULL DEFAULT '0',
`Connects` int(6) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `Hns_Progress` (
`Id` int(11) NOT NULL DEFAULT '0',
`Achievement` int(11) NOT NULL DEFAULT '0',
`Progress` int(11) NOT NULL DEFAULT '0',
`Bits` int(11) NOT NULL DEFAULT '0',
`Date` int(20) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `Jail_Achievements` (
`Id` int(11) NOT NULL,
`Name` varchar(32) NOT NULL DEFAULT '',
`Description` varchar(128) NOT NULL DEFAULT '',
`NeededToGain` int(10) NOT NULL DEFAULT '0',
`ProgressModule` int(10) NOT NULL DEFAULT '0',
`Icon` varchar(64) NOT NULL DEFAULT 'default'
) ENGINE=InnoDB AUTO_INCREMENT=58 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `Jail_Players` (
`Id` int(11) NOT NULL,
`Status` tinyint(1) NOT NULL DEFAULT '0',
`PlayTime` int(10) NOT NULL,
`LastJoin` int(20) NOT NULL DEFAULT '0',
`FirstJoin` int(20) NOT NULL DEFAULT '0',
`Connects` int(6) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `Jail_Progress` (
`Id` int(11) NOT NULL DEFAULT '0',
`Achievement` int(11) NOT NULL DEFAULT '0',
`Progress` int(11) NOT NULL DEFAULT '0',
`Bits` int(11) NOT NULL DEFAULT '0',
`Date` int(20) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `Knife_Achievements` (
`Id` int(11) NOT NULL,
`Name` varchar(32) NOT NULL DEFAULT '',
`Description` varchar(128) NOT NULL DEFAULT '',
`NeededToGain` int(10) NOT NULL DEFAULT '0',
`ProgressModule` int(10) NOT NULL DEFAULT '0',
`Icon` varchar(64) NOT NULL DEFAULT 'default'
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `Knife_Players` (
`Id` int(11) NOT NULL,
`Status` tinyint(1) NOT NULL DEFAULT '0',
`PlayTime` int(10) NOT NULL,
`LastJoin` int(20) NOT NULL DEFAULT '0',
`FirstJoin` int(20) NOT NULL DEFAULT '0',
`Connects` int(6) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `Knife_Progress` (
`Id` int(11) NOT NULL DEFAULT '0',
`Achievement` int(11) NOT NULL DEFAULT '0',
`Progress` int(11) NOT NULL DEFAULT '0',
`Bits` int(11) NOT NULL DEFAULT '0',
`Date` int(20) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


ALTER TABLE `Drun_Achievements`
ADD PRIMARY KEY (`Id`);

ALTER TABLE `Drun_Players`
ADD UNIQUE KEY `Id` (`Id`) USING BTREE;

ALTER TABLE `Drun_Progress`
ADD UNIQUE KEY `Id` (`Id`,`Achievement`) USING BTREE;

ALTER TABLE `Dust2_Achievements`
ADD PRIMARY KEY (`Id`);

ALTER TABLE `Dust2_Players`
ADD UNIQUE KEY `Id` (`Id`) USING BTREE;

ALTER TABLE `Dust2_Progress`
ADD UNIQUE KEY `Id` (`Id`,`Achievement`) USING BTREE;

ALTER TABLE `GlobalPlayers`
ADD PRIMARY KEY (`Id`), ADD UNIQUE KEY `SteamId` (`SteamId`) USING BTREE;

ALTER TABLE `Hns_Achievements`
ADD PRIMARY KEY (`Id`);

ALTER TABLE `Hns_Players`
ADD UNIQUE KEY `Id` (`Id`) USING BTREE;

ALTER TABLE `Hns_Progress`
ADD UNIQUE KEY `Id` (`Id`,`Achievement`) USING BTREE;

ALTER TABLE `Jail_Achievements`
ADD PRIMARY KEY (`Id`);

ALTER TABLE `Jail_Players`
ADD UNIQUE KEY `Id` (`Id`) USING BTREE;

ALTER TABLE `Jail_Progress`
ADD UNIQUE KEY `Id` (`Id`,`Achievement`) USING BTREE;

ALTER TABLE `Knife_Achievements`
ADD PRIMARY KEY (`Id`);

ALTER TABLE `Knife_Players`
ADD UNIQUE KEY `Id` (`Id`) USING BTREE;

ALTER TABLE `Knife_Progress`
ADD UNIQUE KEY `Id` (`Id`,`Achievement`) USING BTREE;


ALTER TABLE `Drun_Achievements`
MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=52;
ALTER TABLE `Dust2_Achievements`
MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=54;
ALTER TABLE `GlobalPlayers`
MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=155070;
ALTER TABLE `Hns_Achievements`
MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=40;
ALTER TABLE `Jail_Achievements`
MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=58;
ALTER TABLE `Knife_Achievements`
MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=25;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIEN T */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESU LTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTIO N */;

INSERT INTO `Drun_Achievements` (`Id`, `Name`, `Description`, `NeededToGain`, `ProgressModule`, `Icon`) VALUES
(1, 'Striker', 'Kill 100 enemies', 100, 25, 'drun/striker'),
(2, 'Enemies Hater', 'Kill 250 enemies', 250, 50, 'drun/enemieshater'),
(3, 'Assassin', 'Kill 20 enemies with headshot from knife', 20, 5, 'drun/assassin'),
(4, 'Grenade Man', 'Kill 10 enemies with grenade', 10, 0, 'drun/grenademan'),
(5, 'Bad Friend', 'Kill 5 teammates in one round', 1, 0, 'drun/badfriend'),
(6, 'Addict', 'Join to server 500 times', 500, 125, 'drun/addict'),
(7, 'Secret Phrase', 'Say secret phrase', 1, 0, 'drun/secretphrase'),
(8, 'Play Around', 'Spent 1 hour playing on server', 1, 0, 'drun/playaround'),
(9, '1 HP Hero', 'Kill enemy while having 1 HP', 1, 0, 'drun/1hphero'),
(10, 'Sleeper', 'Flash yourself 50 times', 50, 10, 'drun/sleeper'),
(11, 'Flasher', 'Flash 5 enemies with one flashbang', 1, 0, 'drun/flasher'),
(12, 'Kid With Gun', '10 Kills with a TMP', 10, 0, 'drun/kidwithgun'),
(13, 'Aimbot', '25 Kills with headshot', 25, 5, 'drun/aimbot'),
(14, 'War Hero', 'Kill 555 enemies', 555, 185, 'drun/warhero'),
(15, 'Suicider', 'Get killed 500 times', 500, 125, 'drun/suicider'),
(16, 'Day Marathon', 'Spent 1 day playing on server', 1, 0, 'drun/daymarathon'),
(17, 'Jesus', 'Transfer 50 players ( say /transfer )', 50, 10, 'drun/jesus'),
(18, 'Road King', 'Kill 50 terrorists', 50, 10, 'drun/roadking'),
(19, 'Casper', 'Buy stealth 10 times in deathrun shop', 10, 0, 'drun/casper'),
(20, 'Evolution', 'Finish deathrun_evolution atleast once', 1, 0, 'drun/evolution'),
(21, 'Nobel Prize', 'Unlock 42 achievements', 1, 0, 'drun/nobelprize'),
(22, 'W...Whatz Up?!', 'Kill atleast one enemy while flashed', 1, 0, 'drun/whatzup'),
(23, 'Dominator', 'Kill 10 counter-terrorists (no traps)', 10, 0, 'drun/dominator'),
(24, 'Head Hunter', 'Kill 5 enemies with stationary gun', 5, 0, 'drun/headhunter'),
(25, 'Millionaire', 'Buy 150 items in deathrun shop', 150, 50, 'drun/millionaire'),
(26, 'Activator', 'Activate 500 buttons', 500, 125, 'drun/activator'),
(27, 'Hellraiser', 'Buy respawn 10 times in deathrun shop', 10, 0, 'drun/hellraiser'),
(28, 'Pyromancer', 'Make 200,000 points of total damage', 200000, 50000, 'drun/pyromancer'),
(29, 'Dealer', 'Win 15 successfull bets with prize over 10000$', 15, 5, 'drun/dealer'),
(30, 'Stand-Alone', 'Die 15 times as the latest guy in team. (As CT only)', 15, 5, 'drun/standalone'),
(31, 'Death-Gunner', 'Find 500 weapons as CT', 500, 125, 'drun/deathgunner'),
(32, 'Im ze ubermench!', 'Buy HP 250 times', 250, 50, 'drun/ubermench'),
(33, 'Boink', 'Walk 2500 meters', 2500, 625, 'drun/boink'),
(34, 'Marathon!', 'Walk 15000 meters', 15000, 3750, 'drun/marathon'),
(35, 'Tour de France', 'Walk 50000 meters', 50000, 12500, 'drun/france'),
(36, 'Vandalism', 'Destroy 200 breakables on map', 200, 50, 'drun/vandalism'),
(37, 'You Never Studied!', 'Finish deathrun_dgs, deathrun_luxus_n1 and deathrun_bleak atleast once', 3, 0, 'drun/neverstudied'),
(38, 'We Have the Talent!', 'Finish deathrun_darkside, deathrun_ijumping_beta7 and deathrun_state3_winter atleast once', 3, 0, 'drun/talent'),
(39, 'We''re Just Getting Started', 'Finish deathrun_midnight_beta3, deathrun_nightmare and deathrun_4life_rmk atleast once', 3, 0, 'drun/getting_started'),
(40, 'Float Like a Butterfly', 'Finish deathrun_junbee_beta5, deathrun_hotel and deathrun_industry atleast once', 3, 0, 'drun/butterfly'),
(41, 'Mission Impossible', 'Finish deathrun_fixxor.', 1, 0, 'drun/mission_impossible'),
(42, 'Spoils Of War', 'Win total of 500,000$ using bet system', 500000, 125000, 'drun/spoilsofwar'),
(43, 'Synergy Speedrun', 'Complete deathrun_death in 1m50s or less', 1, 0, 'drun/synergy'),
(44, 'Trauma Queen', 'Do extreme jump on deathrun_somwhera and succesfully win the round', 1, 0, 'drun/trauma_queen'),
(45, 'Camp Fire', 'Finish deathrun_dojo, deathrun_trap_canyon and deathrun_burnzone atleast once', 3, 0, 'drun/camp_fire'),
(46, 'Counter Espionage', 'Kill 15 enemies while under effects of Casper', 15, 5, 'drun/casper2'),
(47, 'Joint Operation', 'Pickup elites on deathrun_dojo and kill 10 enemies with them', 10, 0, 'drun/joint_op'),
(48, 'Taringacs Family', 'Finish two of taringa maps (taringacs_lostrome, taringacs_inthetetris)', 2, 0, 'drun/taringacs'),
(50, 'Is It Safe?', 'Kill your teammates 100 times', 100, 25, 'drun/isitsafe'),
(51, 'The Big Hurt', 'Get secret armor suite on TerrorLabs and survive', 1, 0, 'default');

INSERT INTO `Dust2_Achievements` (`Id`, `Name`, `Description`, `NeededToGain`, `ProgressModule`, `Icon`) VALUES
(1, 'Someone Set Up Us The Bomb', 'Win a round by planting a bomb', 1, 0, 'dust2/someone_bomb'),
(2, 'Rite of First Defusal', 'Win a round by defusing a bomb', 1, 0, 'dust2/first_defusal'),
(3, 'Boomala Boomala', 'Plant 50 bombs', 50, 10, 'dust2/boomala'),
(4, 'The Hurt Blocker', 'Defuse 50 bombs', 50, 10, 'dust2/hurt_blocker'),
(5, 'Combat Ready', 'Defuse a bomb with a kit when it would have failed without one', 1, 0, 'dust2/combat_ready'),
(6, 'Counter-Counter-Terrorist', 'Kill a CT while he is defusing the bomb', 1, 0, 'dust2/cct'),
(7, 'Newb World Order', 'Win 10 rounds', 10, 0, 'dust2/newb_world'),
(8, 'Veteran', 'Win 100 rounds', 100, 25, 'dust2/veteran'),
(9, 'The Art of War', 'Spray 100 decals', 100, 25, 'dust2/art_of_war'),
(10, 'Body Bagger', 'Kill 100 enemies', 100, 25, 'dust2/body_bagger'),
(11, 'God of War', 'Kill 500 enemies', 500, 125, 'dust2/god_of_war'),
(12, 'Dead Man Stalking', 'Kill an enemy while at 1 health', 1, 0, 'dust2/dead_man'),
(13, 'The Unstoppable Force', 'Kill 5 enemy players in a single round', 1, 0, 'dust2/unstoppable'),
(14, 'Battle Sight Zero', 'Kill 250 enemy players with headshots', 250, 50, 'dust2/battle_sight'),
(15, 'Points in Your Favor', 'Inflict 2,500 total points of damage to enemy players', 2500, 0, 'dust2/points_favor'),
(16, 'You''ve Made Your Points', 'Inflict 50,000 total points of damage to enemy players', 50000, 0, 'dust2/made_points'),
(17, 'Street Fighter', 'Kill 25 enemies with an knife', 25, 5, 'dust2/street_fighter'),
(18, 'Hat Trick', 'Get 3 headshots in a row', 1, 0, 'dust2/hat_trick'),
(19, 'Bunny Hunt', 'Kill an airborne enemy', 1, 0, 'dust2/bunny_hunt'),
(20, 'Ammo Conservation', 'Kill two enemy players with a single bullet', 1, 0, 'dust2/ammo_con'),
(21, 'War Bonds', 'Earn $125,000 total cash', 125000, 31250, 'dust2/war_bonds'),
(22, 'Premature Burial', 'Kill an enemy with a grenade after you''ve died', 1, 0, 'dust2/burial'),
(23, 'Blind Ambition', 'Kill a total of 25 enemy players blinded by flashbangs', 25, 5, 'dust2/blind_ambition'),
(24, 'Defuse This!', 'Kill the defuser with an HE grenade', 1, 0, 'dust2/defuse_this'),
(25, 'Shrapnelproof', 'Take 80 points of damage from enemy grenades and still survive the round', 1, 0, 'dust2/shrapnelproof'),
(26, 'Blind Fury', 'Kill an enemy player while you are blinded from a flashbang', 1, 0, 'dust2/blind_fury'),
(27, 'Addict', 'Join to the server 500 times', 500, 0, 'dust2/addict'),
(28, 'Play Around', 'Spent 1 hour playing on the server', 1, 0, 'dust2/play_around'),
(29, 'Day Marathon', 'Spent 1 day playing on the server', 1, 0, 'dust2/day_marathon'),
(30, 'Golden Medal', 'Achieve 25 of the achievements', 1, 0, 'dust2/golden_medal'),
(31, 'Second to None', 'Successfully defuse a bomb with less than one second remaining', 1, 0, 'dust2/second_to_none'),
(32, 'The Hard Way', 'Kill two enemy players with a single grenade', 1, 0, 'dust2/hard_way'),
(33, 'Blast Will and Testament', 'Win 10 rounds by planting a bomb', 10, 0, 'dust2/blast_will'),
(35, 'Candy Coroner', 'Placeholder', 20, 5, 'jail/special_candy'),
(36, 'Short Fuse', 'Plant a bomb within 25 seconds', 1, 0, 'dust2/short_fuse'),
(37, 'Leone Gauge Super Expert', 'Kill 25 enemy players with the Leone 12 Gauge Super', 25, 5, 'dust2/shotgun1'),
(38, 'Leone Auto Shotgun Expert', 'Kill 25 enemy players with the Leone YG1265 Auto Shotgun', 25, 5, 'dust2/shotgun2'),
(39, 'Shotgun Master', 'Unlock both shotgun kill achievements', 1, 0, 'dust2/shotgun_master'),
(40, 'KM Tactical .45 Expert', 'Kill 75 enemy players with the KM Tactical .45 <i>(USP)</i>', 75, 25, 'dust2/pistol_usp'),
(41, '9x19 Sidearm Expert', 'Kill 75 enemy players with the 9x19 Sidearm <i>(Glock)</i>', 75, 25, 'dust2/pistol_glock'),
(42, 'Night Hawk .50c Expert', 'Kill 50 enemy players with the Night Hawk .50c <i>(Deagle)</i>', 50, 10, 'dust2/pistol_deagle'),
(43, '.40 Dual Elites Expert', 'Kill 25 enemy players with the .40 Dual Elites', 25, 5, 'dust2/pistol_elites'),
(44, 'ES Five-Seven Expert', 'Kill 25 enemy players with the ES Five-Seven', 25, 5, 'dust2/pistol_fiveseven'),
(45, '228 Compact Expert', 'Kill 25 enemy players with the 228 Compact', 25, 5, 'dust2/pistol_compact'),
(46, 'Serial Killer', 'Acquire 30 kills before map change', 1, 0, 'dust2/serial_killer'),
(47, 'Maverick M4A1 Carbine Expert', 'Kill 100 enemy players with the Maverick M4A1 Carbine', 100, 25, 'dust2/weapon_m4a1'),
(48, 'AK-47 Expert', 'Kill 100 enemy players with the AK-47', 100, 25, 'dust2/weapon_ak47'),
(49, 'Magnum Sniper Rifle Expert', 'Kill 50 enemy players with the Magnum Sniper Rifle', 50, 10, 'dust2/weapon_awp'),
(50, 'Schmidt Scout Expert', 'Kill 25 enemy players with the Schmidt Scout', 25, 5, 'dust2/weapon_scout'),
(51, 'Clarion 5.56 Expert', 'Kill 50 enemy players with the Clarion 5.56', 50, 10, 'dust2/weapon_famas'),
(52, 'IDF Defender Expert', 'Kill 25 enemy players with the IDF Defender', 25, 5, 'dust2/weapon_galil'),
(53, 'KM Sub-Machine Gun Expert', 'Kill 50 enemy players with the KM Sub-Machine Gun', 50, 10, 'dust2/weapon_mp5');

INSERT INTO `Hns_Achievements` (`Id`, `Name`, `Description`, `NeededToGain`, `ProgressModule`, `Icon`) VALUES
(1, 'Catch me if you can', 'Survive 50 rounds as a Terrorist', 50, 10, 'hns/catch_me'),
(2, 'Far, far away', 'Walk 10000 meters', 10000, 2500, 'hns/far_far'),
(3, 'Air Show', 'Kill 50 enemies while they are in air', 50, 10, 'hns/air_show'),
(4, 'Blind Ambition', 'Kill 5 Terrorists while they are fully flashed', 5, 0, 'hns/blind_ambition'),
(5, 'Double Cross', 'Kill 2 Terrorists in 2 seconds or less', 1, 0, 'hns/double_cross'),
(6, 'Ladderlicious', 'Kill 15 Terrorists while they are on a ladder', 15, 5, 'hns/ladderlicious'),
(7, 'Does It Hurt When I Do This?', 'Get killed 100 times by environmental damage', 100, 25, 'hns/does_it_hurt'),
(8, 'Your Experience', 'Kill 500 Terrorists', 500, 125, 'hns/your_experience'),
(9, 'No Hard Feelings', 'Kill 15 Counter-Terrorists with a grenade', 15, 5, 'hns/no_hard_feelings'),
(10, 'Urban Designer', 'Spray 100 decals', 100, 25, 'hns/urban_designer'),
(11, 'Who Cares? They''re dead!', 'Spray 15 decals on dead bodies of Counter-Terrorists', 15, 5, 'hns/who_cares'),
(12, 'Eviction Notice', 'Get 3 headshots in a row', 1, 0, 'hns/eviction_notice'),
(13, 'Wounded But Steady', 'Survive a round while having 1 HP left', 1, 0, 'hns/wounded'),
(14, 'Against The Odds', 'Survive a round against 3 or more Counter-Terrorists', 1, 0, 'hns/against_the_odds'),
(15, 'Still Alive', 'Survive 10 rounds before a map change', 1, 0, 'hns/still_alive'),
(16, 'Super Mario Brothers', 'Make 2000 jumps before map change', 1, 0, 'hns/super_mario'),
(17, 'Old School', 'Make a edgebug and jumpbug in same round', 1, 0, 'hns/old_school'),
(18, 'Asking for Trouble', 'Make a edgebug from a height of 1000 units while at 1 HP', 1, 0, 'hns/asking_for_trouble'),
(19, 'Basic Science', 'Make a edgebug from a height of 1500 or higher', 1, 0, 'hns/basic_science'),
(20, 'Edgebug Veteran', 'Perform 25 successful edgebugs', 25, 5, 'hns/eb_veteran'),
(21, 'New Innovation', 'Make a double edgebug', 1, 0, 'hns/new_innovation'),
(22, 'Double Edgebug Veteran', 'Perform 10 successful double edgebugs', 10, 0, 'hns/dbl_eb_veteran'),
(23, 'Preservation of Mass', 'Make a jumpbug while at 1 HP', 1, 0, 'hns/preservation'),
(24, 'Pit Boss', 'Make a jumpbug', 1, 0, 'hns/pit_boss'),
(25, 'Jumpbug Veteran', 'Perform 25 successful jumpbugs', 25, 5, 'hns/jb_veteran'),
(26, 'Serial Killer', 'Acquire 30 kills before map change', 1, 0, 'hns/serial_killer'),
(27, 'Party of Three', 'Acquire 3 kills within 60 seconds after round start', 1, 0, 'hns/party_of_three'),
(28, 'Take No Prisoners', 'Get 5 kills in single round', 1, 0, 'hns/take_no_prisoners'),
(29, 'Vertically Unchallenged', 'Kill 5 Terrorists that are on ladder, while you are in air', 5, 0, 'hns/unchallenged'),
(30, 'Potato Layer', 'Throw 1000 grenades', 1000, 250, 'hns/potato_layer'),
(31, 'Stranger Than Friction', 'Get prestrafe speed of 299 on bhop and successfully make the jump', 1, 0, 'hns/strange_friction'),
(32, 'Count Jump', 'Jump 260 countjump 5 times', 5, 0, 'hns/count_jump'),
(33, 'Long Jump', 'Jump 250 longjump 5 times', 5, 0, 'hns/long_jump'),
(34, 'Bhop Jump', 'Jump 240 bhopjump 5 times', 5, 0, 'hns/bhop_jump'),
(35, 'Triple Crown', 'Unlock 3 achievements: Count Jump, Long Jump and Bhop Jump', 3, 0, 'hns/triple_crown'),
(36, 'Addict', 'Join to the server 500 times', 500, 125, 'hns/addict'),
(37, 'Play Around', 'Spent 1 hour playing on server', 1, 0, 'hns/play_around'),
(38, 'Day Marathon', 'Spent 1 day playing on server', 1, 0, 'hns/day_marathon'),
(39, 'Gift Grab 2011 - HideNSeek', 'Collect seven gifts dropped by opponents', 7, 1, 'jail/giftgrab');

INSERT INTO `Jail_Achievements` (`Id`, `Name`, `Description`, `NeededToGain`, `ProgressModule`, `Icon`) VALUES
(1, 'Rebel', 'Kill 100 Guards as Prisoner', 100, 25, 'jail/rebel'),
(2, 'Assassin', ' Kill 25 guards with a knife headshot', 25, 5, 'jail/assassin'),
(3, 'Shit Police!', 'Poop 100 times', 100, 25, 'jail/shit_police'),
(4, 'Desecrate the Dead', 'Piss 100 times on the floor or corpses', 100, 25, 'jail/piss'),
(5, 'Duel King', 'Win 25 Last Request games', 25, 5, 'jail/duel_king'),
(6, 'Dealer', 'Find 100 weapons as prisoner', 100, 25, 'jail/dealer'),
(7, 'Survivor', 'Be the last prisoner for 30 rounds', 30, 10, 'jail/survivor'),
(8, 'Shot Dueler', 'Start 25 "Shot to Shot fights"', 25, 5, 'jail/shot_to_shot'),
(9, 'Shiny knife', 'Start 50 knife duels', 50, 10, 'jail/shiny_knife'),
(10, 'Addict', 'Join to server 500 times', 500, 125, 'jail/addict'),
(11, 'GET OUT OF MY WAY!', 'Kill 20 enemies using a car', 20, 5, 'jail/get_out_of_my_way'),
(12, 'Urban designer', 'Spray 300 decals.', 300, 75, 'jail/urban_designer'),
(13, 'Danger Close', 'Kill 25 guards with a granade', 25, 5, 'jail/danger_close'),
(14, 'Drunk Driver', 'Crush 20 team mates while driving a car', 20, 5, 'jail/drunk_driver'),
(15, 'Gravity Junkie', 'Win 100 spray contests', 100, 25, 'jail/gravity_junkie'),
(16, 'Pro Assassin', 'Win 100 knife battles', 100, 25, 'jail/pro_assassin'),
(17, 'W...Whatz Up?!', 'Kill atleast one Guard while flashed as Prisoner', 1, 0, 'jail/whatz_up'),
(19, 'Victory', 'Win a round as Guard without any guards dying <b>(atleast 3 Guards required)</b>', 1, 0, 'jail/victory'),
(20, 'Three-some', 'Kill 3 Guards in a single life', 1, 0, 'jail/three-some'),
(21, 'Kid with gun', 'Kill 25 Guards with a TMP', 25, 5, 'jail/kid_with_gun'),
(22, 'Blabla', 'BLABLA', 1, 0, 'jail/blabla'),
(23, 'Ghost Sniper', 'Kill 10 Guards with a AWP', 10, 0, 'jail/ghost_sniper'),
(24, 'Play Around', 'Spent 1 hour playing on server', 1, 0, 'jail/play_around'),
(25, 'Day Marathon', 'Spent 1 day playing on server', 1, 0, 'jail/day_marathon'),
(26, 'Michael Scofield', 'Press secret button after secret longjump on jail_ms_shawshank', 1, 0, 'jail/scotfield'),
(27, 'Vandalism', 'Destroy 200 objects on map', 200, 50, 'jail/vandalism'),
(28, 'High Tension', 'Score 50 goals', 50, 10, 'jail/high_tension'),
(29, 'Golden Foot', 'Score a goal from a distance of 2000 units', 1, 0, 'jail/golden_foot'),
(30, 'Silver Foot', 'Score a goal from a distance of 1750 units', 1, 0, 'jail/silver_foot'),
(31, 'Rocky Balboa', 'Kill 50 guards while in rambo mode', 50, 5, 'jail/rocky'),
(32, 'Outlaw Prestige', 'Earn all achievements', 1, 0, 'jail/prestige'),
(33, 'Get out of my yard, boy!', 'Kill 25 guards with shotgun', 25, 5, 'jail/my_yard'),
(34, 'Zeus', 'Kill Rambo 5 times', 5, 0, 'jail/zeus'),
(35, 'Graffiti is my second name', 'Spray 8 times in one round', 1, 0, 'jail/graffity'),
(36, 'Candy Coroner', 'Collect 40 Halloween pumpkins from dead players to unlock a hat <b>(Not Available)</b>', 40, 5, 'jail/special_candy'),
(37, 'Masked Mann', 'Collect 5 secret presents dropped randomly on the map <b>(Not Available)</b>', 5, 0, 'jail/present'),
(38, 'Santa''s Little Helper', 'Find five presents that Santa lost while travelling <b>(Not Available)</b>', 5, 1, 'drun/winter'),
(39, 'Sandbag', 'Suffer 10000 Total points of damage', 10000, 0, 'jail/sandbag'),
(40, 'Fyi I Am A Spy', 'Kill 10 guards while they can''t see you', 10, 0, 'jail/spy'),
(41, 'Medical Intervention', 'Heal yourself for total of 10000 HP', 10000, 2500, 'jail/medical'),
(42, 'Surgical Prep', 'Get yourself total of 1000 armor points using wall rechargers', 1000, 250, 'jail/surgical'),
(43, 'Agent Provocateur', 'Win a round as a Prisoner before time hits 4:30 <b>(atleast 3 Guards required)</b>', 1, 0, 'jail/agent_prov'),
(44, 'Preventive Medicine', 'Kill a Guard while he is healing himself', 1, 0, 'jail/preventive'),
(45, 'Football Star', 'Score 20 goals while all CTs are dead', 20, 5, 'jail/footballstar'),
(46, 'No guards in pool!', 'Kill 5 guards as T while they are in pool', 5, 0, 'jail/nopool'),
(47, 'Say hello to my little friend', 'Kill 25 guards with deagle', 25, 5, 'jail/littlefriend'),
(48, 'Specialist', 'Kill 10 guards in one map', 1, 0, 'jail/specialist'),
(49, 'Does It Hurt When I Do This?', 'Get killed 100 times by environmental damage', 100, 25, 'jail/doithurt'),
(50, 'Drive This!', 'Kill 20 guards while they are driving a vehicle', 20, 5, 'jail/drivethis'),
(51, 'Now the art is better!', 'Kill a guard standing on his own spray', 1, 0, 'jail/artisbetter'),
(52, 'Caught with your pants down', 'Kill a CT that recently made a dookie or a piss', 1, 0, 'jail/pantsdown'),
(53, 'Hard work pays off', 'Get last request while being on 1HP', 1, 0, 'jail/hardwork'),
(54, 'hu?..Freeday?', 'Walk 25000 meters', 25000, 6250, 'jail/freeday'),
(55, 'That was Tasty!', 'Kill 5 guards when you have walked less than 12 meters after spawning', 5, 1, 'jail/tasty'),
(56, 'The Melbourne Supremacy', 'Kill 50 guards with your bare hands <b>(This achievement will grant you access to old knife skin)</b>', 50, 10, 'jail/melbourne'),
(57, 'Gift Grab 2011 - JailBreak', 'Collect seven gifts dropped by opponents', 7, 1, 'jail/giftgrab');

INSERT INTO `Knife_Achievements` (`Id`, `Name`, `Description`, `NeededToGain`, `ProgressModule`, `Icon`) VALUES
(1, 'Medic is useless!', 'Kill 50 enemies on 100hp map', 50, 10, 'knife/medicisuseless'),
(2, 'Urban designer', 'Spray 300 decals.', 300, 75, 'knife/urban'),
(3, 'Players can''t fly!', ' Kill 50 enemies while they are in air', 50, 10, 'knife/cantfly'),
(4, 'Run forest run!', 'Walk 25000 meters.', 25000, 6250, 'knife/runforestrun'),
(5, '1 HP Star', 'Kill 1000 enemies on 1HP Map', 1000, 250, 'knife/1hpstar'),
(6, 'Keep It Clean', 'Kill 100 enemies', 100, 25, 'knife/knifer'),
(7, 'Crazy Knifer', 'Kill 255 enemies', 255, 85, 'knife/crazy'),
(8, 'Enemie Humiliate', 'Spray decal on the your killing person 100 times.', 100, 25, 'knife/humiliate'),
(9, 'Longarm!', 'Kill a enemie with 31-32m Stab 15 times', 15, 5, 'knife/longarm'),
(11, '1 HP Hero', 'Kill enemy while having 1 HP', 1, 0, 'knife/1hp'),
(12, 'Pyromancer', 'Make 10,000 points of total damage', 10000, 2500, 'knife/pyromancer'),
(13, 'Pro Knifer', 'Kill 5 enemys in one round with headshot.', 1, 0, 'knife/pro_knifer'),
(14, 'Jesus', 'Spent 100 enemys freehits', 100, 25, 'knife/jesus'),
(15, 'Vandalism', 'Destroy 100 objects on map', 100, 25, 'knife/vandalism'),
(16, 'Sneaky', ' Kill 50 players while they dont see you', 50, 10, 'knife/sneaky'),
(17, 'Addict', 'Join to server 500 times', 500, 125, 'knife/addict'),
(18, 'Play Around', 'Spent 1 hour playing on server', 1, 0, 'knife/playaround'),
(19, 'Day Marathon', 'Spent 1 day playing on server', 1, 0, 'knife/daymarathon'),
(22, 'Yes, Sensei!', 'Kill a enemie with 31-21m Stab 100 times', 100, 25, 'knife/fucking'),
(23, 'Oldsql Knifer', 'Kill 100 Enemies with CS 1.5 Knife', 100, 25, 'knife/oldsql'),
(24, 'Third-Person', 'Kill 25 enemies with 3rd-view', 25, 5, 'knife/3rd');

Table should look like this:

'Id' 'Name' 'Description' 'NeededToGain'

Hope your understood. Not going to stop tryin' myself. Thanks!

Airkish
12-20-2016, 15:18
up

Agression Terrpr
12-27-2016, 13:13
up

Airkish
01-10-2017, 16:35
BUMP

Airkish
02-11-2017, 11:23
BUMP

Adryyy
02-13-2017, 04:49
I use this plugin, and have some problems(in code), but can fix easy, and work great!
You can search on google, tutorials, like 'how i can create php based on db reading data'
xPaw i don't know why not posted .php(his website is...)

You can trie


<?php
$dbhost = 'DB_IP:3306';
$dbuser = 'DB USER';
$dbpass = 'DB PASS';

$conn = mysql_connect($dbhost, $dbuser, $dbpass);

if(! $conn ) {
die('Could not connect: ' . mysql_error());
}

$sql = 'SELECT steamid FROM GlobalPlayers';
mysql_select_db('DB NAME');
$retval = mysql_query( $sql, $conn );

if(! $retval ) {
die('Could not get data: ' . mysql_error());
}

while($row = mysql_fetch_assoc($retval, MYSQL_NUM)) {
echo "STEAM ID :{$row['steamid']} <br> ".
"--------------------------------<br>";
}

echo "Fetched data successfully\n";

mysql_close($conn);
?>

Airkish
02-13-2017, 08:27
I use this plugin, and have some problems(in code), but can fix easy, and work great!
You can search on google, tutorials, like 'how i can create php based on db reading data'
xPaw i don't know why not posted .php(his website is...)

You can trie


<?php
$dbhost = 'DB_IP:3306';
$dbuser = 'DB USER';
$dbpass = 'DB PASS';

$conn = mysql_connect($dbhost, $dbuser, $dbpass);

if(! $conn ) {
die('Could not connect: ' . mysql_error());
}

$sql = 'SELECT steamid FROM GlobalPlayers';
mysql_select_db('DB NAME');
$retval = mysql_query( $sql, $conn );

if(! $retval ) {
die('Could not get data: ' . mysql_error());
}

while($row = mysql_fetch_assoc($retval, MYSQL_NUM)) {
echo "STEAM ID :{$row['steamid']} <br> ".
"--------------------------------<br>";
}

echo "Fetched data successfully\n";

mysql_close($conn);
?>


This will only print steamid.

What I need is that every player could lookup their own achievements.

Adryyy
02-14-2017, 06:33
Understund..Send mail or message to xpaw
I tried to do with xpaw steamid.php and db lookup but getaccountid of steamid.php not working