Hey guys, so on my server, iv'e got a stun-gun weapon, and id love to add it to the entities tab so people can buy it, i would add it to weapons tab, but with my F4 menu i have it removed, becaus of issues i was having, i don't know if its possible to add a weapon to the entity tab. i just tho't id bring this up with you guys!
I think only entities can turn up on the "entities" tab, so if you've disabled the weapons tab you might have to make a workaround:
You could create a simple entity which will appear on the entities tab.
When a player spawns that entity, the entity will check who spawned it, and give them the weapon, then remove itself.
[QUOTE=Mornedil;49573488]I think only entities can turn up on the "entities" tab, so if you've disabled the weapons tab you might have to make a workaround:
You could create a simple entity which will appear on the entities tab.
When a player spawns that entity, the entity will check who spawned it, and give them the weapon, then remove itself.[/QUOTE]
intresting, i am not very good with LUA, how would one do this?
[QUOTE=JosephTD;49573952]intresting, i am not very good with LUA, how would one do this?[/QUOTE]
shared.lua
[CODE]ENT.Base = "base_point"
ENT.Type = "point"
ENT.PrintName = "Super Cool Weapon!"
ENT.Category = "Weapons"
ENT.Author = "Your Name"
ENT.Spawnable = true
ENT.AdminSpawnable = false[/CODE]
init.lua
[CODE]AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
if IsValid(self) then self:Remove() end
end
function ENT:SpawnFunction( ply, tbl, ClassName )
if IsValid(ply) then
ply:Give("weapon_crowbar")
end
end
[/CODE]
cl_init.lua
[CODE]include("shared.lua")[/CODE]
I think that's it. Change the ply:Give() function to give the name of your custom weapon.
if you don't know what to do with the files, google for a gmod entity creation tutorial.
Edit:
Or you can download the code as a zip with the code already placed in lua files:
[URL="https://dl.dropboxusercontent.com/u/50211087/gmod/ent_give_crowbar.zip"]dl.dropboxusercontent.com/u/50211087/gmod/ent_give_crowbar.zip[/URL]
You still need to edit it though, since the code in the .zip gives you a crowbar ;)
Sorry, you need to Log In to post a reply to this thread.