AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Request] So cool script . Can anyone teach ? (https://forums.alliedmods.net/showthread.php?t=275527)

parerak 12-02-2015 08:06

[Request] So cool script . Can anyone teach ?
 
Can anyone tell how to do it ?

Admin last seen : http://128.199.72.136/index.php

Anyone know is it a script of something else ?

I need it badly :grrr:

Server IP is : 128.199.72.136:33333

ironskillz1 12-03-2015 17:16

Re: [Request] So cool script . Can anyone teach ?
 
Quote:

Originally Posted by parerak (Post 2368137)
Can anyone tell how to do it ?

The plugin is most likely not public.

Anyways it saves the admins data in a SQL and prints it out in the website using basic PHP code.

milutinke 12-04-2015 10:24

Re: [Request] So cool script . Can anyone teach ?
 
I will make it for personal usage but i will share it on forum

milutinke 12-06-2015 18:00

Re: [Request] So cool script . Can anyone teach ?
 
Can someone test it, i wrote this using my mobile phone :P

AMXX:
PHP Code:

#include < amxmodx >
#include < sqlx >

enum _:StructPlayerInfo {
    
g_szSteamID32 ],
    
g_szName32 ],
    
g_szIp20 ],
    
    
g_iPlayerId,
    
g_iPlayedTime
}

enum _:StructCvars {
    
g_szCvarHost,
    
g_szCvarUser,
    
g_szCvarPwd,
    
g_szCvarDb
}

new 
g_szCvarsStructCvars ][ ][ ] = {
    
//  Name            Value
    
{    "aat_host",        "localhost"  },
    {     
"aat_user",        "root"        },
    {    
"aat_pwd",        "root"        },
    {     
"aat_db",        "root"        }
};

new 
g_szCvarDataStructCvars ][ 64 ];
new 
g_iCvarDataStructCvars ];
new 
Handleg_hSqlConnection;
new 
g_iMaxPlayers;

new 
g_PlayerInfo33 ][ StructPlayerInfo ];

public 
plugin_init( ) {
    
register_plugin"Admin Activity Tracker""1.0""Milutinke (ByM)" );
    
    
g_iMaxPlayers get_maxplayers( );
    
    for( new 
0sizeofg_szCvars[ ] ); i++ ) {
        
g_iCvarData] = register_cvarg_szCvars][ ], g_szCvars][ ] );
        
get_cvar_stringg_iCvarData], g_szCvarData], charsmaxg_szCvarData[ ] ) );
    }
    
    
g_hSqlConnection SQL_MakeDbTupleg_szCvarDatag_szCvarHost ], g_szCvarDatag_szCvarUser ], g_szCvarDatag_szCvarPwd ], g_szCvarDatag_szCvarDb ] );
}

public 
plugin_end( ) {
    
SQL_FreeHandleg_hSqlConnection );
}    

public 
client_putinserveriPlayer ) {
    if( 
is_user_botiPlayer ) )
        return;
        
    
get_user_authidiPlayerg_PlayerInfoiPlayer ][ g_szSteamID ], charsmaxg_PlayerInfo[ ][ g_szSteamID ] ) );
    
get_user_nameiPlayerg_PlayerInfoiPlayer ][ g_szName ], charsmaxg_PlayerInfo[ ][ g_szName ] ) );
    
get_user_ipiPlayerg_PlayerInfoiPlayer ][ g_szIp ], charsmaxg_PlayerInfo[ ][ g_szIp ] ), );
    
    
PlayerHasConnectediPlayer );
}

public 
client_disconnectiPlayer ) {
    if( 
is_user_botiPlayer ) )
        return;
        
    
PlayerHasDisconnectediPlayer );
}

public 
PlayerHasConnectediPlayer ) {
    if( !
is_user_connectediPlayer ) || !( <= iPlayer <= g_iMaxPlayers ) )
        return;
        
    new 
szQuery128 ];
    
formatexszQuerycharsmaxszQuery ), "SELECT `Id`, `PlayedTime` FROM `aatdb` WHERE `SteamID` = '%s'"g_PlayerInfoiPlayer ][ g_szSteamID ] );
    
    new 
iData];
    
iData] = iPlayer;
    
    
SQL_ThreadQueryg_hSqlConnection"HandlePlayerConnect"szQueryiData);
}

public 
HandlePlayerConnectiFailStateHandlehQueryszError[ ], iErroriData[ ], iSizeFloatflQueueTime ) {
    if( 
SQL_IsFailiFailStateiErrorszError ) ) {
        return;
    }
    
    new 
iPlayer iData];
    if( !
is_user_connectediPlayer ) || !( <= iPlayer <= g_iMaxPlayers ) )
        return;
    
    if( 
SQL_NumResultshQuery ) ) {
        
g_PlayerInfoiPlayer ][ g_iPlayerId ] = SQL_ReadResulthQuery);
        
g_PlayerInfoiPlayer ][ g_iPlayedTime ] = SQL_ReadResulthQuery);
        
        
SQL_QueryMe_"UPDATE `aatdb` SET `Online` = '1', `Nick` = '%s', `Ip` = '%s' WHERE `Id` = '%d'"g_PlayerInfoiPlayer ][ g_szName ], g_PlayerInfoiPlayer ][ g_szIp ], g_PlayerInfoiPlayer ][ g_iPlayerId ] );
    }
    else {
        new 
szQuery128 ], szDate32 ];
        
