So i want to make it so admins can pick up car on my darkrp server and there is a setting for it in FPP that allows you to do this but also it makes it so you can move other things like doors and i want them to only move cars can someone help me with fixing this!
[CODE]
local function PhysgunPickup(ply, ent)
--If the player is an admin, and the entity is a door or a player,
if ply:IsAdmin() and (ent:GetClass():lower() == "func_door" or ent:GetClass():lower() == "player")
return false -- Deny pickup
elseif ply:IsSuperAdmin() then
return true
end
end
hook.Add("PhysgunPickup", "Physgun.DenyShit", PhysgunPickup)
[/CODE]
This will help you get started if it doesn't at least solve your problem. You may have to add exceptions for yourself, or remove the superadmin exception. I don't know, whatever you're in to.
[QUOTE=vegasx;41838794][CODE]
local function PhysgunPickup(ply, ent)
--If the player is an admin, and the entity is a door or a player,
if ply:IsAdmin() and (ent:GetClass():lower() == "func_door" or ent:GetClass():lower() == "player")
return false -- Deny pickup
elseif ply:IsSuperAdmin() then
return true
end
end
hook.Add("PhysgunPickup", "Physgun.DenyShit", PhysgunPickup)
[/CODE]
This will help you get started if it doesn't at least solve your problem. You may have to add exceptions for yourself, or remove the superadmin exception. I don't know, whatever you're in to.[/QUOTE]
Where should i put this xD im a newb
[QUOTE=ModifiedGamer;41838818]Where should i put this xD im a newb[/QUOTE]
Create a new file, name it whatever you want, and make the extension .lua
Example: Physgundeny.lua
In that file, paste the code I presented you.
place that file into your garrysmod/garrysmod/lua/autorun
[QUOTE=vegasx;41838849]Create a new file, name it whatever you want, and make the extension .lua
Example: Physgundeny.lua
In that file, paste the code I presented you.
place that file into your garrysmod/garrysmod/lua/autorun[/QUOTE]
I get this error
[ERROR] lua/autorun/admincars.lua:4: 'then' expected near 'return'
1. unknown - lua/autorun/admincars.lua:0
Can you fix it?
[CODE]
local function PhysgunPickup(ply, ent)
--If the player is an admin, and the entity is a door or a player,
if ply:IsAdmin() and (ent:GetClass():lower() == "func_door" or ent:GetClass():lower() == "player") then
return false -- Deny pickup
elseif ply:IsSuperAdmin() then
return true
end
end
hook.Add("PhysgunPickup", "Physgun.DenyShit", PhysgunPickup)
[/CODE]
Amateur mistake, my bad.
[QUOTE=vegasx;41838939][CODE]
local function PhysgunPickup(ply, ent)
--If the player is an admin, and the entity is a door or a player,
if ply:IsAdmin() and (ent:GetClass():lower() == "func_door" or ent:GetClass():lower() == "player") then
return false -- Deny pickup
elseif ply:IsSuperAdmin() then
return true
end
end
hook.Add("PhysgunPickup", "Physgun.DenyShit", PhysgunPickup)
[/CODE]
Amateur mistake, my bad.[/QUOTE]
Thanks soooooo much this worked!
Ok so i used this code for a while but there is still some other props people can pick up so i was wondering if you could make like the opposite of this code where they can only touch cars so like it makes it so you can physgun cars instead of blocking physgun on an object! Please post the code thanks!
Well do you have any car mods or are you using just the Airboat and Jeep?
Im using TDM cars but i think you could use prop_vehicle_jeep
Well I think it would be also pretty simple to take control of your admins and demote them if they don't do what they're supposed to..
But, that'd be too easy.
assuming that most TDM car classes are like tdm_baghotty then you could do it like this
[CODE]
local function PhysgunPickup(ply, ent)
--If the player is an admin, and the entity is a door or a player,
if ply:IsAdmin() and not ( string.match(ent:GetClass():lower(), "tdm_") or ent:GetClass():lower() == "jeep" or ent:GetClass():lower() == "airboat") then
return false -- Deny pickup
elseif ply:IsSuperAdmin() then
return true
elseif ply:IsAdmin() and ( string.match(ent:GetClass():lower(), "tdm_") or ent:GetClass():lower() == "jeep" or ent:GetClass():lower() == "airboat") then
return true
end
end
[/CODE]
No guarantees it'll work though.
This is how I do it:
[lua] //
// Allow admins to pick up vehicles - Josh 'Acecool'
//
if ( _ent:IsVehicle( ) && _p:IsAdmin( ) ) then
if ( SERVER ) then // Unfortuneately GetDriver and GetPassenger is serverside only. This means the beam will appear to lag for clients.
if ( IsValid( _ent:GetDriver( ) ) ) then
if ( _ent:GetDriver( ):IsAdmin( ) && !_p:IsHigherLevel( _ent:GetDriver( ) ) ) then
return false
end
end
end
return true;
end[/lua]
Where _p is the Player, and _ent is the target. IsHigherLevel is a custom function to ensure that lower level admins can't pick up higher level admins.
I run a DarkRP server and people are allowed to physics gun their vehicles. I added prop_vehicle_jeep to the physgun blacklist but this also disabled body groups and admins aren't allowed to pick them up neither.
Is there an easy way to stop everyone except an admin from picking up vehicles? Blocking this from everyone else but still allowing them to customize their bodygroups on their cars using C + Right Click? I think this does something close to it, not too proficient with LUA coding. Thanks.
FPP, is the problem most of the time. I tryed to fix it on my server but the ranks are fine but the code still works.
This worked well,
[CODE]local function PhysgunPickup(ply, ent)
--If the player is an admin, and the entity is a door or a player,
if ply:IsAdmin() and (ent:GetClass():lower() == "func_door" or ent:GetClass():lower() == "player") then
return false -- Deny pickup
elseif ply:IsSuperAdmin() then
return true
end
end
hook.Add("PhysgunPickup", "Physgun.DenyShit", PhysgunPickup)[/CODE]
but is there a way to make it so we can't pick up doors? Just cars?
Nekroposter.. (and duplicate) @Robotboy655 please close this thread.
?
[QUOTE=Lex Umbram;48769632]?[/QUOTE]
"2013"
How do i disable players normal users to pick up tdm cars?
Sorry, you need to Log In to post a reply to this thread.