[OLD](May-be) You may think this is odd but when I use my command on a player, they lose the ability to move and ULX does not recognize them as being in the server. They also lose any ranks they had on the server.
------------
My new code...
-- ULX Zombify for ULX SVN/ULib SVN by HeLLFox_15 with assistance from MrPresident, Megiddo, and JamminR
-- Organized by MrPresident
function Spawnzomb( pl, pos, ang, ztime )
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()
pl.zomb:SetNPCState(3)
pl:Spectate( OBS_MODE_DEATHCAM )
pl:SpectateEntity( pl.zomb )
if not ( pl.zomb ) then DespawnZomb( pl, pl.zomb, pos ) end
if ( pl.zomb ) then
timer.Create( "zombRemove_"..CurTime(), ztime, 1, DespawnZomb, pl, pl.zomb, pos )
end
end
function DespawnZomb( pl, zomb, pos )
if ( zomb and zomb:IsValid() ) then
pl:UnSpectate()
zomb:Remove()
end
pl:Spawn()
pl:SetPos( pos )
end
function ulx.zombify( calling_ply, target_ply, ztime )
for _,pl in pairs( target_ply ) do
local pos = pl:GetPos()
local ang = pl:GetAngles()
local Effect = EffectData()
Effect:SetOrigin(pos)
Effect:SetStart(pos)
Effect:SetMagnitude(512)
Effect:SetScale(128)
util.Effect("cball_explode", Effect)
pl:EmitSound( "ambient/creatures/town_zombie_call1.wav", 100, 100 )
pl:StripWeapons()
Spawnzomb( pl, pos, ang, ztime )
end
ulx.fancyLogAdmin( calling_ply, "#A zombified #T for #s seconds", target_ply, ztime )
end
local zombify = ulx.command( "Fun", "ulx zombify", ulx.zombify, "!zombify" )
zombify:addParam{ type=ULib.cmds.PlayersArg }
zombify:addParam{ type=ULib.cmds.NumArg, hint="ztime", min=10, max=60, default=10, ULib.cmds.optional }
zombify:defaultAccess( ULib.ACCESS_SUPERADMIN )
zombify:help( "Turn a players into zombies." )
It seems to work...
L 07/26/2011 - 07:01:03: Log file started (file "logs\L0726000.log") (game "C:\srcds\orangebox\garrysmod") (version "4616")
L 07/26/2011 - 07:01:28: "Bot01<2><BOT><>" connected, address "none"
L 07/26/2011 - 07:01:28: "Bot01<2><BOT><>" entered the game
L 07/26/2011 - 07:01:29: server_cvar: "sv_tags" "alltalk,garrysmod125,gm:sandbox,gravhull,scriptenforcer,wiresvn2463"
L 07/26/2011 - 07:02:02: [ULX] (Console) zombified Bot01 for 10 seconds
L 07/26/2011 - 07:06:14: Log file closed
How ever I would like a ulx.fancyLogAdmin() to tell every one that the player you ran it on has been "unzombified".