GetPlayerHardware
The parts of the player’s PC by name - for a database with a column per part.
The parts of GetPlayerHwid in a table: system, board, disk and machine, each 16 hex digits. A part the PC has
no value for is left out (nil). With a column per part a ban list is searched by the database itself
(WHERE system = @s OR disk = @d ...) instead of a loop over every ban.
Syntax
Section titled “Syntax”GetPlayerHardware(pid)| Parameter | Type | |
|---|---|---|
pid |
number | the player |
Returns
Section titled “Returns”table | nil - { system = ..., board = ..., disk = ..., machine = ... } (the parts the PC has); nil when their game sent none
Example
Section titled “Example”-- a ban table with a column per part (a part the PC had none of stored as NULL): two shared parts = the same PClocal hw = GetPlayerHardware(pid)if hw then db:Query([[SELECT reason FROM banned_pcs WHERE (CASE WHEN system = @s THEN 1 ELSE 0 END) + (CASE WHEN board = @b THEN 1 ELSE 0 END) + (CASE WHEN disk = @d THEN 1 ELSE 0 END) + (CASE WHEN machine = @m THEN 1 ELSE 0 END) >= 2]], { s = hw.system or "-", b = hw.board or "-", d = hw.disk or "-", m = hw.machine or "-" }, function(rows) if rows and rows[1] then Kick(pid, "Banned: " .. rows[1].reason) end end)endSee also
Section titled “See also”GetPlayerHwid · CompareHwid · the Players group of the index
