mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 21:53:46 +03:00
Upload
This commit is contained in:
28
gamemodes/darkrp/plugins/extra_command/sh_plugin.lua
Normal file
28
gamemodes/darkrp/plugins/extra_command/sh_plugin.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
PLUGIN.name = "Extra Admin Container Command"
|
||||
PLUGIN.author = "Naast"
|
||||
PLUGIN.description = "Does what it does."
|
||||
|
||||
ix.util.Include("sv_plugin.lua")
|
||||
|
||||
ix.command.Add("CheckContainerLastAccessor", {
|
||||
description = "Prints out the last person interacted with container that you looking at.",
|
||||
privilege = "Helix - Manage Containers",
|
||||
adminOnly = true,
|
||||
OnRun = function(self, client)
|
||||
local container = client:GetEyeTrace().Entity
|
||||
if container and container:GetClass() != "ix_wncontainer" then return client:NotifyLocalized("You're not looking at any container!") end
|
||||
PLUGIN:GetContainerInteractionInfo(container, client)
|
||||
end
|
||||
})
|
||||
54
gamemodes/darkrp/plugins/extra_command/sv_plugin.lua
Normal file
54
gamemodes/darkrp/plugins/extra_command/sv_plugin.lua
Normal file
@@ -0,0 +1,54 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
function PLUGIN:GetContainerInteractionInfo(container, client)
|
||||
local conID = tostring(container:GetInventory():GetID())
|
||||
local targetCharInfo = {}
|
||||
local correctResult = {}
|
||||
local found = false
|
||||
local shouldContinue = true
|
||||
local query = mysql:Select("ix_logs")
|
||||
query:Where("log_type", "openContainer")
|
||||
query:Where("lookup2", conID)
|
||||
query:Callback(function(result)
|
||||
if (result and istable(result) and table.Count(result) > 0) then
|
||||
correctResult = result[#result]
|
||||
if ix.char.loaded[tonumber(correctResult.char_id)] then
|
||||
targetCharInfo = {name = ix.char.loaded[tonumber(correctResult.char_id)].vars.name, id = ix.char.loaded[tonumber(correctResult.char_id)].id}
|
||||
found = true
|
||||
end
|
||||
else
|
||||
client:NotifyLocalized("Seems like no one used this container before.")
|
||||
shouldContinue = false
|
||||
return
|
||||
end
|
||||
end)
|
||||
query:Execute()
|
||||
if !shouldContinue then return end
|
||||
if !found then
|
||||
local cQuery = mysql:Select("ix_characters")
|
||||
cQuery:Select("id")
|
||||
cQuery:Select("name")
|
||||
cQuery:WhereLike("id", tostring(correctResult.char_id))
|
||||
cQuery:Limit(1)
|
||||
cQuery:Callback(function(result)
|
||||
if (!result or !istable(result) or #result == 0) then
|
||||
client:Notify("Karakter veritabanında bulunamadı!")
|
||||
return
|
||||
end
|
||||
|
||||
if !result[1].id then return end
|
||||
|
||||
targetCharInfo = result[1]
|
||||
end)
|
||||
cQuery:Execute()
|
||||
end
|
||||
client:NotifyLocalized(tostring(targetCharInfo.name) .. " bu konteyneri en son açtı. Karakter ID: " .. tostring(targetCharInfo.id))
|
||||
end
|
||||
Reference in New Issue
Block a user