how do i remove permission from players. to not be able to use no colision
4 replies, posted
so i got cars and i don't want players to abuse the c menu to no colision cars
i want them to not be able to use that. is there any way that i can fix that?
you can use hook.Add to hook into SANDBOX/CanProperty and return false if they are trying to nocollide their car
you should also hook into SANDBOX/CanTool because there's also the nocollide tool which can be used to disable collisions as well
post in here what scripts you make with this advice
i tried
hook.Add( "CanProperty", "canproperty.blockcollision", function( pPlayer, sProperty, pEntity )
if sProperty == "collision" && !pPlayer:IsSuperAdmin() then
return false
end
but it didn't work.? people can still disable colision
it didn't work because you made a mistake
hook.Add( "CanProperty", "canproperty.blockcollision", function( pPlayer, sProperty, pEntity )
if sProperty == "collision" && !pPlayer:IsSuperAdmin() then
return false
end
--the stuff below here is what you forgot and that's what caused a lua error and therefore the code's failure
end)
my code, you should put this into a shared file
hook.Add("CanProperty","no_nocolliding_cars",function(Ply,property,ent)
if ent and ent:IsValid() then-- make sure ent is a valid entity
if property == "collision" and ent:GetClass()=="prop_vehicle_jeep" then
--are they trying to use the nocollide property on a car?
return false--return false to block the action
end
end
end)
hook.Add("CanTool","no_nocolliding_cars",function(ply,trace,tool)
local ent=trace and trace.Entity--make sure trace is a table
if ent and ent:IsValid() then--make sure it's a valid entity
if tool == "nocollide" and ent:GetClass()=="prop_vehicle_jeep" then
--are they trying to use the nocollide tool on a car?
return false--return false to block the action
end
end
end)
thanks for the help mate. appreciate it btw check out my other thread
clientside lua viewer?
Sorry, you need to Log In to post a reply to this thread.