mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-18 14:13:46 +03:00
Upload
This commit is contained in:
106
gamemodes/ixhl2rp/plugins/cid/items/sh_cmru_card.lua
Normal file
106
gamemodes/ixhl2rp/plugins/cid/items/sh_cmru_card.lua
Normal file
@@ -0,0 +1,106 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "Karta Dostępu CMU"
|
||||
ITEM.model = Model("models/n7/props/n7_cid_card.mdl")
|
||||
ITEM.description = "Karta dostępu Civil Medical Union."
|
||||
ITEM.category = "Combine"
|
||||
ITEM.skin = 2
|
||||
ITEM.iconCam = {
|
||||
pos = Vector(-509.64, -427.61, 310.24),
|
||||
ang = Angle(25, 400, 0),
|
||||
fov = 0.59
|
||||
}
|
||||
|
||||
function ITEM:GetName()
|
||||
local accessLevel = self:GetData("accessLevel", 1)
|
||||
|
||||
return "Karta dostępu " .. accessLevel .. " CMU"
|
||||
end
|
||||
|
||||
function ITEM:GetDescription()
|
||||
local idCard = ix.item.instances[self:GetData("cardID")]
|
||||
return idCard and string.format(self.description.."\n\nAktualnie przypisany do CID #%s.", idCard:GetData("cardNumber")) or
|
||||
(self:GetData("cardID") and self.description.."\n\nAktualnie przypisany." or self.description)
|
||||
end
|
||||
|
||||
ITEM.functions.Bind = {
|
||||
name = "Przypisz CID",
|
||||
icon = "icon16/vcard_edit.png",
|
||||
OnClick = function(itemTable)
|
||||
local cards = {}
|
||||
|
||||
for _, v in pairs(LocalPlayer():GetCharacter():GetInventory():GetItemsByUniqueID("id_card")) do
|
||||
table.insert(cards, {
|
||||
text = v:GetName(),
|
||||
value = v
|
||||
})
|
||||
end
|
||||
|
||||
local cardsCount = table.Count(cards)
|
||||
if (cardsCount > 1) then
|
||||
Derma_Select("Przypisz CID do karty CMU", "Prosze wybrać CID aby go przypisać:",
|
||||
cards, "Wybierz CID",
|
||||
"Potwierdź", function(value, name)
|
||||
netstream.Start("ixBindCMRUCard", itemTable:GetID(), value:GetID())
|
||||
end, "Anuluj")
|
||||
elseif (cardsCount == 1) then
|
||||
Derma_Query("Czy jesteś pewny, że chcesz przypisać ten CID do tej karty dostępu?", "Przypisz CID do karty CMU",
|
||||
"Potwierdź", function()
|
||||
netstream.Start("ixBindCMRUCard", itemTable:GetID(), cards[1].value:GetID())
|
||||
end, "Anuluj")
|
||||
else
|
||||
LocalPlayer():NotifyLocalized("Nie posiadasz CID, który można przypisać do tej karty dostępu.")
|
||||
end
|
||||
end,
|
||||
OnRun = function(itemTable)
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(itemTable)
|
||||
if (IsValid(itemTable.entity)) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (!IsValid(itemTable.player)) then
|
||||
return false
|
||||
end
|
||||
|
||||
local inventory = itemTable.player:GetCharacter():GetInventory()
|
||||
|
||||
if (!inventory:HasItem("id_card")) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (itemTable:GetData("cardID")) then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
}
|
||||
|
||||
ITEM.functions.SetAccessLevel = {
|
||||
name = "Przełącz poziom karty",
|
||||
icon = "icon16/vcard_add.png",
|
||||
OnRun = function(itemTable)
|
||||
local client = itemTable.player
|
||||
local accessLevel = itemTable:GetData("accessLevel", 1)
|
||||
|
||||
accessLevel = accessLevel != 5 and accessLevel + 1 or 1
|
||||
itemTable:SetData("accessLevel", accessLevel)
|
||||
client:NotifyLocalized("Ustawiłeś poziom karty na: " .. accessLevel .. ".")
|
||||
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(itemTable)
|
||||
return (!IsValid(itemTable.entity) and IsValid(itemTable.player) and (itemTable.player:Team() == FACTION_ADMIN or itemTable.player:IsCombine() or itemTable.player:GetCharacter():HasFlags("M"))) == true
|
||||
end
|
||||
}
|
||||
106
gamemodes/ixhl2rp/plugins/cid/items/sh_con_card.lua
Normal file
106
gamemodes/ixhl2rp/plugins/cid/items/sh_con_card.lua
Normal file
@@ -0,0 +1,106 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "Conscript Access Card"
|
||||
ITEM.model = Model("models/n7/props/n7_cid_card.mdl")
|
||||
ITEM.description = "A Conscript Access Keycard."
|
||||
ITEM.category = "Combine"
|
||||
ITEM.skin = 2
|
||||
ITEM.iconCam = {
|
||||
pos = Vector(-509.64, -427.61, 310.24),
|
||||
ang = Angle(25, 400, 0),
|
||||
fov = 0.59
|
||||
}
|
||||
|
||||
function ITEM:GetName()
|
||||
local accessLevel = self:GetData("accessLevel", 1)
|
||||
|
||||
return "Conscript Level " .. accessLevel .. " Access Keycard"
|
||||
end
|
||||
|
||||
function ITEM:GetDescription()
|
||||
local idCard = ix.item.instances[self:GetData("cardID")]
|
||||
return idCard and string.format(self.description.."\n\nAktualnie przypisany do CID #%s.", idCard:GetData("cardNumber")) or
|
||||
(self:GetData("cardID") and self.description.."\n\nAktualnie przypisany." or self.description)
|
||||
end
|
||||
|
||||
ITEM.functions.Bind = {
|
||||
name = "Bind ID Card",
|
||||
icon = "icon16/vcard_edit.png",
|
||||
OnClick = function(itemTable)
|
||||
local cards = {}
|
||||
|
||||
for _, v in pairs(LocalPlayer():GetCharacter():GetInventory():GetItemsByUniqueID("id_card")) do
|
||||
table.insert(cards, {
|
||||
text = v:GetName(),
|
||||
value = v
|
||||
})
|
||||
end
|
||||
|
||||
local cardsCount = table.Count(cards)
|
||||
if (cardsCount > 1) then
|
||||
Derma_Select("Bind ID Card to Conscript Card", "Please select a ID card to bind to this Conscript Card:",
|
||||
cards, "Select ID card",
|
||||
"Confirm Operation", function(value, name)
|
||||
netstream.Start("ixBindConCard", itemTable:GetID(), value:GetID())
|
||||
end, "Cancel")
|
||||
elseif (cardsCount == 1) then
|
||||
Derma_Query("Are you sure you wish to bind your ID to this Conscript Card?", "Bind ID Card to Conscript Card",
|
||||
"Confirm Operation", function()
|
||||
netstream.Start("ixBindConCard", itemTable:GetID(), cards[1].value:GetID())
|
||||
end, "Cancel")
|
||||
else
|
||||
LocalPlayer():NotifyLocalized("You do not have ID card to bind to this Conscript Card.")
|
||||
end
|
||||
end,
|
||||
OnRun = function(itemTable)
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(itemTable)
|
||||
if (IsValid(itemTable.entity)) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (!IsValid(itemTable.player)) then
|
||||
return false
|
||||
end
|
||||
|
||||
local inventory = itemTable.player:GetCharacter():GetInventory()
|
||||
|
||||
if (!inventory:HasItem("id_card")) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (itemTable:GetData("cardID")) then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
}
|
||||
|
||||
ITEM.functions.SetAccessLevel = {
|
||||
name = "Przełącz poziom karty",
|
||||
icon = "icon16/vcard_add.png",
|
||||
OnRun = function(itemTable)
|
||||
local client = itemTable.player
|
||||
local accessLevel = itemTable:GetData("accessLevel", 1)
|
||||
|
||||
accessLevel = accessLevel != 5 and accessLevel + 1 or 1
|
||||
itemTable:SetData("accessLevel", accessLevel)
|
||||
client:NotifyLocalized("Ustawiłeś dostęp karty dla:" .. accessLevel .. ".")
|
||||
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(itemTable)
|
||||
return (!IsValid(itemTable.entity) and IsValid(itemTable.player) and (itemTable.player:Team() == FACTION_ADMIN or itemTable.player:IsCombine() or itemTable.player:GetCharacter():HasFlags("M"))) == true
|
||||
end
|
||||
}
|
||||
181
gamemodes/ixhl2rp/plugins/cid/items/sh_cwu_card.lua
Normal file
181
gamemodes/ixhl2rp/plugins/cid/items/sh_cwu_card.lua
Normal file
@@ -0,0 +1,181 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "Karta Dostępu CWU"
|
||||
ITEM.model = Model("models/n7/props/n7_cid_card.mdl")
|
||||
ITEM.description = "Karta dostępu Civil Workers Union."
|
||||
ITEM.category = "Combine"
|
||||
ITEM.skin = 2
|
||||
ITEM.iconCam = {
|
||||
pos = Vector(-509.64, -427.61, 310.24),
|
||||
ang = Angle(25, 400, 0),
|
||||
fov = 0.59
|
||||
}
|
||||
|
||||
function ITEM:GetName()
|
||||
local accessLevel = self:GetData("accessLevel", "Członek")
|
||||
|
||||
return "Karta Dostępu " .. accessLevel .. " CWU"
|
||||
end
|
||||
|
||||
function ITEM:GetFactionInfo()
|
||||
return self:GetData("faction", false) and ix.factionBudget.list[self:GetData("faction")] and "Przypisano do: " .. ix.factionBudget.list[self:GetData("faction")].name or "Ta karta nie jest przypisana do żadnej z frakcji."
|
||||
end
|
||||
|
||||
function ITEM:GetColorAppendix()
|
||||
local info = {["green"] = self:GetFactionInfo()}
|
||||
|
||||
return info
|
||||
end
|
||||
|
||||
function ITEM:GetDescription()
|
||||
local idCard = ix.item.instances[self:GetData("cardID")]
|
||||
return idCard and string.format(self.description.."\n\nAktualnie przypisany do CID #%s.", idCard:GetData("cardNumber")) or
|
||||
(self:GetData("cardID") and self.description.."\n\nAktualnie przypisany." or self.description)
|
||||
end
|
||||
|
||||
ITEM.functions.Bind = {
|
||||
name = "Przypisz CID",
|
||||
icon = "icon16/vcard_edit.png",
|
||||
OnClick = function(itemTable)
|
||||
local cards = {}
|
||||
|
||||
for _, v in pairs(LocalPlayer():GetCharacter():GetInventory():GetItemsByUniqueID("id_card")) do
|
||||
table.insert(cards, {
|
||||
text = v:GetName(),
|
||||
value = v
|
||||
})
|
||||
end
|
||||
|
||||
local cardsCount = table.Count(cards)
|
||||
if (cardsCount > 1) then
|
||||
Derma_Select("Przypisz CID do karty CWU", "Prosze wybrać CID aby go przypisać:",
|
||||
cards, "Wybierz CID",
|
||||
"Potwierdź", function(value, name)
|
||||
netstream.Start("ixBindCWUCard", itemTable:GetID(), value:GetID())
|
||||
end, "Anuluj")
|
||||
elseif (cardsCount == 1) then
|
||||
Derma_Query("Czy jesteś pewny, że chcesz przypisać ten CID do tej karty dostępu?", "Przypisz CID do karty CWU",
|
||||
"Potwierdź", function()
|
||||
netstream.Start("ixBindCWUCard", itemTable:GetID(), cards[1].value:GetID())
|
||||
end, "Anuluj")
|
||||
else
|
||||
LocalPlayer():NotifyLocalized("Nie posiadasz CID, który można przypisać do tej karty dostępu.")
|
||||
end
|
||||
end,
|
||||
OnRun = function(itemTable)
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(itemTable)
|
||||
if (IsValid(itemTable.entity)) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (!IsValid(itemTable.player)) then
|
||||
return false
|
||||
end
|
||||
|
||||
local inventory = itemTable.player:GetCharacter():GetInventory()
|
||||
|
||||
if (!inventory:HasItem("id_card")) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (itemTable:GetData("cardID")) then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
}
|
||||
|
||||
ITEM.functions.SetAccessLevel = {
|
||||
name = "Przełącz poziom karty",
|
||||
icon = "icon16/vcard_add.png",
|
||||
isMulti = true,
|
||||
multiOptions = function(item, player)
|
||||
local keys = table.GetKeys(ix.city.cwuAccess)
|
||||
local accessLevels = {}
|
||||
for _, accessLevel in pairs(keys) do
|
||||
accessLevels[#accessLevels + 1] = {name = accessLevel, data = {aLevel = accessLevel .. " Access"}}
|
||||
end
|
||||
|
||||
return accessLevels
|
||||
end,
|
||||
OnRun = function(itemTable, accessLevel)
|
||||
local client = itemTable.player
|
||||
|
||||
itemTable:SetData("accessLevel", accessLevel.aLevel)
|
||||
client:NotifyLocalized("Ustawiłeś dostęp karty dla: " .. accessLevel.aLevel .. ".")
|
||||
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(itemTable)
|
||||
return (!IsValid(itemTable.entity) and IsValid(itemTable.player) and (itemTable.player:Team() == FACTION_ADMIN or itemTable.player:IsCombine() or itemTable.player:GetCharacter():HasFlags("M"))) == true
|
||||
end
|
||||
}
|
||||
|
||||
ITEM.functions.SetFaction = {
|
||||
name = "Ustaw kartę frakcji",
|
||||
icon = "icon16/vcard_add.png",
|
||||
isMulti = true,
|
||||
multiOptions = function(item, player)
|
||||
local factions = {}
|
||||
for id, faction in pairs(ix.factionBudget.list) do
|
||||
factions[#factions + 1] = {name = faction.name, data = faction}
|
||||
end
|
||||
|
||||
return factions
|
||||
end,
|
||||
OnRun = function(item, data)
|
||||
item:SetData("faction", data.id)
|
||||
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(itemTable)
|
||||
return (!IsValid(itemTable.entity) and IsValid(itemTable.player) and (itemTable.player:Team() == FACTION_ADMIN or itemTable.player:IsCombine() or itemTable.player:GetCharacter():HasFlags("M"))) == true
|
||||
end
|
||||
}
|
||||
|
||||
ITEM.functions.insert = {
|
||||
name = "Włóż kartę",
|
||||
icon = "icon16/add.png",
|
||||
OnRun = function(itemTable)
|
||||
local client = itemTable.player
|
||||
local ent = client:GetEyeTrace().Entity
|
||||
if (!ent.CWUInsert) or client:EyePos():DistToSqr(ent:GetPos()) > 62500 then
|
||||
return false
|
||||
end
|
||||
|
||||
local bSuccess, error = itemTable:Transfer(nil, nil, nil, client)
|
||||
if (!bSuccess and isstring(error)) then
|
||||
client:NotifyLocalized(error)
|
||||
return false
|
||||
else
|
||||
client:EmitSound("npc/zombie/foot_slide" .. math.random(1, 3) .. ".wav", 75, math.random(90, 120), 1)
|
||||
end
|
||||
|
||||
if bSuccess and IsEntity(bSuccess) then
|
||||
ent:CWUInsert(bSuccess)
|
||||
end
|
||||
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(itemTable)
|
||||
local client = itemTable.player
|
||||
|
||||
if (!client:GetEyeTrace().Entity.CWUInsert) then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
}
|
||||
106
gamemodes/ixhl2rp/plugins/cid/items/sh_dob_card.lua
Normal file
106
gamemodes/ixhl2rp/plugins/cid/items/sh_dob_card.lua
Normal file
@@ -0,0 +1,106 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "Karta Dostępu MG"
|
||||
ITEM.model = Model("models/n7/props/n7_cid_card.mdl")
|
||||
ITEM.description = "Karta dostępu Ministerstwa Gospodarki."
|
||||
ITEM.category = "Combine"
|
||||
ITEM.skin = 2
|
||||
ITEM.iconCam = {
|
||||
pos = Vector(-509.64, -427.61, 310.24),
|
||||
ang = Angle(25, 400, 0),
|
||||
fov = 0.59
|
||||
}
|
||||
|
||||
function ITEM:GetName()
|
||||
local accessLevel = self:GetData("accessLevel", "Członek")
|
||||
|
||||
return "Karta dostępu " .. accessLevel .. " DOB"
|
||||
end
|
||||
|
||||
function ITEM:GetDescription()
|
||||
local idCard = ix.item.instances[self:GetData("cardID")]
|
||||
return idCard and string.format(self.description.."\n\nAktualnie przypisany do CID #%s.", idCard:GetData("cardNumber")) or
|
||||
(self:GetData("cardID") and self.description.."\n\nAktualnie przypisany." or self.description)
|
||||
end
|
||||
|
||||
ITEM.functions.Bind = {
|
||||
name = "Przypisz CID",
|
||||
icon = "icon16/vcard_edit.png",
|
||||
OnClick = function(itemTable)
|
||||
local cards = {}
|
||||
|
||||
for _, v in pairs(LocalPlayer():GetCharacter():GetInventory():GetItemsByUniqueID("id_card")) do
|
||||
table.insert(cards, {
|
||||
text = v:GetName(),
|
||||
value = v
|
||||
})
|
||||
end
|
||||
|
||||
local cardsCount = table.Count(cards)
|
||||
if (cardsCount > 1) then
|
||||
Derma_Select("Przypisz CID do karty MG", "Prosze wybrać CID aby go przypisać:",
|
||||
cards, "Wybierz CID",
|
||||
"Potwierdź", function(value, name)
|
||||
netstream.Start("ixBindDOBCard", itemTable:GetID(), value:GetID())
|
||||
end, "Anuluj")
|
||||
elseif (cardsCount == 1) then
|
||||
Derma_Query("Czy jesteś pewny, że chcesz przypisać ten CID do tej karty dostępu?", "Przypisz CID do karty MG",
|
||||
"Potwierdź", function()
|
||||
netstream.Start("ixBindDOBCard", itemTable:GetID(), cards[1].value:GetID())
|
||||
end, "Anuluj")
|
||||
else
|
||||
LocalPlayer():NotifyLocalized("Nie posiadasz CID, który można przypisać do tej karty dostępu.")
|
||||
end
|
||||
end,
|
||||
OnRun = function(itemTable)
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(itemTable)
|
||||
if (IsValid(itemTable.entity)) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (!IsValid(itemTable.player)) then
|
||||
return false
|
||||
end
|
||||
|
||||
local inventory = itemTable.player:GetCharacter():GetInventory()
|
||||
|
||||
if (!inventory:HasItem("id_card")) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (itemTable:GetData("cardID")) then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
}
|
||||
|
||||
ITEM.functions.SetAccessLevel = {
|
||||
name = "Przełącz poziom karty",
|
||||
icon = "icon16/vcard_add.png",
|
||||
OnRun = function(itemTable)
|
||||
local client = itemTable.player
|
||||
local accessLevel = itemTable:GetData("accessLevel", "Członek")
|
||||
local target = accessLevel == "Członek" and "Zarząd" or "Członek"
|
||||
|
||||
itemTable:SetData("accessLevel", target)
|
||||
client:NotifyLocalized("Ustawiłeś poziom karty na: " .. target .. ".")
|
||||
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(itemTable)
|
||||
return (!IsValid(itemTable.entity) and IsValid(itemTable.player) and (itemTable.player:Team() == FACTION_ADMIN or itemTable.player:IsCombine() or itemTable.player:GetCharacter():HasFlags("M"))) == true
|
||||
end
|
||||
}
|
||||
66
gamemodes/ixhl2rp/plugins/cid/items/sh_fake_id_card.lua
Normal file
66
gamemodes/ixhl2rp/plugins/cid/items/sh_fake_id_card.lua
Normal file
@@ -0,0 +1,66 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "Karta identyfikacyjna #00000"
|
||||
ITEM.model = Model("models/n7/props/n7_cid_card.mdl")
|
||||
ITEM.description = "Obywatelska karta identyfikacyjna przypisana do %s, CID #%s.\n\nNumer karty: %s\nOpis genetyczny:\n%s.\n\nTa karta jest własnością Administracji Miasta Kombinatu. Nielegalne posiadanie i fałszowanie tożsamości są karalne oraz będą skutkować wszczęciem postępowania przez Civil Protection. W przypadku znalezienia czyjejś karty należy niezwłocznie zwrócić ją do najbliższego oddziału Civil Protection."
|
||||
ITEM.category = "Combine"
|
||||
ITEM.iconCam = {
|
||||
pos = Vector(0, 0, 10),
|
||||
ang = Angle(90, 90, 0),
|
||||
fov = 45,
|
||||
}
|
||||
|
||||
if (CLIENT) then
|
||||
function ITEM:PaintOver(item, w, h)
|
||||
surface.SetDrawColor(110, 255, 110, 100)
|
||||
surface.DrawRect(w - 14, h - 14, 8, 8)
|
||||
end
|
||||
end
|
||||
|
||||
function ITEM:GetName()
|
||||
return "Karta identyfikacyjna #" .. self:GetData("cid", "00000")
|
||||
end
|
||||
|
||||
function ITEM:GetDescription()
|
||||
return string.format(self.description,
|
||||
self:GetData("name", "Nobody"),
|
||||
self:GetData("cid", "00000"),
|
||||
self:GetData("cardNumber", "00-0000-0000-00"),
|
||||
self:GetData("geneticDesc", "N/A | N/A | N/A OCZY | N/A WŁOSY"))
|
||||
end
|
||||
|
||||
local prime = 9999999787 -- prime % 4 = 3! DO NOT CHANGE EVER
|
||||
local offset = 100000 -- slightly larger than sqrt(prime) is ok. DO NOT CHANGE EVER
|
||||
local block = 100000000
|
||||
local function generateCardNumber(id)
|
||||
id = (id + offset) % prime
|
||||
|
||||
local cardNum = 0
|
||||
|
||||
for _ = 1, math.floor(id/block) do
|
||||
cardNum = (cardNum + (id * block) % prime) % prime
|
||||
end
|
||||
|
||||
cardNum = (cardNum + (id * (id % block) % prime)) % prime
|
||||
|
||||
if (2 * id < prime) then
|
||||
return cardNum
|
||||
else
|
||||
return prime - cardNum
|
||||
end
|
||||
end
|
||||
|
||||
function ITEM:OnInstanced()
|
||||
local cardNum = Schema:ZeroNumber(generateCardNumber(self:GetID()), 10)
|
||||
|
||||
self:SetData("cardNumber", string.utf8sub(cardNum, 1, 2) .. "-" .. string.utf8sub(cardNum, 3, 6) .. "-" .. string.utf8sub(cardNum, 7, 10) .. "-" .. Schema:ZeroNumber(cardNum % 97, 2))
|
||||
end
|
||||
@@ -0,0 +1,52 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "Urządzenie do tworzenia fałszywych kart identyfikacyjnych"
|
||||
ITEM.model = Model("models/props_lab/reciever01a.mdl")
|
||||
ITEM.description = "Urządzenie do tworzenia fałszywych kart identyfikacyjnych "
|
||||
ITEM.category = "Tools"
|
||||
|
||||
ITEM.functions.CreateID = {
|
||||
name = "Stwórz fałszywy CID",
|
||||
icon = "icon16/vcard.png",
|
||||
OnRun = function(itemTable)
|
||||
local client = itemTable.player
|
||||
|
||||
client:RequestString("Imię", "Wprowadź imię osoby na którą będzie ta karta identyfikacyjna", function(name)
|
||||
client:RequestString("CID", "Wprowadź CID jakiego używać będzie osoba na którą będzie ta karta identyfikacyjna", function(cid)
|
||||
client:RequestString("Opis", "Wprowadź opis ogólny osoby która będzie używać tej karty identyfikacyjnej", function(desc)
|
||||
local inventory = client:GetCharacter():GetInventory()
|
||||
local card = inventory:HasItem("id_card_blank")
|
||||
|
||||
if (!card) then
|
||||
client:Notify("Potrzebujesz pustej karty CID aby stworzyć fałszywy CID!")
|
||||
client:EmitSound("buttons/combine_button_locked.wav")
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
card:Remove()
|
||||
|
||||
inventory:Add("fake_id_card", 1, {
|
||||
name = name,
|
||||
cid = cid,
|
||||
geneticDesc = desc
|
||||
})
|
||||
|
||||
client:Notify("Fałszywa karta identyfikacyjna stworzona.")
|
||||
client:EmitSound("ambient/machines/combine_terminal_idle2.wav")
|
||||
end, "MŁODY DOROSŁY/DOROSŁY/W ŚREDNIM WIEKU/STARSZY | 0\'00\" | [COLOR] OCZY | [COLOR] WŁOSY")
|
||||
end, "00000")
|
||||
end, "")
|
||||
|
||||
return false
|
||||
end
|
||||
}
|
||||
289
gamemodes/ixhl2rp/plugins/cid/items/sh_id_card.lua
Normal file
289
gamemodes/ixhl2rp/plugins/cid/items/sh_id_card.lua
Normal file
@@ -0,0 +1,289 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "Karta identyfikacyjna #00000"
|
||||
ITEM.model = Model("models/n7/props/n7_cid_card.mdl")
|
||||
ITEM.description = "Obywatelska karta identyfikacyjna przypisana do %s, CID #%s.\n\nNumer karty: %s\nOpis genetyczny:\n%s.\n\nTa karta jest własnością Administracji Miasta Kombinatu. Nielegalne posiadanie i fałszowanie tożsamości są karalne oraz będą skutkować wszczęciem postępowania przez Civil Protection. W przypadku znalezienia czyjejś karty należy niezwłocznie zwrócić ją do najbliższego oddziału Civil Protection."
|
||||
ITEM.category = "Combine"
|
||||
ITEM.iconCam = {
|
||||
pos = Vector(0, 0, 10),
|
||||
ang = Angle(90, 90, 0),
|
||||
fov = 45,
|
||||
}
|
||||
|
||||
if (CLIENT) then
|
||||
function ITEM:PaintOver(item, w, h)
|
||||
if (item:GetData("active")) then
|
||||
surface.SetDrawColor(110, 255, 110, 100)
|
||||
surface.DrawRect(w - 14, h - 14, 8, 8)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ITEM:GetName()
|
||||
return "Karta identyfikacyjna #" .. self:GetData("cid", "00000")
|
||||
end
|
||||
|
||||
-- It's also possible to use ITEM.KeepOnDeath = true
|
||||
function ITEM:KeepOnDeath(client)
|
||||
return self:GetData("owner") == client:GetCharacter():GetID() and self:GetData("active")
|
||||
end
|
||||
|
||||
function ITEM:GetDescription()
|
||||
return string.format(self.description,
|
||||
self:GetData("name", "Nobody"),
|
||||
self:GetData("cid", "00000"),
|
||||
self:GetData("cardNumber", "00-0000-0000-00"),
|
||||
self:GetData("geneticDesc", "N/A | N/A | N/A OCZY | N/A WŁOSY"))
|
||||
end
|
||||
|
||||
local prime = 9999999787 -- prime % 4 = 3! DO NOT CHANGE EVER
|
||||
local offset = 100000 -- slightly larger than sqrt(prime) is ok. DO NOT CHANGE EVER
|
||||
local block = 100000000
|
||||
local function generateCardNumber(id)
|
||||
id = (id + offset) % prime
|
||||
|
||||
local cardNum = 0
|
||||
|
||||
for _ = 1, math.floor(id/block) do
|
||||
cardNum = (cardNum + (id * block) % prime) % prime
|
||||
end
|
||||
|
||||
cardNum = (cardNum + (id * (id % block) % prime)) % prime
|
||||
|
||||
if (2 * id < prime) then
|
||||
return cardNum
|
||||
else
|
||||
return prime - cardNum
|
||||
end
|
||||
end
|
||||
|
||||
function ITEM:GetCredits()
|
||||
return self:GetData("credits", 0)
|
||||
end
|
||||
|
||||
function ITEM:HasCredits(amount)
|
||||
return amount <= self:GetData("credits", 0)
|
||||
end
|
||||
|
||||
if (SERVER) then
|
||||
function ITEM:SetCredits(amount)
|
||||
self:SetData("credits", math.floor(amount))
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function ITEM:GiveCredits(amount, sender, reason)
|
||||
if (amount < 0 and !self:HasCredits(math.abs(amount))) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (amount == 0) then
|
||||
return true
|
||||
end
|
||||
|
||||
if (sender) then
|
||||
local insert = mysql:Insert("ix_cid_transactions")
|
||||
insert:Insert("datetime", os.time())
|
||||
insert:Insert("sender_name", sender)
|
||||
insert:Insert("sender_cid", "00000")
|
||||
insert:Insert("sender_cardid", 0)
|
||||
insert:Insert("receiver_name", self:GetData("name", "NIEZNANY"))
|
||||
insert:Insert("receiver_cid", self:GetData("cid", "NIEPRAWIDŁOWY"))
|
||||
insert:Insert("receiver_cardid", self:GetID())
|
||||
insert:Insert("amount", amount)
|
||||
if (reason and reason != "") then
|
||||
insert:Insert("reason", string.len(reason) > 250 and string.sub(reason, 1, 250) or reason)
|
||||
else
|
||||
insert:Insert("reason", "no reason given")
|
||||
end
|
||||
|
||||
insert:Insert("pos", 0)
|
||||
insert:Insert("read", 1)
|
||||
insert:Execute()
|
||||
end
|
||||
|
||||
return self:SetCredits(amount + self:GetCredits())
|
||||
end
|
||||
|
||||
function ITEM:TakeCredits(amount, receiver, reason)
|
||||
if (amount > 0 and !self:HasCredits(amount)) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (amount == 0) then
|
||||
return true
|
||||
end
|
||||
|
||||
if (receiver) then
|
||||
local insert = mysql:Insert("ix_cid_transactions")
|
||||
insert:Insert("datetime", os.time())
|
||||
insert:Insert("sender_name", self:GetData("name", "NIEZNANY"))
|
||||
insert:Insert("sender_cid", self:GetData("cid", "NIEPRAWIDŁOWY"))
|
||||
insert:Insert("sender_cardid", self:GetID())
|
||||
insert:Insert("receiver_name", receiver)
|
||||
insert:Insert("receiver_cid", "00000")
|
||||
insert:Insert("receiver_cardid", 0)
|
||||
insert:Insert("amount", amount)
|
||||
if (reason and reason != "") then
|
||||
insert:Insert("reason", string.len(reason) > 250 and string.sub(reason, 1, 250) or reason)
|
||||
else
|
||||
insert:Insert("reason", "no reason given")
|
||||
end
|
||||
|
||||
insert:Insert("pos", 0)
|
||||
insert:Insert("read", 1)
|
||||
insert:Execute()
|
||||
end
|
||||
|
||||
return self:SetCredits(self:GetCredits() - amount)
|
||||
end
|
||||
|
||||
function ITEM:OnInstanced()
|
||||
local cardNum = Schema:ZeroNumber(generateCardNumber(self:GetID()), 10)
|
||||
self:SetData("cardNumber", string.utf8sub(cardNum, 1, 2).."-"..string.utf8sub(cardNum, 3, 6).."-"..string.utf8sub(cardNum, 7, 10)..
|
||||
"-"..Schema:ZeroNumber(cardNum % 97, 2))
|
||||
end
|
||||
|
||||
function ITEM:TransferData(newCard, wipe)
|
||||
newCard:SetData("credits", self:GetData("credits", 0))
|
||||
newCard:SetData("nextRationTime", self:GetData("nextRationTime", 0))
|
||||
|
||||
if (wipe) then
|
||||
self:SetData("active", false)
|
||||
self:SetData("credits", 0)
|
||||
self:SetData("nextRationTime", 0)
|
||||
end
|
||||
end
|
||||
|
||||
function ITEM:OnRemoved()
|
||||
if (self:GetData("active") != false) then
|
||||
local ownerId = self:GetData("owner")
|
||||
local data = {credits = self:GetData("credits", 0), ration = self:GetData("nextRationTime", 0)}
|
||||
if (ix.char.loaded[ownerId]) then
|
||||
ix.char.loaded[ownerId]:SetIdCardBackup(data)
|
||||
ix.char.loaded[ownerId]:SetIdCard(nil)
|
||||
end
|
||||
|
||||
local updateQuery = mysql:Update("ix_characters_data")
|
||||
updateQuery:Update("data", util.TableToJSON(data))
|
||||
updateQuery:Where("id", ownerId)
|
||||
updateQuery:Where("key", "idCardBackup")
|
||||
updateQuery:Execute()
|
||||
|
||||
local idCardQuery = mysql:Update("ix_characters")
|
||||
idCardQuery.updateList[#idCardQuery.updateList + 1] = {"`idcard`", "NULL"}
|
||||
idCardQuery:Where("id", ownerId)
|
||||
idCardQuery:Where("schema", Schema and Schema.folder or "helix")
|
||||
idCardQuery:Execute()
|
||||
|
||||
self:SetData("active", false)
|
||||
end
|
||||
end
|
||||
|
||||
function ITEM:LoadOwnerGenericData(callback, error, ...)
|
||||
if (!callback) then return end
|
||||
|
||||
local arg = {...}
|
||||
local queryObj = mysql:Select("ix_characters_data")
|
||||
queryObj:Where("id", self:GetData("owner", 0))
|
||||
queryObj:Where("key", "genericdata")
|
||||
queryObj:Select("data")
|
||||
queryObj:Callback(function(result)
|
||||
if (!istable(result) or !result[1]) then
|
||||
if (error) then
|
||||
error(self, unpack(arg))
|
||||
end
|
||||
else
|
||||
callback(self, util.JSONToTable(result[1].data or ""), unpack(arg))
|
||||
end
|
||||
end)
|
||||
queryObj:Execute()
|
||||
end
|
||||
|
||||
netstream.Hook("ixSetIDCardCredits", function(client, itemID, amount)
|
||||
ix.item.instances[itemID]:SetCredits(amount)
|
||||
end)
|
||||
end
|
||||
|
||||
ITEM.functions.SetCredits = {
|
||||
name = "Ustaw Kredyty",
|
||||
icon = "icon16/money_add.png",
|
||||
OnClick = function(itemTable)
|
||||
local client = itemTable.player
|
||||
Derma_StringRequest("Ustaw Kredyty", "Na jaką wartość chcesz ustawić kredyty?", itemTable:GetData("credits", 0), function(text)
|
||||
local amount = tonumber(text)
|
||||
|
||||
if (amount and amount >= 0) then
|
||||
netstream.Start("ixSetIDCardCredits", itemTable:GetID(), math.floor(amount))
|
||||
else
|
||||
client:NotifyLocalized("numNotValid")
|
||||
end
|
||||
end)
|
||||
end,
|
||||
OnRun = function(itemTable)
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(itemTable)
|
||||
if (IsValid(itemTable.entity)) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (!CAMI.PlayerHasAccess(itemTable.player, "Helix - Set Credits")) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (!itemTable:GetData("active", false)) then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
}
|
||||
|
||||
ITEM.functions.insert = {
|
||||
name = "Włóż CID",
|
||||
icon = "icon16/add.png",
|
||||
OnRun = function(itemTable)
|
||||
local client = itemTable.player
|
||||
local ent = client:GetEyeTrace().Entity
|
||||
if (!ent.CIDInsert) or client:EyePos():DistToSqr(ent:GetPos()) > 62500 then
|
||||
return false
|
||||
end
|
||||
|
||||
local bSuccess, error = itemTable:Transfer(nil, nil, nil, client)
|
||||
if (!bSuccess and isstring(error)) then
|
||||
client:NotifyLocalized(error)
|
||||
return false
|
||||
else
|
||||
client:EmitSound("npc/zombie/foot_slide" .. math.random(1, 3) .. ".wav", 75, math.random(90, 120), 1)
|
||||
end
|
||||
|
||||
if bSuccess and IsEntity(bSuccess) then
|
||||
ent:CIDInsert(bSuccess)
|
||||
end
|
||||
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(itemTable)
|
||||
local client = itemTable.player
|
||||
|
||||
if (!client:GetEyeTrace().Entity.CIDInsert) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (!itemTable:GetData("active", false)) then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
}
|
||||
19
gamemodes/ixhl2rp/plugins/cid/items/sh_id_card_blank.lua
Normal file
19
gamemodes/ixhl2rp/plugins/cid/items/sh_id_card_blank.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ITEM.name = "Pusta karta CID"
|
||||
ITEM.model = Model("models/n7/props/n7_cid_card.mdl")
|
||||
ITEM.description = "Pusta karta identyfikacyjna cywila."
|
||||
ITEM.category = "Combine"
|
||||
ITEM.iconCam = {
|
||||
pos = Vector(-509.64, -427.61, 310.24),
|
||||
ang = Angle(25, 400, 0),
|
||||
fov = 0.59
|
||||
}
|
||||
114
gamemodes/ixhl2rp/plugins/cid/items/sh_id_card_creator.lua
Normal file
114
gamemodes/ixhl2rp/plugins/cid/items/sh_id_card_creator.lua
Normal file
@@ -0,0 +1,114 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "Urządzenie do tworzenia kart identyfikacyjnych"
|
||||
ITEM.model = Model("models/props_lab/reciever01d.mdl")
|
||||
ITEM.description = "Urządzenie do uzupełniania pustych kart identyfikacyjnych i przypisywania ich do danej osoby."
|
||||
ITEM.category = "Combine"
|
||||
ITEM.functions.CreateIDTarget = {
|
||||
name = "Stwórz CID dla celu",
|
||||
icon = "icon16/vcard_add.png",
|
||||
OnRun = function(itemTable)
|
||||
local client = itemTable.player
|
||||
|
||||
if (ix.config.Get("creditsNoConnection")) then
|
||||
client:EmitSound("hl1/fvox/buzz.wav", 60, 100, 0.5)
|
||||
return false
|
||||
end
|
||||
|
||||
if (itemTable:CheckAccess(client, itemTable) == false) then
|
||||
client:EmitSound("buttons/combine_button_locked.wav", 60, 100, 0.5)
|
||||
return false
|
||||
end
|
||||
|
||||
local data = {}
|
||||
data.start = client:GetShootPos()
|
||||
data.endpos = data.start + client:GetAimVector() * 96
|
||||
data.filter = client
|
||||
local target = util.TraceLine(data).Entity
|
||||
|
||||
if (IsValid(target) and target:IsPlayer() and target:GetCharacter()) then
|
||||
client:SetAction("@scanning", 5)
|
||||
client:EmitSound("buttons/button18.wav", 60, 100, 0.5)
|
||||
client:DoStaredAction(target, function()
|
||||
itemTable:CreateIDCard(client, target)
|
||||
end, 5, function()
|
||||
client:SetAction()
|
||||
client:EmitSound("buttons/combine_button_locked.wav", 60, 100, 0.5)
|
||||
end)
|
||||
else
|
||||
client:NotifyLocalized("plyNotValid")
|
||||
end
|
||||
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(itemTable)
|
||||
return !IsValid(itemTable.entity)
|
||||
end
|
||||
}
|
||||
|
||||
ITEM.functions.CreateIDSelf = {
|
||||
name = "Stwórz CID dla siebie",
|
||||
icon = "icon16/vcard.png",
|
||||
OnRun = function(itemTable)
|
||||
local client = itemTable.player
|
||||
|
||||
if (ix.config.Get("creditsNoConnection")) then
|
||||
client:EmitSound("hl1/fvox/buzz.wav", 60, 100, 0.5)
|
||||
return false
|
||||
end
|
||||
|
||||
if (itemTable:CheckAccess(client, itemTable) == false) then
|
||||
client:EmitSound("buttons/combine_button_locked.wav", 60, 100, 0.5)
|
||||
return false
|
||||
end
|
||||
|
||||
client:SetAction("@scanning", 5, function()
|
||||
itemTable:CreateIDCard(client, client)
|
||||
end)
|
||||
client:EmitSound("buttons/button18.wav", 60, 100, 0.5)
|
||||
return false
|
||||
end
|
||||
}
|
||||
|
||||
function ITEM:CreateIDCard(client, target)
|
||||
local character = target:GetCharacter()
|
||||
local cid = character:GetCid()
|
||||
|
||||
if (!cid) then
|
||||
client:NotifyLocalized("idNotFound")
|
||||
client:EmitSound("buttons/combine_button_locked.wav", 60, 100, 0.5)
|
||||
return
|
||||
end
|
||||
|
||||
local inventory = client:GetCharacter():GetInventory()
|
||||
local blankCard = inventory:HasItem("id_card_blank")
|
||||
|
||||
if (!blankCard) then
|
||||
client:NotifyLocalized("idNoBlank")
|
||||
client:EmitSound("buttons/combine_button_locked.wav", 60, 100, 0.5)
|
||||
return
|
||||
end
|
||||
|
||||
blankCard:Remove()
|
||||
character:CreateIDCard()
|
||||
client:EmitSound("buttons/button4.wav", 60, 100, 0.5)
|
||||
client:NotifyLocalized("idCardAdded")
|
||||
|
||||
ix.combineNotify:AddNotification("NTC:// CID #" .. character:GetCid() .. " stworzony przez " .. client:GetCombineTag())
|
||||
end
|
||||
|
||||
function ITEM:CheckAccess(client, itemTable)
|
||||
if (!client:HasActiveCombineSuit() and !ix.faction.Get(client:Team()).allowCIDCreator) then
|
||||
client:NotifyLocalized("idNotAllowed")
|
||||
return false
|
||||
end
|
||||
end
|
||||
106
gamemodes/ixhl2rp/plugins/cid/items/sh_moe_card.lua
Normal file
106
gamemodes/ixhl2rp/plugins/cid/items/sh_moe_card.lua
Normal file
@@ -0,0 +1,106 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "Karta Dostępu MOP"
|
||||
ITEM.model = Model("models/n7/props/n7_cid_card.mdl")
|
||||
ITEM.description = "Karta dostępu Ministerstwa Oświecenia Publicznego."
|
||||
ITEM.category = "Combine"
|
||||
ITEM.skin = 2
|
||||
ITEM.iconCam = {
|
||||
pos = Vector(-509.64, -427.61, 310.24),
|
||||
ang = Angle(25, 400, 0),
|
||||
fov = 0.59
|
||||
}
|
||||
|
||||
function ITEM:GetName()
|
||||
local accessLevel = self:GetData("accessLevel", "Członek")
|
||||
|
||||
return "Karta dostępu: " .. accessLevel .. " MOP"
|
||||
end
|
||||
|
||||
function ITEM:GetDescription()
|
||||
local idCard = ix.item.instances[self:GetData("cardID")]
|
||||
return idCard and string.format(self.description.."\n\nAktualnie przypisany do CID #%s.", idCard:GetData("cardNumber")) or
|
||||
(self:GetData("cardID") and self.description.."\n\nAktualnie przypisany." or self.description)
|
||||
end
|
||||
|
||||
ITEM.functions.Bind = {
|
||||
name = "Przypisz CID",
|
||||
icon = "icon16/vcard_edit.png",
|
||||
OnClick = function(itemTable)
|
||||
local cards = {}
|
||||
|
||||
for _, v in pairs(LocalPlayer():GetCharacter():GetInventory():GetItemsByUniqueID("id_card")) do
|
||||
table.insert(cards, {
|
||||
text = v:GetName(),
|
||||
value = v
|
||||
})
|
||||
end
|
||||
|
||||
local cardsCount = table.Count(cards)
|
||||
if (cardsCount > 1) then
|
||||
Derma_Select("Przypisz CID do karty MOP", "Prosze wybrać CID aby go przypisać:",
|
||||
cards, "Wybierz CID",
|
||||
"Potwierdź", function(value, name)
|
||||
netstream.Start("ixBindMOECard", itemTable:GetID(), value:GetID())
|
||||
end, "Anuluj")
|
||||
elseif (cardsCount == 1) then
|
||||
Derma_Query("Czy jesteś pewny, że chcesz przypisać ten CID do tej karty dostępu?", "Przypisz CID do karty MOP",
|
||||
"Potwierdź", function()
|
||||
netstream.Start("ixBindMOECard", itemTable:GetID(), cards[1].value:GetID())
|
||||
end, "Anuluj")
|
||||
else
|
||||
LocalPlayer():NotifyLocalized("Nie posiadasz CID, który można przypisać do tej karty dostępu.")
|
||||
end
|
||||
end,
|
||||
OnRun = function(itemTable)
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(itemTable)
|
||||
if (IsValid(itemTable.entity)) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (!IsValid(itemTable.player)) then
|
||||
return false
|
||||
end
|
||||
|
||||
local inventory = itemTable.player:GetCharacter():GetInventory()
|
||||
|
||||
if (!inventory:HasItem("id_card")) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (itemTable:GetData("cardID")) then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
}
|
||||
|
||||
ITEM.functions.SetAccessLevel = {
|
||||
name = "Przełącz poziom karty",
|
||||
icon = "icon16/vcard_add.png",
|
||||
OnRun = function(itemTable)
|
||||
local client = itemTable.player
|
||||
local accessLevel = itemTable:GetData("accessLevel", "Członek")
|
||||
local target = accessLevel == "Członek" and "Zarząd" or "Członek"
|
||||
|
||||
itemTable:SetData("accessLevel", target)
|
||||
client:NotifyLocalized("Ustawiłeś dostęp karty dla: " .. target .. ".")
|
||||
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(itemTable)
|
||||
return (!IsValid(itemTable.entity) and IsValid(itemTable.player) and (itemTable.player:Team() == FACTION_ADMIN or itemTable.player:IsCombine() or itemTable.player:GetCharacter():HasFlags("M"))) == true
|
||||
end
|
||||
}
|
||||
226
gamemodes/ixhl2rp/plugins/cid/items/sh_pos_terminal.lua
Normal file
226
gamemodes/ixhl2rp/plugins/cid/items/sh_pos_terminal.lua
Normal file
@@ -0,0 +1,226 @@
|
||||
--[[
|
||||
| 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
|
||||
|
||||
ITEM.name = "Terminal płatniczy"
|
||||
ITEM.model = Model("models/willardnetworks/props/posterminal.mdl")
|
||||
ITEM.description = "Urządzenie dzięki któremu jedna osoba może przelać pieniądze na konto drugiej osoby."
|
||||
ITEM.category = "Combine"
|
||||
|
||||
function ITEM:GetDescription()
|
||||
local idCard = ix.item.instances[self:GetData("cardID")]
|
||||
return idCard and string.format(self.description.."\n\nAktualnie przypisany do CID #%s.", idCard:GetData("cardNumber")) or self.description
|
||||
end
|
||||
|
||||
if (SERVER) then
|
||||
function ITEM:AddTransactionID(id)
|
||||
local ids = self:GetData("transactionIDs", {})
|
||||
ids[#ids + 1] = id
|
||||
self:SetData("transactionIDs", ids, false, false, true)
|
||||
end
|
||||
end
|
||||
|
||||
ITEM.functions.RequestCredits = {
|
||||
name = "Zażądaj kredytów",
|
||||
icon = "icon16/money.png",
|
||||
OnClick = function(itemTable)
|
||||
local client = itemTable.player
|
||||
|
||||
if (ix.config.Get("creditsNoConnection")) then
|
||||
client:EmitSound("hl1/fvox/buzz.wav", 60, 100, 0.5)
|
||||
client:NotifyLocalized("errorNoConnection")
|
||||
return false
|
||||
end
|
||||
|
||||
Derma_StringRequest("Prośba o zapłatę", "Ile chcesz aby ktoś ci zapłacił?", itemTable:GetData("lastAmount", 0), function(text)
|
||||
local amount = tonumber(text)
|
||||
|
||||
if (amount) then
|
||||
Derma_StringRequest("Prośba o zapłatę - KOMENTARZ", "Wpisz powód transakcji:", "", function(reason)
|
||||
if (text == "") then
|
||||
client:NotifyLocalized("reasonNotValid")
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
netstream.Start("ixRequestCredits", itemTable:GetID(), math.floor(amount), reason)
|
||||
end)
|
||||
else
|
||||
client:NotifyLocalized("numNotValid")
|
||||
end
|
||||
end)
|
||||
end,
|
||||
OnRun = function(itemTable)
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(itemTable)
|
||||
if (IsValid(itemTable.entity)) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (!itemTable:GetData("cardID", false)) then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
}
|
||||
|
||||
ITEM.functions.Bind = {
|
||||
name = "Przypisz CID",
|
||||
icon = "icon16/vcard_edit.png",
|
||||
OnClick = function(itemTable)
|
||||
local client = itemTable.player
|
||||
|
||||
if (ix.config.Get("creditsNoConnection")) then
|
||||
client:EmitSound("hl1/fvox/buzz.wav", 60, 100, 0.5)
|
||||
client:NotifyLocalized("errorNoConnection")
|
||||
return false
|
||||
end
|
||||
|
||||
local cards = {}
|
||||
|
||||
for _, v in pairs(client:GetCharacter():GetInventory():GetItemsByUniqueID("id_card")) do
|
||||
table.insert(cards, {
|
||||
text = v:GetName(),
|
||||
value = v
|
||||
})
|
||||
end
|
||||
|
||||
local cardsCount = table.Count(cards)
|
||||
if (cardsCount > 1) then
|
||||
Derma_Select("Przypisz CID do terminala", "Prosze wybrać CID aby go przypisać:",
|
||||
cards, "Wybierz CID",
|
||||
"Potwierdź", function(value, name)
|
||||
netstream.Start("ixBindTerminal", itemTable:GetID(), value:GetID())
|
||||
end, "Anuluj")
|
||||
elseif (cardsCount == 1) then
|
||||
Derma_Query("Czy jesteś pewny, że chcesz przypisać ten CID do tego terminala płatniczego?", "Przypisz CID do terminala",
|
||||
"Potwierdź", function()
|
||||
netstream.Start("ixBindTerminal", itemTable:GetID(), cards[1].value:GetID())
|
||||
end, "Anuluj")
|
||||
else
|
||||
client:NotifyLocalized("Nie posiadasz CID, który można przypisać do tego terminala.")
|
||||
end
|
||||
end,
|
||||
OnRun = function(itemTable)
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(itemTable)
|
||||
if (IsValid(itemTable.entity)) then return false end
|
||||
if (!IsValid(itemTable.player)) then return false end
|
||||
|
||||
if (itemTable:GetData("cardIDLock", false)) then return false end
|
||||
|
||||
local inventory = itemTable.player:GetCharacter():GetInventory()
|
||||
if (!inventory:HasItem("id_card")) then return false end
|
||||
if (!itemTable:GetData("cardID", false)) then return true end
|
||||
|
||||
if (inventory:GetItemCount("id_card") == 1 and inventory:GetItemByID(itemTable:GetData("cardID"))) then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
}
|
||||
|
||||
ITEM.functions.ShowLog = {
|
||||
name = "Wyświetl transakcje",
|
||||
icon = "icon16/eye.png",
|
||||
OnRun = function(itemTable, data)
|
||||
local inventory = itemTable.player:GetCharacter():GetInventory()
|
||||
PLUGIN:SelectTransactions(itemTable.player, "pos", itemTable:GetID(), data and data[1], itemTable:GetData("cardIDLock", false) and !inventory:GetItemByID(itemTable:GetData("cardID")))
|
||||
|
||||
return false
|
||||
end,
|
||||
isMulti = true,
|
||||
multiOptions = function(item, player)
|
||||
local options = {{name = "1 dzień", data = {1}}}
|
||||
|
||||
for i = 2, 6 do
|
||||
options[#options + 1] = {name = i.." dni", data = {i}}
|
||||
end
|
||||
options[#options + 1] = {name = "1 tydzień", data = {7}}
|
||||
options[#options + 1] = {name = "2 tygodnie", data = {14}}
|
||||
options[#options + 1] = {name = "1 miesiąc", data = {30}}
|
||||
|
||||
options[#options + 1] = {name = "inne", data = {-1}, OnClick = function(itemTable)
|
||||
Derma_StringRequest("Spis transacji", "Z przed ilu dni chciałbyś wyświetlić transakcje?", "7", function(text)
|
||||
local amount = tonumber(text)
|
||||
if (!amount or amount <= 0) then return end
|
||||
|
||||
net.Start("ixInventoryAction")
|
||||
net.WriteString("ShowLog")
|
||||
net.WriteUInt(itemTable.id, 32)
|
||||
net.WriteUInt(itemTable.invID, 32)
|
||||
net.WriteTable({amount})
|
||||
net.SendToServer()
|
||||
end)
|
||||
|
||||
return false
|
||||
end}
|
||||
|
||||
return options
|
||||
end,
|
||||
OnCanRun = function(itemTable)
|
||||
if (IsValid(itemTable.entity)) then return false end
|
||||
if (!IsValid(itemTable.player)) then return false end
|
||||
if (!itemTable:GetData("cardID", false)) then return false end
|
||||
|
||||
return true
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
ITEM.functions.Lock = {
|
||||
name = "Zablokuj CID",
|
||||
icon = "icon16/lock.png",
|
||||
OnRun = function(itemTable)
|
||||
itemTable:SetData("cardIDLock", true)
|
||||
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(itemTable)
|
||||
if (IsValid(itemTable.entity)) then return false end
|
||||
if (!IsValid(itemTable.player)) then return false end
|
||||
|
||||
if (itemTable:GetData("cardIDLock", false)) then return false end
|
||||
|
||||
local inventory = itemTable.player:GetCharacter():GetInventory()
|
||||
if (!itemTable:GetData("cardID", false)) then return false end
|
||||
if (!inventory:GetItemByID(itemTable:GetData("cardID"))) then return false end
|
||||
|
||||
return true
|
||||
end
|
||||
}
|
||||
|
||||
ITEM.functions.LockUn = {
|
||||
name = "Odblokuj CID",
|
||||
icon = "icon16/lock_open.png",
|
||||
OnRun = function(itemTable)
|
||||
itemTable:SetData("cardIDLock", false)
|
||||
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(itemTable)
|
||||
if (IsValid(itemTable.entity)) then return false end
|
||||
if (!IsValid(itemTable.player)) then return false end
|
||||
|
||||
if (!itemTable:GetData("cardIDLock", false)) then return false end
|
||||
|
||||
local inventory = itemTable.player:GetCharacter():GetInventory()
|
||||
if (!itemTable:GetData("cardID", false)) then return false end
|
||||
if (!inventory:GetItemByID(itemTable:GetData("cardID"))) then return false end
|
||||
|
||||
return true
|
||||
end
|
||||
}
|
||||
157
gamemodes/ixhl2rp/plugins/cid/items/sh_request_device.lua
Normal file
157
gamemodes/ixhl2rp/plugins/cid/items/sh_request_device.lua
Normal file
@@ -0,0 +1,157 @@
|
||||
--[[
|
||||
| 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
|
||||
|
||||
REQUEST_CP = 0
|
||||
REQUEST_MED = 1
|
||||
REQUEST_WORK = 2
|
||||
|
||||
ITEM.name = "Pager"
|
||||
ITEM.model = Model("models/gibs/shield_scanner_gib1.mdl")
|
||||
ITEM.description = "Małe urządzenie zgłaszające. Z tyłu widoczne jest logo kombinatu. \n\nNa instrukcji czytamy: Proszę najpierw zarejestrować urządzenie przykładając swój CID do urządzenia. Po zakończeniu rejestracji otrzymasz możliwość wezwania pomocy od Civil Protection, aby to zrobić naciśnij przycisk i zgłoś swoje zgłoszenie. Twoje imię i CID zostanie załączony ze zgłoszeniem.\nProszę być świadomym, że każde fałszywe zgłoszenie jak i korzystanie z urządzenia przypisanego do innej osoby jest karane i skutkować będzie surowymi karami od Civil Protection."
|
||||
ITEM.price = 20
|
||||
ITEM.category = "Combine"
|
||||
function ITEM:GetDescription()
|
||||
local idCard = ix.item.instances[self:GetData("cardID")]
|
||||
return idCard and string.format(self.description.."\n\nAktualnie przypisane do CID #%s.", idCard:GetData("cardNumber")) or self.description
|
||||
end
|
||||
|
||||
local function GetRequestTable(data)
|
||||
return {
|
||||
name = data.actionName,
|
||||
icon = "icon16/help.png",
|
||||
OnClick = function(itemTable)
|
||||
if (ix.config.Get("creditsNoConnection")) then
|
||||
itemTable.player:EmitSound("hl1/fvox/buzz.wav", 60, 100, 0.5)
|
||||
return
|
||||
end
|
||||
|
||||
Derma_StringRequest(data.requestTitle, data.requestMessage, PLUGIN.text,
|
||||
function(text)
|
||||
if (text and string.utf8len(text) > 0) then
|
||||
netstream.Start("ixRequest", itemTable:GetID(), text, data.requestType)
|
||||
end
|
||||
|
||||
PLUGIN.text = nil
|
||||
end,
|
||||
function(text)
|
||||
if (text == PLUGIN.text) then
|
||||
PLUGIN.text = text
|
||||
elseif (text and string.utf8len(text) > 0)then
|
||||
PLUGIN.text = text
|
||||
else
|
||||
PLUGIN.text = nil
|
||||
end
|
||||
end, "STWÓRZ ZGŁOSZENIE", "ANULUJ"
|
||||
)
|
||||
end,
|
||||
OnRun = function(itemTable)
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(itemTable)
|
||||
if (IsValid(itemTable.entity)) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (!itemTable:GetData("cardID", false)) then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
ITEM.functions.RequestCp = GetRequestTable({
|
||||
actionName = "Stwórz zgłoszenie do CP",
|
||||
requestTitle = "Poproś o pomoc Civil Protection",
|
||||
requestMessage = "Wprowadź swoje zgłoszenie dla Civil Protection. Twoje imię i CID zostaną automatycznie dodane do zgłoszenia.",
|
||||
requestType = REQUEST_CP
|
||||
})
|
||||
|
||||
ITEM.functions.RequestMed = GetRequestTable({
|
||||
actionName = "Stwórz zgłoszenie do CMU",
|
||||
requestTitle = "Poproś o pomoc Civil Medical Union",
|
||||
requestMessage = "Wprowadź swoje zgłoszenie dla Civil Medical Union. Twoje imię i CID zostaną automatycznie dodane do zgłoszenia. Nie zapomnij podać swojej lokalizacji!",
|
||||
requestType = REQUEST_MED
|
||||
})
|
||||
|
||||
ITEM.functions.RequestCwu = GetRequestTable({
|
||||
actionName = "Stwórz zgłoszenie do CWU",
|
||||
requestTitle = "Poproś o pomoc Civil Workers Union",
|
||||
requestMessage = "Wprowadź swoje zgłoszenie dla Civil Workers Union. Twoje imię i CID zostaną automatycznie dodane do zgłoszenia. Nie zapomnij podać swojej lokalizacji!",
|
||||
requestType = REQUEST_WORK
|
||||
})
|
||||
|
||||
ITEM.functions.Bind = {
|
||||
name = "Przypisz CID",
|
||||
icon = "icon16/vcard_edit.png",
|
||||
OnClick = function(itemTable)
|
||||
local cards = {}
|
||||
|
||||
for _, v in pairs(LocalPlayer():GetCharacter():GetInventory():GetItemsByUniqueID("id_card")) do
|
||||
table.insert(cards, {
|
||||
text = v:GetName(),
|
||||
value = v
|
||||
})
|
||||
end
|
||||
|
||||
local cardsCount = table.Count(cards)
|
||||
if (cardsCount > 1) then
|
||||
Derma_Select("Przypisz CID do Pagera", "Prosze wybrać CID aby go przypisać:",
|
||||
cards, "Wybierz CID",
|
||||
"Potwierdź", function(value, name)
|
||||
netstream.Start("ixBindRequestDevice", itemTable:GetID(), value:GetID())
|
||||
end, "Anuluj")
|
||||
elseif (cardsCount == 1) then
|
||||
Derma_Query("Czy jesteś pewny, że chcesz przypisać ten CID do Pagera?", "Przypisz CID do Pagera",
|
||||
"Potwierdź", function()
|
||||
netstream.Start("ixBindRequestDevice", itemTable:GetID(), cards[1].value:GetID())
|
||||
end, "Anuluj")
|
||||
else
|
||||
LocalPlayer():NotifyLocalized("Nie posiadasz CID, który można przypisać do tego pagera.")
|
||||
end
|
||||
end,
|
||||
OnRun = function(itemTable)
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(itemTable)
|
||||
if (IsValid(itemTable.entity)) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (!IsValid(itemTable.player)) then
|
||||
return false
|
||||
end
|
||||
|
||||
local inventory = itemTable.player:GetCharacter():GetInventory()
|
||||
if (!inventory:HasItem("id_card")) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (!itemTable:GetData("cardID", false)) then
|
||||
return true
|
||||
end
|
||||
|
||||
if (inventory:GetItemCount("id_card") == 1 and inventory:GetItemByID(itemTable:GetData("cardID"))) then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
}
|
||||
|
||||
if (CLIENT) then
|
||||
netstream.Hook("rdMoreThanOneText", function(text)
|
||||
PLUGIN.rdText = text
|
||||
end)
|
||||
end
|
||||
Reference in New Issue
Block a user