--[[ | 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 netstream = netstream local vgui = vgui local hook = hook local IsValid = IsValid local pairs = pairs local LocalPlayer = LocalPlayer local Derma_Select = Derma_Select local timer = timer local Derma_Query = Derma_Query local PLUGIN = PLUGIN netstream.Hook("ixCreditTransactionLog", function(data, bShowReadButton) local transactionUI = vgui.Create("ixCIDTransactionLog") transactionUI:CreateContent(data, bShowReadButton) end) netstream.Hook("ixRequestCredits", function(client, amount, reason) local clientName = hook.Run("GetCharacterName", client, "ic") or client:GetName() if (IsValid(PLUGIN.posTransactionPanel)) then client:NotifyLocalized("posTransOngoing") netstream.Start("ixDenyCreditOperation") return end local cards = {} for _, v in pairs(LocalPlayer():GetCharacter():GetInventory():GetItemsByUniqueID("id_card")) do cards[#cards + 1] = { text = v:GetName(), value = v } end local amountPercent = amount / 100 local vat = math.Round(amountPercent * ix.config.Get("transactionVatPercent", 2)) local cardsCount = #cards if (cardsCount > 1) then PLUGIN.posTransactionPanel = Derma_Select("Transaction", clientName.." vous demande "..amount.." crédits pour : '"..reason.."'. Transaction vat: " .. vat .. " crédit(s). Quelle carte choisissez-vous pour payer ?", cards, "Sélectionner carte CID", "Confirmer", function(value, name) netstream.Start("ixConfirmCreditOperation", value:GetID()) timer.Remove("ixPosTransactionQuery") end, "Refuser", function() netstream.Start("ixDenyCreditOperation") timer.Remove("ixPosTransactionQuery") end) elseif (cardsCount == 1) then PLUGIN.posTransactionPanel = Derma_Query(clientName.." vous demande "..amount.." crédits pour : '"..reason.."'. Confirmez-vous cette transaction ?" .. vat .. " crédit(s). Confirmer vous cette transaction?", "Transaction", "Confirmer", function() netstream.Start("ixConfirmCreditOperation", cards[1].value:GetID()) timer.Remove("ixPosTransactionQuery") end, "Refuser", function() netstream.Start("ixDenyCreditOperation") timer.Remove("ixPosTransactionQuery") end) else LocalPlayer():NotifyLocalized("Vous avez reçu une requête de transaction, mais vous n'avez pas de carte CID.") netstream.Start("ixDenyCreditOperation") return end timer.Create("ixPosTransactionQuery", 14, 1, function() client:NotifyLocalized("posTransExpired") PLUGIN.posTransactionPanel:Remove() netstream.Start("ixDenyCreditOperation") end) end) netstream.Hook("ixSelectCID", function(hasFail) local cidSelector = vgui.Create("CIDSelector") if (hasFail) then cidSelector.ExitCallback = function() netstream.Start("ixSelectCIDFail") end end cidSelector.SelectCallback = function(cardID) netstream.Start("ixSelectCIDSuccess", cardID) end end) net.Receive("changeLockAccess", function() local entity = net.ReadEntity() ix.menu.Open({["Accès Membre"] = true, ["Accès Management"] = true}, entity) end) net.Receive("changeLockAccessCmru", function() local entity = net.ReadEntity() local accessLevels = {} for i=1, 5 do accessLevels["Set Level "..tostring(i).." Access"] = true end ix.menu.Open(accessLevels, entity) end) function PLUGIN:CreateExtraCharacterTabInfo(character, informationSubframe, CreatePart) local citizenID = LocalPlayer():GetCharacter():GetCid() or "N/A" local cidPanel = informationSubframe:Add("Panel") CreatePart(cidPanel, "CID :", citizenID, "cid") end