General > Developers Corner

Need some help with a ULX LUA command.

<< < (5/14) > >>

LuaTenshi:

--- Quote from: Megiddo on June 24, 2011, 08:56:01 AM ---Could you share line three and a few of the surrounding lines? Line 3 on the OP is a blank line.

--- End quote ---

Well scence I added that comment into the lua... "function Spawnzomb( Pos, Ang, pl, pl.zomb )" is in line 3.


--- Code: ----- ULX Zombify for ULX SVN/ULib SVN by HeLLFox_15 with assistance from MrPresident, Megiddo, and JamminR

function Spawnzomb( Pos, Ang, pl, pl.zomb )
R = { "npc_fastzombie", "npc_zombie", "npc_zombie_torso", "npc_zombine", "npc_fastzombie_torso" }

pl.zomb = ents.Create( R[math.random(1,5)] )
pl.zomb:SetAngles( Ang )
pl.zomb:SetPos( Pos )
pl.zomb:Spawn()
pl.zomb:Activate()
timer.Create( "zombRemoveB_"..CurTime(), 120.5, 1, function( pl.zomb, target_plys ) pl.zomb:Remove() end )

end

function ulx.zombify( calling_ply, target_plys, pl.zomb )
for _, pl in ipairs( target_plys, calling_ply ) do
pl:SetMoveType( MOVETYPE_NONE )
pl:EmitSound( "ambient/creatures/town_zombie_call1.wav", 100, 100 )

timer.Create( "zombSpawn_"..CurTime(), 1, 1, Spawnzomb( pl:GetPos(), pl:GetAngles(), pl ) )
pl:StripWeapons()
pl:Spectate( OBS_MODE_CHASE )
pl:SpectateEntity( pl.zomb )

timer.Create( "zombRemoveA_"..CurTime(), 120, 1,
function( target_plys )
pl:UnSpectate()
pl:Freeze( false )
pl:Spawn()
end )

end

ulx.fancyLogAdmin( calling_ply, "#A zombified #T for a #s amount of time", command, target_plys )
end

local zombify = ulx.command( "Fun", "ulx zombify", ulx.zombify, "!zombify" )
zombify:addParam{ type=ULib.cmds.PlayerArg }
zombify:defaultAccess( ULib.ACCESS_SUPERADMIN )
zombify:help( "Turn a player into a zombie. Note: Do not use this on multiple players." )

--- End code ---

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given

[0] Board index

Go to full version