• Issues with /dropmoney for custom Gamemode
    2 replies, posted
[lua] function cashAct(ply,text,team) if(string.sub(text,1,5)=="/give") then local playEye=ply:GetEyeTrace() local toGiveTo=playEye.Entity local giveAmt=tonumber(string.sub(text,6)) local givenCash=tonumber(toGiveTo:GetNWInt("Cash")) local myCash=tonumber(ply:GetNWInt("Cash")) toGiveTo:SetCash(givenCash+giveAmt) ply:ChatPrint("Cash given!") ply:SetCash(myCash-giveAmt) return nil end if(string.sub(text,1,10)=="/dropmoney") then local moneyCase=ents.Create("moneyBriefcase") moneyCase:SetPos(ply:GetPos()) moneyCase:Spawn() local dropAmt=tonumber(string.sub(text,11)) moneyCase:SetVar("Holding",dropAmt) local myCash=ply:GetNWInt("Cash") ply:SetCash(myCash-dropAmt) end end hook.Add("PlayerSay","Give",cashAct) [/lua] That's the code for it dropping, however I get no errors and it should work fine, but it says error attempt to derive from unknown entity or something like that, can someone help?
moneyBreifcase probably isnt a valid entity, look for other errors or list us everything it says (full entity error thing) [editline]24th October 2010[/editline] even though if it was that it should spew a lua error though [editline]24th October 2010[/editline] Can you give us a full dump of the console?
It doesn't say anything more. I can however give you the files for the entity, if that will help. [editline]24th October 2010[/editline] Could the problem be due to that it's not derived from sandbox?
Sorry, you need to Log In to post a reply to this thread.