GMOD ULX COMMANDS

local CATEGORY_NAME = "Matrix_"
-------Matrix_'s Prepare for shrek commnad------
function ulx.prepareforshrek( calling_ply, target_plys )
for i=1, #target_plys do
target_plys[ i ]:StripWeapons()
end

ulx.fancyLogAdmin( calling_ply, "#A has prepared #T for Shrek", target_plys )
end
local strip = ulx.command( CATEGORY_NAME, "ulx prepareforshrek", ulx.prepareforshrek, "!prepareforshrek" )
strip:addParam{ type=ULib.cmds.PlayersArg }
strip:defaultAccess( ULib.ACCESS_ADMIN )
strip:help( "Prepares player for !shrek command" )


--------SHREK----------
function SpawnShrek( Pos, Direction )
local train = ents.Create( "prop_physics" )
train:SetModel("models/props_vehicles/train_boxcar.mdl")
train:SetAngles( Direction:Angle() )
train:SetPos( Pos )
train:Spawn()
train:Activate()
train:EmitSound( "ambient/alarms/train_horn2.wav", 100, 100 )
train:GetPhysicsObject():SetVelocity( Direction * 100000 )

timer.Create( "shrekRemove_"..CurTime(), 5, 1, function( train ) train:Remove() end, train )
end

function ulx.shrek( calling_ply, target_plys )
for _, pl in ipairs( target_plys, calling_ply ) do

local Hp = pl:Health()
local Dif = Hp - 20
local HpOut = Hp - Dif
local HpSur = Hp + Dif

pl:SetMoveType( MOVETYPE_WALK )
pl:GodDisable()
pl:SetHealth(HpOut)
SpawnShrek( pl:GetPos() + pl:GetForward() * 1000 + Vector(0,0,50), pl:GetForward() * -1 )
pl:GodDisable()
pl:SetMoveType( MOVETYPE_WALK )

timer.Create( "shrekKillNot_", 6.5, 1, function( target_plys )
if pl:Alive() then pl:SetHealth(HpSur) else end
end )

end

ulx.fancyLogAdmin( calling_ply, "#A Shreked #T", target_plys )
end

local shrek = ulx.command( "Matrix_", "ulx shrek", ulx.shrek, "!shrek" )
shrek::addParam{ type=ULib.cmds.PlayersArg }
shrek::defaultAccess( ULib.ACCESS_ADMIN )
shrek:help( "Shreks a player to kingdom come" )

No comments:

Post a Comment