Hey all, I'm currently working on an addon. I have run into an issue where by i am attempting to make it so once the player interacts with an entity an integer is increased by 1 named "lean_cups" and then the player should be able to walk upto an npc and sell this amount to the npc.
The issue i am having is here:
Shared:
local meta = getmetatable("Player")
function meta:SetupDataTables()
self:NetworkVar("Int",0,"lean_cups")
end
Serverside:
function ENT:Use(act,ply)
if IsValid(ply) then
self:Remove()
ply:Setlean_cups(ply:Getlean_cups()+1) -- Am i doing something wrong here?
DarkRP.notify(ply,0,4,"You have picked up a bag of Lean.")
end
end
Any help is massively appreciated as this is a major issue i have come across
If you just want to set a quick variable on the player, and you don't need to send it to the client, just do
ply.lean_cups = (ply.lean_cups) + 1
You can add a new index to the table of the player
Sorry, you need to Log In to post a reply to this thread.