Okay So I'm completely new to lua this is just a line from another piece of code I threw in hoping it'd work. Unsurprisingly it didn't, however I'm hoping some of you genius ladies and gentlemen may help me.
this is my code, (here's the whole file
https://github.com/Nayruden/Ulysses/blob/master/ulx/lua/ulx/modules/sh/util.lua#L161-166) I've just put the line highlighted in red into until.lua in the ULX on my server however I get the following error: attempt to index global 'ply' <a nil value>
------------------------------ Noclip ------------------------------
function ulx.noclip( calling_ply, target_plys )
if not target_plys[ 1 ]:IsValid() then
Msg( "You are god, you are not constrained by walls built by mere mortals.\n" )
return
end
local affected_plys = {}
for i=1, #target_plys do
local v = target_plys[ i ]
if v.NoNoclip then
ULib.tsayError( calling_ply, v:Nick() .. " can't be noclipped right now.", true )
else
if v:GetMoveType() == MOVETYPE_WALK then
v:SetMoveType( MOVETYPE_NOCLIP )
table.insert( affected_plys, v )
ply:SetModel( "models/crow.mdl" ) elseif v:GetMoveType() == MOVETYPE_NOCLIP then
v:SetMoveType( MOVETYPE_WALK )
table.insert( affected_plys, v )
else -- Ignore if they're an observer
ULib.tsayError( calling_ply, v:Nick() .. " can't be noclipped right now.", true )
end
end
end
end
local noclip = ulx.command( CATEGORY_NAME, "ulx noclip", ulx.noclip, "!noclip" )
noclip:addParam{ type=ULib.cmds.PlayersArg, ULib.cmds.optional }
noclip:defaultAccess( ULib.ACCESS_ADMIN )
noclip:help( "Toggles noclip on target(s)." )
I appreciate any help you can offer,
Thanks,
Instinct