• How to restrict picking up all scars with the physgun darkrp?
    5 replies, posted
Ok so I have been trying to do this for quite some time and I don't really want to put each car in manually so would there be a universal way to make it so people can't physgun their cars in FPP? I moved the post over to here since I wasn't getting anything over in Dev Support.
[url]http://wiki.garrysmod.com/page/GM/PhysgunPickup[/url] [url]http://wiki.garrysmod.com/page/Entity/IsVehicle[/url]
[CODE]function restrictPickup( ply, ent ) if ply:IsVehicle() then if ply:IsAdmin() then return true else return false end end end hook.Add( "PhysgunPickup", "Allow Player Pickup", PlayerPickup )[/CODE] That should work, If not just give me a shout.
[QUOTE=robheadshot;46368359][CODE]function restrictPickup( ply, ent ) if ply:IsVehicle() then if ply:IsAdmin() then return true else return false end end end hook.Add( "PhysgunPickup", "Allow Player Pickup", PlayerPickup )[/CODE] That should work, If not just give me a shout.[/QUOTE] Does not work :(
[QUOTE=logan2611;46419381]Does not work :([/QUOTE] First of all it is checking if ply:IsVehicle() when it should be checking if ent:IsVehicle() Although I'm not sure if :IsVehicle() actually works on SCars, if it doesn't you can just check the class name since they all start with sent_sakarias_car_ [CODE]local function DontPickupSCars( ply, ent ) if string.StartWith(ent:GetClass(),"sent_sakarias_car_") then return false end end hook.Add( "PhysgunPickup", "Don't Pickup SCars", DontPickupSCars )[/CODE]
[QUOTE=wh1t3rabbit;46419986]First of all it is checking if ply:IsVehicle() when it should be checking if ent:IsVehicle() Although I'm not sure if :IsVehicle() actually works on SCars, if it doesn't you can just check the class name since they all start with sent_sakarias_car_ [CODE]local function DontPickupSCars( ply, ent ) if string.StartWith(ent:GetClass(),"sent_sakarias_car_") then return false end end hook.Add( "PhysgunPickup", "Don't Pickup SCars", DontPickupSCars )[/CODE][/QUOTE] It works thanks
Sorry, you need to Log In to post a reply to this thread.