So I'm new to MySQL (and MySQLOO for gmod) and I'm writing up an addon that will utilize this. It syncs bans between servers, using a MySQL database. Let's say for example, my script runs a query:
"SELECT * FROM bsync_bans WHERE steamid = %s"
(The query is then string.format'd with the player's SID)
Table setup:
[[
CREATE TABLE IF NOT EXISTS bsync_bans(
steamid VARCHAR( 255 ) NOT NULL,
nick VARCHAR( 255 ) NOT NULL,
admin VARCHAR( 255 ) NOT NULL,
unban VARCHAR( 255 ) NOT NULL,
reason VARCHAR( 255 ) NOT NULL,
time VARCHAR( 255 ) NOT NULL,
PRIMARY KEY ( steamid )
)
]]
So let's say for example a player joins. A PlayerInitialSpawn hook checks if the player is in the database anywhere, and if they are, it will ban them. But if they aren't, will the query throw an error, or throw an empty table? I assume that it would throw an error, but I haven't had a chance to test it myself yet, but I'm going to do so in a few hours once I have the chance.