Skip to content

Commit

Permalink
Require the card to be in hand to make payments
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom committed May 24, 2020
1 parent 6eb7108 commit 0953f01
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lua/entities/glorifiedbanking_cardreader/cl_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ function ENT:Think()
self.IsMerchant = self.LocalPlayer == self:GetMerchant()
end

function ENT:InsertCard() end

local scrw, scrh = 530, 702
--Button press/submit button press method for amount entry
ENT.Screens[1].onEnterPressed = function(self, amount)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ i18n.RegisterPhrases( "en", {
gbPaymentOf = "PAYMENT OF",
gbToAccount = "TO %s",
gbCantPaySelf = "You can't pay yourself!",
gbNeedCard = "You need to have your card in hand to make this payment!",
gbConfirm = "CONFIRM",
gbEnterAmount = "ENTER AMOUNT",
gbAdminMenuPlayers = "PLAYERS",
Expand Down
6 changes: 6 additions & 0 deletions lua/glorifiedbanking/modules/core/sv_glorifiedbanking_net.lua
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ net.Receive("GlorifiedBanking.CardReader.ConfirmTransaction", function( len, ply

if not ATMDistanceChecks( ply, readerEntity ) then return end
if readerEntity:GetClass() != "glorifiedbanking_cardreader" then return end

if ply:GetActiveWeapon():GetClass() != "glorifiedbanking_card" then
GlorifiedBanking.Notify(ply, NOTIFY_ERROR, 5, i18n.GetPhrase("gbNeedCard"))
return
end

if ply == readerEntity:GetMerchant() then
readerEntity:EmitSound("GlorifiedBanking.Beep_Reader_Error")
GlorifiedBanking.Notify(ply, NOTIFY_ERROR, 5, i18n.GetPhrase("gbCantPaySelf"))
Expand Down

0 comments on commit 0953f01

Please sign in to comment.