PDA

View Full Version : Last Seen v0.1 (5/21)


FLOOR_MASTER
05-22-2008, 00:57
Last Seen allows you to easily find out when a player was last on the server or any number of servers if using a common database. Last Seen is compatible with both MySQL and SQLite, but you will naturally only be able to use the multi-server search functionality with MySQL.

In the simplest case, Last Seen can tell you when a particular player was last on the server...
http://www.2fort2furious.com/images/lastseen_simple.png

http://www.2fort2furious.com/images/lastseen_simple2.png


Last Seen handles multiple matches by displaying them most recently seen first:
http://www.2fort2furious.com/images/lastseen_multi.png

http://www.2fort2furious.com/images/lastseen_multi2.png

Last Seen can display matches that were on a different server:
http://www.2fort2furious.com/images/lastseen_diffip.png

Configuration

seen_db_config (default "default")
Specifies what configuration in addons/sourcemod/configs/database.cfg to use to connect to a MySQL or SQLite DB.
seen_table (default "last_seen")
The name of the database table to store Last Seen data in. If you run multiple servers, you may want to change this for different game types or for individual servers, depending on whether you servers share databases and whether you want Last Seen data shared across multiple servers.

Commands

!seen <partial name match>
As shown in the above screenshots, display when the specified player was last seen

Version History

2008-05-21 - v0.1
Initial release


Installation
Copy seen.smx to addons/sourcemod/scripting
You do not need seen.inc unless you are developing plugins that use natives Last Seen provides.

FLOOR_MASTER
05-22-2008, 00:57
For plugin developers...

Natives
GetNameFromAuthString(const String:auth[], GetNameFromAuthStringCallback:callback, any:data=0)
From a SteamID, lookup the most recently used name and return the data to the specified callback function. See seen.inc for more details. Here's an example plugin:

#include <sourcemod>
#include <seen>

public Plugin:myinfo = {
name = "Name",
author = "Author",
description = "Description",
version = "0.0.0.0",
url = "Internet"
};

public OnPluginStart() {
RegConsoleCmd("sm_lookup_name", Cmd_Lookup);
}

public Action:Cmd_Lookup(client, args) {
decl String:arg[32];

if (!args) {
ReplyToCommand(client, "usage: sm_lookup_name <steamid>");
return Plugin_Handled;
}

GetCmdArgString(arg, sizeof(arg));
GetNameFromAuthString(arg, CB_GotNameFromAuthString);

return Plugin_Handled;
}

public CB_GotNameFromAuthString(bool:result, const String:steamid[], const String:name[]) {
if (result) {
PrintToServer("For steamid \"%s\", found name \"%s\"", steamid, name);
}
else {
PrintToServer("Could not find a name for steamid \"%s\"", steamid);
}
}

LocutusH
05-22-2008, 02:30
Can you somehow code it, that the information is taken from the hlstatsx database? Since thats also logging this info.

Fredd
05-22-2008, 11:35
FLOOR_MASTER: look good, but i suggest you use clientprefs.....

FLOOR_MASTER
05-22-2008, 15:55
I considered it but it seemed unsuitable because, from my understanding of clientprefs, clientprefs is more suited for accessing data on clients that are presently connected to the server. Last Seen's key feature is finding information about offline clients. Also, due to the lookup features I've added (lookup name for SteamID, independent of who is connected to the server) and plan to add, searching for the appropriate data through clientprefs is either grossly inefficient or impossible.

DontWannaName
05-23-2008, 03:36
If only forums had a last seen option... lol :P What is with all these mysql plugins... :D Hlstatsx does this too.

FLOOR_MASTER
05-24-2008, 08:49
Is that information provided in-game? I'm not too familiar with the full-featured stats packages so any feature overlap is not intentional (I simply sought to write a plugin that suited my needs and share it in case someone else had some utility for it).

I did just now find out about the Last Connect History plugin which provides similar functionality. I'd note that Last Seen is more useful from a usability standpoint in that you can lookup players by name rather than SteamID. Last Seen also supports server-spanning lookups which is useful for larger communities.

DontWannaName
05-24-2008, 15:37
Not bashing you, im sure people would use this. Online it tells you on hlstatsx when the player last joined the server.

bl4nk
05-24-2008, 15:41
People don't always want all of the features of HLStatsX. It's nice if you just want this feature, but don't want everything that HLStatsX has to offer.

tcviper
05-26-2008, 05:11
:)

NedStar
05-26-2008, 07:52
Useful will be using this.

bl1nk123
06-27-2008, 23:53
Simple suggestion: Make it so it also stores the total time that the play has be connected to the server.

Great so far!

cybersquare420
04-16-2009, 14:59
this will prove useful in our community to combat griefers that change their names to hide their identity after some asshatery or another.

that said, it would be nice if it maintained its table size by dropping the player's record after a configurable amount of time... say 90 days or something...
thanx for your great work!!

IronWarrior
06-09-2010, 08:43
Would this work for L4D2?

ALKINDA
10-15-2013, 17:32
I dont know whats causing this error.

Csgo SM 1.6 4118
L 10/15/2013 - 15:46:56: [seen.smx] FATAL: Could not create table last_seen.
L 10/15/2013 - 15:46:56: [SM] Plugin encountered error 25: Call was aborted
L 10/15/2013 - 15:46:56: [SM] Native "SetFailState" reported: Could not create table last_seen.
L 10/15/2013 - 15:46:56: [SM] Displaying call stack trace for plugin "seen.smx":
L 10/15/2013 - 15:46:56: [SM] [0] Line 230, /home/groups/alliedmodders/forums/files/3/6/0/2/6/26847.attach::ConnectDB()
L 10/15/2013 - 15:46:56: [SM] [1] Line 88, /home/groups/alliedmodders/forums/files/3/6/0/2/6/26847.attach::OnConfigsExecuted