General > Developers Corner
ULX Stuck command
Aharon Tager:
Why don't you make a command based off of "!tp" (modified with your 5-second timer), but add a timer that's long enough that the command can't be abused effectively?
Practically, if you are interested in making such a command you have to be ready for the trolls, but that's really the same thing as RDM in TTT, job switching in DarkRP and things of that nature, you just have to have good admins to prevent too many people from abusing this.
TheHyperDrive:
Well here is mine:
--- Code: ---function ulx.stuck( calling_ply )
if not calling_ply:Alive() then
ULib.tsayColor(calling_ply, _, Color(255, 0, 0), "You can't do that!")
else
local pos = calling_ply:GetPos()
ULib.tsayColor( calling_ply, true, Color( 255, 0, 0 ), "You will be respawned in 5 seconds. DONT MOVE YOUR MOUSE OR TRY TO WALK!" )
timer.Simple(5, function()
if IsValid( calling_ply ) then
if calling_ply:GetPos() == pos then
calling_ply:Spawn()
calling_ply:SetHealth( 50 )
calling_ply:StripWeapon("weapon_smg1")
calling_ply:Give("weapon_ar2")
calling_ply:GiveAmmo(250, "ar2")
ULib.tsayColor( _, Color(255, 60, 60, 255), calling_ply:Nick(), Color(0, 0, 255), " has been unstuck!:")
else
ULib.tsayColor(calling_ply, _, Color(255, 127, 0), "You moved during respawn cool down. Respawning aborted.")
end
end
end)
end
end
local stuck = ulx.command( "Prophunt", "ulx stuck", ulx.stuck, "!stuck" )
stuck:defaultAccess( ULib.ACCESS_ALL )
stuck:help( "Respawns you after 5 seconds if you're stuck" )
--- End code ---
If anyone has suggestions for improvement, I'd love to hear it!
Navigation
[0] Message Index
[*] Previous page
Go to full version