Alright, I have a "stuck" command that runs through ULX admin mod. It works very well, but it is very exploitable. The code is this:
[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" )[/CODE]
I want to add in a cooldown timer so people can not use it so often, lets say 10 seconds. Also hunters get a smg grenade on respawn, is there any way to fix or block that? If not, how do I strip their weapons and give them back different ones?
[url]http://wiki.garrysmod.com/page/timer/Simple[/url]
[url]http://wiki.garrysmod.com/page/Player/StripWeapon[/url]
or
[code]-- Thanks KingofBeast for help
-- Initialize this before player respawns
if IsValid(ply:GetWeapon("weapon_smg1"))
local grenade = ply:GetAmmoCount(ply:GetWeapon("weapon_smg1"):GetSecondaryAmmoType())
else
local grenade = 1
end
-- Run this after player respawn
if (grenade == 0) then
ply:SetAmmo(0, "SMG1_Grenade")
end[/code]
I also recommending doing something like
[CODE]
local plyHealth = calling_ply:Health()
calling_ply:Spawn()
calling_ply:SetHealth( plyHealth )
[/CODE]
Sorry, you need to Log In to post a reply to this thread.