General > Developers Corner
ULX Stuck command
TheHyperDrive:
Okay, so the command works well. A little too well actually. Players use it often, to evade capture. Here is my code as it is:
--- 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(189,236,182), "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 )
ULib.tsayColor( _, Color( 255, 0, 0), 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 ---
I want some help adding a couple things. One (as you can see by my previous version) is a cooldown timer. I have attempted to add timer.Simple() and timer.Create(), but neither do a cooldown effect. Also the hunters abuse it because each time it gives them an extra smg grenade. Is there a way to block this, or change their weapons to exclude the smg on spawn?
An Error Has Occurred!
array_keys(): Argument #1 ($array) must be of type array, null given
[0] Board index
Go to full version