Help With DarkRP Custom NPC System

So I was wanting to make an NPC Drug dealer system for my RP server I’m setting up. I tried to make it so when the desired entity drug is touched to the NPC, the owning player would get paid an amount.

I need suggestions with my code, because I don’t know LUA that well, just the basics. I took most of this stuff from various places on the GMod wiki.

[LUA]

function ENT:Touch( hitent ) if ( hitEnt:IsValid() and ( hitent == “darkrp_dealer” ) self:Remove() meta:Entity.GetOwner(): ply:AddMoney(500) endend
[/LUA]
I added this script to the end of the init.lua of the entity I want to be able to sell…

My NPC"s entity name is darkrp_dealer and my drug’s entity name is durgz_weed.

Please don’t bother telling me this code is shit, because it most likely is shit.

Also sorry if this is the wrong thread, it looked like this was the right one.

Long time I haven’t seen such scripting style. All in one line.

Also: http://forum.facepunch.com/showthread.php?t=1249475

I didn’t mean for it to be all in one line… Facepunch made it that way for some reason after I edited my post…

Thanks for the link, I’ll look in that thread, or post if needed.