Hi guys need yours help with hooks
Code tag is broken, sorry
local cl_cvar_pickup = "cl_pickupplayers"
if CLIENT then CreateClientConVar( cl_cvar_pickup, "1", true, true ) end
local function playerPickup( ply, ent )
local access, tag = ULib.ucl.query( ply, "ulx physgunplayer" )
if ent:GetClass() == "player" and ULib.isSandbox() and access and not ent.NoNoclip and not ent.frozen and ply:GetInfoNum( cl_cvar_pickup, 1 ) == 1 then
-- Extra restrictions! UCL wasn't designed to handle this sort of thing so we're putting it in by hand...
local restrictions = {}
ULib.cmds.PlayerArg.processRestrictions( restrictions, ply, {}, tag and ULib.splitArgs( tag )[ 1 ] )
if restrictions.restrictedTargets == false or (restrictions.restrictedTargets and not table.HasValue( restrictions.restrictedTargets, ent )) then
return
end
ent:SetMoveType( MOVETYPE_NONE ) -- So they don't bounce
return true
end
end
hook.Add( "PhysgunPickup", "ulxPlayerPickup", playerPickup, HOOK_HIGH ) -- Allow admins to move players. Call before the prop protection hook.
if SERVER then ULib.ucl.registerAccess( "ulx physgunplayer", ULib.ACCESS_ADMIN, "Ability to physgun other players", "Other" ) end
local function playerDrop( ply, ent )
if ent:GetClass() == "player" then
ent:SetMoveType( MOVETYPE_WALK )
end
end
hook.Add( "PhysgunDrop", "ulxPlayerDrop", playerDrop )
So I need to create new hook/rewrite without touching source code
Need to add some custom check
Pls help me
Just call hook.Add with your callback function using the same identifier?
But I need to know what's say's ulx hook, like true or false
You can use hook.GetTable to get the previous hook function to use as you need, then call hook.Add with your new function.
Sorry, you need to Log In to post a reply to this thread.