• From Weapons to Entities
    0 replies, posted
So recently I bought this script from coderhire called "NPC Gun Dealer w. Robbery" which is obviously a NPC gun dealer that can be robbed. But it only sells guns. So what I need help with is changing it from weapons to entities, like so instead of placing weapons there, I want to place entities such as food and maybe printers to replace the F4 tab. Please help :) Heres some of the init.lua (Not publishing the whole thing so it's basicly leaked) [CODE][function ENT:SpawnFunction( ply, tr ) if ( !tr.Hit ) then return end local SpawnPos = tr.HitPos + tr.HitNormal * 16 npc2 = ents.Create( "npc" ) npc2:SetPos( SpawnPos ) npc2:Spawn() npc2:Activate() return ent end function ENT:Initialize() self:SetModel("models/odessa.mdl") self:SetHullType(HULL_MEDIUM) self:SetHullSizeNormal() self:SetNPCState(NPC_STATE_SCRIPT) self:CapabilitiesAdd(CAP_TURN_HEAD) self:SetSolid(SOLID_BBOX) self:SetUseType(SIMPLE_USE) self:DropToFloor() selfEnt = self self:SetMaxYawSpeed(90) end function ENT:OnTakeDamage(dmg) end function ENT:AcceptInput( Name, Activator, Caller ) if Name == "Use" and Caller:IsPlayer() then if self.Busy then Caller:SendLua( [[ chat.AddText( Color(0,200,0), "[NPC SHOP]", Color(255,255,255, 255)," Call the cops, i'm being robbed!")]]) return end umsg.Start("convobox", Caller) umsg.End() end local weapon = Caller:GetActiveWeapon() if weapon:Clip1() < 1 then return end if Name == "Use" and weapon:IsValid() then umsg.Start("Robbery", Caller) umsg.Entity(self) umsg.Bool(self.Robbing) umsg.End() end end util.AddNetworkString("Purchased") net.Receive("Purchased", function(len, player) local TheWeapon = net.ReadString() local ID = net.ReadString() if NPC.DarkRP25 then if player:canAfford(NPC_Goods[ID].ThePrice) then player:addMoney(-NPC_Goods[ID].ThePrice) player:Give(TheWeapon) player:SendLua( [[ chat.AddText( Color(0,200,0), "[NPC SHOP]", Color(255,255,255), " You have purchased a ]]..NPC_Goods[ID].TheName..[[.")]]) else player:SendLua( [[ chat.AddText( Color(0,200,0), "[NPC SHOP]", Color(255,255,255), " You cannot afford a ]]..NPC_Goods[ID].TheName..[[.")]]) end else if player:CanAfford(NPC_Goods[ID].ThePrice) then player:AddMoney(-NPC_Goods[ID].ThePrice) player:Give(TheWeapon) player:SendLua( [[ chat.AddText( Color(0,200,0), "[NPC SHOP]", Color(255,255,255), " You have purchased a ]]..NPC_Goods[ID].TheName..[[.")]]) else player:SendLua( [[ chat.AddText( Color(0,200,0), "[NPC SHOP]", Color(255,255,255), " You cannot afford a ]]..NPC_Goods[ID].TheName..[[.")]]) end end /* player:SendLua( [[ chat.AddText( Color(0,200,0), "[NPC SHOP]", Color(255,255,255), " You cannot afford a ]]..NPC_Goods[ID].TheName..[[.")]]) */ end)[/CODE]
Sorry, you need to Log In to post a reply to this thread.