Garry's Mod

Garry's Mod

Not enough ratings
Evan's Entity Equipped on Spawn Addon
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: Server content
Addon Tags: Fun, Roleplay
File Size
Posted
510.000 B
21 May, 2018 @ 5:04pm
1 Change Note ( view )

Subscribe to download
Evan's Entity Equipped on Spawn Addon

Description
This is a rudimentary addon that can be used on servers to give certain players entities that are equipable when they spawn and respawn. Using the people you want to have certain entities Steam IDs and entering them into the STEAM_ID table in the test.lua file, these players will now have equipable entities on spawn.
5 Comments
Brgmry 12 Dec, 2020 @ 11:31am 
local configTable = {
"TEAM_XYZ"
}
local TeamTbl = {}
hook.Add("Initialize", "convertTeamIds", function()
for index, teamStr in ipairs(configTable) do
local id = _G[teamStr]
if id then
TeamTbl[id] = true
end
end
end)

hook.Add("PlayerSpawn", "Player_Spawn_Give_Thing", function(ply)
if TeamTbl[ply:Team()] then
local ent = ents.Create("starwars_jetpack") --insert any equipable entity here
ent:SetSlotName( ent:GetClass() )
ent:SetPos(ply:GetPos())
ent:SetOwner(ply)
ent:Spawn()
ent:Activate()
ent:Use( ply, ply, USE_ON, -1 )
end
end)
Cyclops 8 Dec, 2020 @ 11:11pm 
How would I equip the entity to a job rather than a specific player?
Brgmry 15 Apr, 2020 @ 8:14am 
ents.Create is returning a nil value for me
Brgmry 15 Apr, 2020 @ 8:13am 
Is this meant to work?
Ren 1 Apr, 2019 @ 12:14am 
Holy shit. Where has this been with the Clone Jetpack?