get_time"%m.%d.%Y - %H:%M"szDatecharsmaxszDate ) );
        
        
formatexszQuerycharsmaxszQuery ), "INSERT INTO `aatdb` (`SteamID`, `LastConnection`, `Nick`, `Ip`, `Online`, `PlayedTime`) VALUES ('%s', '%s', '%s', '%s', '1', '0')"g_PlayerInfoiPlayer ][ g_szSteamID ], szDateg_PlayerInfoiPlayer ][ g_szName ], g_PlayerInfoiPlayer ][ g_szIp ] );
        
        
SQL_ThreadQueryg_hSqlConnection"HandlePlayerInsert"szQueryiData);
    }
}

public 
HandlePlayerInsertiFailStateHandlehQueryszError[ ], iErroriData[ ], iSizeFloatflQueueTime ) {
    if( 
SQL_IsFailiFailStateiErrorszError ) ) {
        return;
    }
    
    new 
iPlayer iData];
    if( !
is_user_connectediPlayer ) || !( <= iPlayer <= g_iMaxPlayers ) )
        return;
        
    
g_PlayerInfoiPlayer ][ g_iPlayerId ] = SQL_GetInsertIdhQuery );
    
g_PlayerInfoiPlayer ][ g_iPlayedTime ] = 0;
}

public 
PlayerHasDisconnectediPlayer ) {
    
SQL_QueryMe_"UPDATE `aatdb` SET `PlayedTime` = '%d', `Score` = '%d', `Online` = '0' WHERE `Id` = '%d'"get_user_timeiPlayer ) + g_PlayerInfoiPlayer ][ g_iPlayedTime ], get_user_fragsiPlayer ), g_PlayerInfoiPlayer ][ g_iPlayerId ] );
}

//Following code is taken from xPawn plugins (Saved 5 minute of work xD)
public HandleQueryiFailStateHandlehQueryszError[ ], iErrorszData[ ], iSizeFloatflQueueTime ) {
    
SQL_IsFailiFailStateiErrorszError );
}

SQL_QueryMeszHandle[ ] = "HandleQuery", const szQuery[ ], any:... ) {
    new 
szMessage256 ];
    
vformatszMessage255szQuery);
    
    
SQL_ThreadQueryg_hSqlConnectionszHandleszMessage );
}

stock boolSQL_IsFail( const iFailState, const iError, const szError[ ] ) {
    if( 
iFailState == TQUERY_CONNECT_FAILED ) {
        
server_print"[ByM] Could not connect to SQL database: %s"szError );
        
log_to_file"SQL_Error.txt""[ByM] Could not connect to SQL database: %s"szError );
        return 
true;
    }
    else if( 
iFailState == TQUERY_QUERY_FAILED ) {
        
server_print"[ByM] Query failed: (%i) %s"iErrorszError );
        
log_to_file"SQL_Error.txt""[ByM] Could not connect to SQL database: %s"szError );
        return 
true;
    }
    
    return 
false;


SQL:
Code:

CREATE TABLE IF NOT EXISTS `aatdb` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `SteamID` varchar(32) NOT NULL DEFAULT '',
  `Nick` varchar(64) NOT NULL DEFAULT '',
  `Ip` varchar(32) NOT NULL DEFAULT '',
  `Online` int(11) NOT NULL DEFAULT '0',
  `PlayedTime` int(11) NOT NULL DEFAULT '0',
  `LastConnection` varchar(64) NOT NULL DEFAULT '',
  `Score` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`Id`),
  UNIQUE KEY `SteamID` (`SteamID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;


Bugsy 12-06-2015 18:32

Re: [Request] So cool script . Can anyone teach ?
 
Wrote that on your phone? Why would you bother, just wait until you get behind a pc lol

fysiks 12-06-2015 22:21

Re: [Request] So cool script . Can anyone teach ?
 
I don't believe the claim unless it took hours to do it.

Darkness_ 12-07-2015 03:15

Re: [Request] So cool script . Can anyone teach ?
 
I'd rather take 2 consecutive SAT's than type all of that on my phone - there's just no way anyone would do that for someone on the forums.

Depresie 12-07-2015 05:09

Re: [Request] So cool script . Can anyone teach ?
 
lol, when the crazinnes will stop on this forum...

milutinke 12-07-2015 14:40

Re: [Request] So cool script . Can anyone teach ?
 
http://i.pics.rs/1R6By

Most of the time I am bored at school, so i usualy write plugins.
Half of my plugins are written on my phone xD
By the way credits to xPawn for stocks: SQL_QueryMe and SQL_IsFail (Saved me 5 minutes of work xD)

@Darkness_: I need tis plugin too so i wrote it :)

baneado 12-07-2015 16:17

Re: [Request] So cool script . Can anyone teach ?
 
What's the app are you using?

Anyways, I think you need help for web script, right?


All times are GMT -4. The time now is 04:25.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.