ULX Arrest/Unarest Speed Issue


function ulx.arrest( calling_ply, target_ply, time )
	target_ply:arrest( time or GM.Config.jailtimer, calling_ply )
	ulx.fancyLogAdmin( calling_ply, "#A force arrested #T for #i seconds", target_ply, time or GAMEMODE.Config.jailtimer )
end
local Arrest = ulx.command( CATEGORY_NAME, "ulx arrest", ulx.arrest, "!arrest" )
Arrest:addParam{ type=ULib.cmds.PlayerArg }
Arrest:addParam{ type=ULib.cmds.NumArg, hint="arrest time", min=0, ULib.cmds.optional }
Arrest:defaultAccess( ULib.ACCESS_ADMIN )
Arrest:help( "Force arrest someone." )


function ulx.unArrest( calling_ply, target_ply )
	if target_ply:isArrested() then 
		target_ply:unArrest( calling_ply )
		target_ply:SetWalkSpeed(160)
		target_ply:SetRunSpeed(240)
	else
		ULib.tsayError( calling_ply, "The target needs to be arrested in the first place!" )
		return
	end
	ulx.fancyLogAdmin( calling_ply, "#A force unarrested #T", target_ply )
end
local unArrest = ulx.command( CATEGORY_NAME, "ulx unarrest", ulx.unArrest, "!unarrest" )
unArrest:addParam{ type=ULib.cmds.PlayerArg }
unArrest:defaultAccess( ULib.ACCESS_ADMIN )
unArrest:help( "Force unarrest someone." )

When you are unarrest via ULX command or just when the time runs out, your walk/run speed are the same

DarkRP use SetPlayerSpeed ( http://wiki.garrysmod.com/page/GM/SetPlayerSpeed )


GAMEMODE:SetPlayerSpeed( target_ply, 160, 240 )

Oh ok, thanks CodingBeast.!

[editline]17th September 2014[/editline]

Hmm that didn’t work, do I need to add a local GAMEMODE?

[editline]17th September 2014[/editline]

Would this work?


local GAMEMODE = "darkrp" or "DarkRP"

Woops sorry about that! (Should work hopefully)


local GAMEMODE = gmod.GetGamemode()

Oh ok thanks (:

[editline]17th September 2014[/editline]

Ok I don’t get script errors now because the local gamemode is correct.
but when unarrested my walk and run speed are still the same

[editline]17th September 2014[/editline]

Maybe I should do this?


GAMEMODE:SetPlayerSpeed( target_ply, GM.Config.walkspeed, GM.Config.runspeed )

[editline]17th September 2014[/editline]

That would do nothing without calling Local’s though, right?

[editline]17th September 2014[/editline]

Mehh, I think DarkRP is overriding just like it is with my other script. :confused:

If you repalace the GM with GAMEMODE it should work.

Hmm do you use the newest version of DarkRP and did you edit any core code?
Because the unArrest function should run the ‘UpdatePlayerSpeed’ hook.

I did use GAMEMODE
I am using the latest version of DarkRP
and no I would never edit core files (:

I have no clue what could be causing this speed issue.

WAIT. Hmm. I am going to try one more thing.

[editline]17th September 2014[/editline]

I am so sorry, I do not think after being up for 32+ hours haha
I totally forgot Expertise being on the server!

I removed it and fixed the issue. But while you are online, could you take a look at another thread I have about giving a player a weapon when arrested?

http://forum.facepunch.com/showthread.php?t=1425079