• LUA script that swap entities on map spawn
    3 replies, posted
Hey everyone, I'm looking for a script that scans every weapon, ammo and item in a map, and swap them for something else. This would make it easier to put some maps on a server without changing the entities IN the vmf... Example : weapon_xxx becomes weapon_yyy I'm a total noob in lua so I'm really looking for someone to give me a hand
You gotta do it by yourself. I dont think theres a addon for that
Crap... Welp, entspy, here I come.
If you'd still like to try doing it via Lua you could take a look at how TTT does it. Here's some example psuedocode to help you out (don't copy and paste it, it's not fully functional) This is serverside code. You'll need to create the ReplaceSingle function, and replace a few things. local function ReplaceEntities() for k, v in pairs( all entities ) do if v:GetClass() == "class_to_replace" then ReplaceSingle(v, "new_class") end end end hook.Add("Initialize", "ReplaceEntities", ReplaceEntities) hook.Add("PostCleanupMap", "ReplaceEntities", ReplaceEntities)
Sorry, you need to Log In to post a reply to this thread.