• Can't figure it out.
    1 replies, posted
[code]AddCSLuaFile( "cl_init.lua" ) // Make sure clientside AddCSLuaFile( "shared.lua" ) // and shared scripts are sent. include('shared.lua') function ENT:Initialize() self.Entity:SetModel( "models/items/ammocrate_smg1.mdl" ) self.Entity:PhysicsInit( SOLID_VPHYSICS ) // Make us work with physics, self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) // after all, gmod is a physics self.Entity:SetSolid( SOLID_VPHYSICS ) // Toolbox local phys = self.Entity:GetPhysicsObject() if (phys:IsValid()) then phys:Wake() end self.use = false end function ENT:SpawnFunction( ply, tr ) if ( !tr.Hit ) then return end local SpawnPos = tr.HitPos + tr.HitNormal * 16 local ent = ents.Create( "sent_AmmoCrate" ) ent:SetPos( SpawnPos ) ent:Spawn() ent:Activate() return ent end function ENT:Use(activator) if (self.use) and (activator:IsAdmin()) then activator:GiveAmmo( 500, "SMG1" ) activator:GiveAmmo( 500, "Pistol" ) activator:GiveAmmo( 500, "Buckshot" ) self.use = false timer.Simple(0.1,usereply,self) end end function usereply(self) self.use = false end [/code] It doesn't work.... At all, it can only spawn... also I want it to be able to be used by anyone, but I cannot figure it out. Its a simple ammo crate that I can't seam to get working.
Then take steps back in your code. Take out the if statments in your use function and throw in a print("Testing") to debug if its working or not. It will print Testing in your console when you do the use on it if it works.
Sorry, you need to Log In to post a reply to this thread.