Hello! Im trying to make a job where you have to pay your hard earned cash to be able to change to it. But the thing is it won't charge me money. I did find it on a random forum but it did seem promising, but something is wrong, i tried putting
if ply:canAfford(10000000) then
ply:addMoney(-10000000)
aswell
hook.Add("playerCanChangeTeam", "HELLO!_IM_A_SHIT_FUCKING_HOOK_CAUSE_A_CUSTOMCHECK_WONT_WORK", function(ply, team, isforced)
if team == TEAM_REPLACE then
if ply:canAfford(10000000) then
ply:addMoney(-0)
return true
else
return false
end
end
end)
You could try
ply:setDarkRPVar("money", ply:getDarkRPVar("money") - amount)
[ERROR] A runtime error has occurred in "addons/darkrpmodification/lua/darkrp_customthings/jobs.lua" on line 269.
The best help I can give you is this:
'ply' is being indexed like it is a table, but in reality it does not exist (is nil).
Hints:
- You either have 'something.somethingElse', 'something[somethingElse]' or 'something:somethingElse(more)'. The 'something' here does not exist.
The responsibility for the error above lies with (the authors of) one (or more) of these files:
1. addons/darkrpmodification/lua/darkrp_customthings/jobs.lua on line 269
2. gamemodes/darkrp/gamemode/libraries/fn.lua on line 84
3. gamemodes/darkrp/gamemode/libraries/fn.lua on line 84
4. gamemodes/darkrp/gamemode/libraries/modificationloader.lua on line 137
5. gamemodes/darkrp/gamemode/libraries/modificationloader.lua on line 148
6. gamemodes/darkrp/gamemode/init.lua on line 111
------- End of Simplerr error -------
https://forum.darkrp.com/threads/jobs-cost-money.5625/ - Read this again. Preferably on the stuff that Bo98 and FPtje said.
Sorry, you need to Log In to post a reply to this thread.