Skip to content

Commit

Permalink
ErrorNoHaltWithStack on invalid money save attempt
Browse files Browse the repository at this point in the history
Falco suggested using ErrorNoHalt in the event some addon sets players into the negatives briefly while still allowing server operators to spot that something has gone wrong and what the culprit is

May be worthwhile to split this into 3 separate errors

Also may be worth editing /setmoney to not allow it to put a player into the negatives as everytime they gain money until they end up positive it'll throw an error. Though maybe that has the benefit to server operators in a different way (ie: they have someone who has access that shouldn't)
  • Loading branch information
lionbryce committed Dec 31, 2023
1 parent 7287eec commit 9961c2d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gamemode/modules/base/sv_data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ function DarkRP.createPlayerData(ply, name, wallet, salary)
end

function DarkRP.storeMoney(ply, amount)
if not isnumber(amount) or amount < 0 or amount >= 1 / 0 then return end
if not isnumber(amount) or amount < 0 or amount >= 1 / 0 then return ErrorNoHaltWithStack("Trying to save invalid amount of money") end

-- Also keep deprecated UniqueID data at least somewhat up to date
MySQLite.query([[UPDATE darkrp_player SET wallet = ]] .. amount .. [[ WHERE uid = ]] .. ply:UniqueID() .. [[ OR uid = ]] .. ply:SteamID64())
Expand Down

0 comments on commit 9961c2d

Please sign in to comment.