Give this a try... I redid a little bit of the code for you. you had a lot of stuff in there that was unnecessary. I also broke it into 3 functions. Rather than doing all of the removing and respawning the player in timers I added a function that would take care of all of it and used that instead.
This is untested, but I think it SHOULD work. Let me know if there are any errors.
function Spawnzomb( pl, pos, ang )
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( "zombRemove_"..CurTime(), 120.5, 1, DespawnZomb( pl ) )
end
function DespawnZomb( pl )
if pl.zomb then
pl.zomb:Remove()
end
pl:UnSpectate()
pl:Freeze( false )
pl:Spawn()
end
function ulx.zombify( calling_ply, target_ply )
local pl = target_ply
pl:EmitSound( "ambient/creatures/town_zombie_call1.wav", 100, 100 )
timer.Create( "zombSpawn_"..CurTime(), 1, 1,
Spawnzomb( pl, pl:GetPos(), pl:GetAngles() )
)
pl:StripWeapons()
pl:Spectate( OBS_MODE_CHASE )
pl:SpectateEntity( pl.zomb )
ulx.fancyLogAdmin( calling_ply, "#A zombified #T for a #s amount of time", command, target_ply )
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: This can only be used on a single player." )
K, science Gmod just came up I wont be able to give it a try to day but I will test it out tomorrow. I see that you also reordered it a little, so in that order you have
1. spawn the zomb entity
2. remove and undo effects on the player
3. apply effects onto the player and call zomb spawn.
so when it runs it should use this order 3,1,2
Edit: in response to JamminR. Yes I understand it, and K I will change it in the release, I am also going to see if I can add a nice effect to when the player disappears and the zombie spawns.