murilo2929 Posted October 14, 2019 Share Posted October 14, 2019 So I'm trying to change this tuning shop's money method to the one I use but I can't, can anyone help me? My money system exports.dinheiro:tDinheiro(Player, Amount) --- To see if the player has money exports.dinheiro:pDinheiro(Player, Amount) --- To take money from the player Part of the code that I think should change, but when I change it doesn't work function hasPlayerMoney(money) if getPlayerMoney(localPlayer) >= money then return true end return false end function moneyChange(amount) takePlayerMoney(loopTable[hoveredCategory]["tuningPrice"]) giveNotification("success", getLocalizedText("notification.success.purchased")) playSoundEffect("moneychange.wav") if amount > 0 then moneyChangeTable = { ["tick"] = getTickCount() + 5000, ["amount"] = amount } end end Link to comment
Addlibs Posted October 15, 2019 Share Posted October 15, 2019 The second snippet you shared appears to takePlayerMoney on the client-side, which is recommended. Do your exports support client-side calling? If not, you'll need to trigger a server event, which the server should handle, passing the amount of money to be charged, and call the exported functions then and there, on the server. If you can call your exports from the client, just put localPlayer as Player in your export parameters. Link to comment
murilo2929 Posted October 15, 2019 Author Share Posted October 15, 2019 2 hours ago, MrTasty said: The second snippet you shared appears to takePlayerMoney on the client-side, which is recommended. Do your exports support client-side calling? If not, you'll need to trigger a server event, which the server should handle, passing the amount of money to be charged, and call the exported functions then and there, on the server. If you can call your exports from the client, just put localPlayer as Player in your export parameters. então no meu metafile eu coloquei apenas assim <export function="takeMoney" type="server" /> should i put one more line like this? <export function="takeMoney" type="server" /> <export function="takeMoney" type="client" /> remembering that all code including hasplayermoney is client-side Link to comment
murilo2929 Posted October 15, 2019 Author Share Posted October 15, 2019 4 hours ago, murilo2929 said: so in my metafile I just put like this <export function="takeMoney" type="server" /> should i put one more line like this? <export function="takeMoney" type="server" /> <export function="takeMoney" type="client" /> remembering that all code including hasplayermoney is client-side Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now