So i'm trying to replace all the weapons on the map with p90s because all the weapons on the map are from css and don't show up, so this is what i have tried and it hasn't worked.
[LUA]
function GM:InitPostEntity( )
local weaponz = ents.FindByClass("weapon_*")
for k, v in pairs(weaponz) do
v = ents.Create( "rcs_p90" )
v:SetPos(weaponz:GetPos())
v:Spawn()
end
end [/LUA]
Try this
[code]
function GM:InitPostEntity( )
local weaponz = ents.FindByClass("weapon_*")
for k, v in pairs(weaponz) do
local e_wep = ents.Create( "rcs_p90" )
e_wep:SetPos(v:GetPos())
v:Remove()
e_wep:Spawn()
end
end
[/code]
[QUOTE=recox998;40437560]Try this
[code]
function GM:InitPostEntity( )
local weaponz = ents.FindByClass("weapon_*")
for k, v in pairs(weaponz) do
local e_wep = ents.Create( "rcs_p90" )
e_wep:SetPos(v:GetPos())
v:Remove()
e_wep:Spawn()
end
end
[/code][/QUOTE]
Nope no luck with this.
Is it removing the weapons?
Also do PrintTable(weaponz) to make sure it getting the ents.
[QUOTE=recox998;40437620]Is it removing the weapons?
Also do PrintTable(weaponz) to make sure it getting the ents.[/QUOTE]
The table came up nil, but i know the weapons are in the map, maybe the weapons are removed before GM:InitPostEntity?
In game when the weapons are still on the map do:
sv_enablecslua 1
lua_run PrintTable(ents.FindByClass("weapon_*"))
If there are any weapons with the class prefix of "weapon_" they should be listed.
PM me if you like and we can do a join.me session.
It will never work because your CSS weapons are not even created.Add dummy entites/weapons or add proper CSS weapons.
Sorry, you need to Log In to post a reply to this thread.