• GavityGun targeting vehicles.
    7 replies, posted
Alright, so I've added a new Prop Protection Addon to my server. And it's actually pretty good. except for one thing. Theres this setting called " Grav-Gun Protection " With it enabled Players cannot use their GravityGun on enitiys that they paid for in the F4 menu. and it tells them "You are not allowed to use the Grav-Gun on this object!" So, I've disabled this option. But without it, players can left click on vehicles and send people shooting 20-30 feet.. As you can tell, this if very mingy. Anyone know how to disable GavityGun targeting vehicles?
in a shared execution location (client+server), [code]hook.Add("GravGunPunt","NoMoreVehiclePunt",function(ply,ent) if ent.IsVehicle && ent:IsVehicle() then return false end end)[/code]
[QUOTE=bitches;48289956]in a shared execution location (client+server), [code]hook.Add("GravGunPunt","NoMoreVehiclePunt",function(ply,ent) if ent.IsVehicle && ent:IsVehicle() then return false end end)[/code][/QUOTE] Thank you, this works perfectly. Sidenote: Is it possible to disable prop collisions with vehicles? This would be extremely beneficial to stunting prop pushers.
[code] local vehicleanticollide = {"prop_physics",} hook.Add("ShouldCollide","NoMoreVehiclePropCollide",function(ent1,ent2) if (ent1.IsVehicle && ent1:IsVehicle() && table.HasValue(vehicleanticollide,ent2:GetClass())) || (ent2.IsVehicle && ent2:IsVehicle() && table.HasValue(vehicleanticollide,ent1:GetClass())) then return false end end) [/code] Again, shared but this blacklists certain entity classes from collision a player could still swing an entity such as a printer, since that class isn't blacklisted a whitelist may be a better idea, but then you'll have lots of unexpected things that it doesn't collide with [editline]25th July 2015[/editline] to make this into a whitelist, insert a ! mark immediately before the two cases of the word table to find things to enforce the vehicles to collide with, including the world itself, put this into your [B]game console, in singleplayer on your map with clientside lua enabled[/B]: lua_run_cl local a = LocalPlayer():GetEyeTrace().Entity if IsValid(a) then print(a:GetClass()) end and then make sure the printed class name exists in the table at the top, in quotes, all separated by commas it will print the string needed by the table, of the thing you are currently staring at you could also do this to find items to blacklist, but every single kind of gun or other item or camera prop or other entity would need to be blacklisted, so changing this to a whitelist is a better plan
is gravity gun mean "weapon_physcannon" or "weapon_physgun" ?
physgun is the blue one that freezes items physcannon is orange and shoots items around
[QUOTE=bitches;48290105][code] local vehicleanticollide = {"prop_physics",} hook.Add("ShouldCollide","NoMoreVehiclePropCollide",function(ent1,ent2) if (ent1.IsVehicle && ent1:IsVehicle() && table.HasValue(vehicleanticollide,ent2:GetClass())) || (ent2.IsVehicle && ent2:IsVehicle() && table.HasValue(vehicleanticollide,ent1:GetClass())) then return false end end) [/code] Again, shared but this blacklists certain entity classes from collision a player could still swing an entity such as a printer, since that class isn't blacklisted a whitelist may be a better idea, but then you'll have lots of unexpected things that it doesn't collide with [editline]25th July 2015[/editline] to make this into a whitelist, insert a ! mark immediately before the two cases of the word table to find things to enforce the vehicles to collide with, including the world itself, put this into your [B]game console, in singleplayer on your map with clientside lua enabled[/B]: lua_run_cl local a = LocalPlayer():GetEyeTrace().Entity if IsValid(a) then print(a:GetClass()) end and then make sure the printed class name exists in the table at the top, in quotes, all separated by commas it will print the string needed by the table, of the thing you are currently staring at you could also do this to find items to blacklist, but every single kind of gun or other item or camera prop or other entity would need to be blacklisted, so changing this to a whitelist is a better plan[/QUOTE] Alright, seems to be working. Thank you! I'm probably starting to get annoying with all the questions. but I have this one last thing. Okay, so I'm trying to disable player to player collisions ( This will stop body blockers & players getting stuck in each other. etc) Here's the code [code] hook.Add("ShouldCollide","NCPlayers",function(a,b) if a:IsPlayer() and b:IsPlayer() then -- If both ents are players, return false return false elseif a:IsPlayer() or b:IsPlayer() then -- Will make other stuff, like bullets collide with players return true -- (We don't just write "return true" here due to things like the no collide tool. As it would the collision between no collided props) end end) hook.Add("PlayerInitialSpawn","NoCollide Players", function(ply) ply:SetCustomCollisionCheck(true) end) [/code] The above code works, but it's impossible to target players with your physgun & M9K weapons do no damage. any ideas how this could be fixed? c:
In your else if you made it so that, of one entity is a player but not both, no collision occurs.
Sorry, you need to Log In to post a reply to this thread.