• The weapon problem i need help with
    3 replies, posted
Hi, I have a mini games server that works perfectly, but there is a BIG problem however... When the weapons get picked up by a player they disappear, i want them to be picked unlimited amount of times. Here are the weapons i use: [url]http://steamcommunity.com/sharedfiles/filedetails/?id=148128247&searchtext=css+grenade[/url] Here is a example, lets say i want this AWP to be picked up unlimited amount of times, here is the code for that AWP: [CODE]if (SERVER) then AddCSLuaFile("shared.lua") end if (CLIENT) then SWEP.PrintName = "Magnum Sniper Rifle" SWEP.ViewModelFOV = 75 SWEP.Slot = 3 SWEP.SlotPos = 1 SWEP.IconLetter = "r" killicon.AddFont("weapon_cs_awp", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 )) end /*-------------------------------------------------------*/ SWEP.Category = "Counter-Strike" SWEP.Base = "btw_scoped_base" SWEP.HoldType = "ar2" SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.ViewModel = "models/weapons/v_snip_awp.mdl" SWEP.WorldModel = "models/weapons/w_snip_awp.mdl" SWEP.Primary.Sound = Sound("Weapon_awp.Single") SWEP.Primary.Damage = 80 SWEP.Primary.Recoil = 6 SWEP.Primary.NumShots = 1 SWEP.Primary.Cone = 0.0001 SWEP.Primary.ClipSize = 10 SWEP.Primary.Delay = 1.2 SWEP.Primary.DefaultClip = 40 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "smg1" -- Weapon Variations SWEP.UseScope = true -- Use a scope instead of iron sights. SWEP.ScopeScale = 0.55 -- The scale of the scope's reticle in relation to the player's screen size. SWEP.ScopeZoom = 6 --Only Select one... Only one. SWEP.ScopeReddot = false SWEP.ScopeNormal = true SWEP.ScopeMs = false SWEP.BoltAction = true --Self Explanatory -- Accuracy SWEP.CrouchCone = 0.0001 -- Accuracy when we're crouching SWEP.CrouchWalkCone = 0.5 -- Accuracy when we're crouching and walking SWEP.WalkCone = 0.5 -- Accuracy when we're walking SWEP.AirCone = 0.5 -- Accuracy when we're in air SWEP.StandCone = 0.0001 -- Accuracy when we're standing still[/CODE] Thanks, -sam
What you can do is make scripted entites that stay on the ground, and upon touching a player, it checks to see if they have the weapon. If not, it gives them the weapon.
Well yea but, i cant lua code properly.
You're gonna want to create a custom entity, here's an example, a bit outdated but I'm pretty sure everything in it still works. [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexf251.html[/url] Then you're going to want to look into using the entity touch hook. [url]http://wiki.garrysmod.com/page/ENTITY/Touch[/url] Inside the hook you're going to want to check if they have the weapon, and if they don't you'd give them the weapon. [url]http://wiki.garrysmod.com/page/Player/HasWeapon[/url] [url]http://wiki.garrysmod.com/page/Player/Give[/url]
Sorry, you need to Log In to post a reply to this thread.