Hello, my name is Lex Umbram and or Sir Joe. I work on a server are a lua developer. Now the question is how in the name of all thing do I make it so I can pick up cars?
Now I did a lot of resurrect and found this:[QUOTE]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)[/QUOTE]
From:[url]https://facepunch.com/showthread.php?t=1299097[/url]
This worked, but I had problems like I can pick up doors and I only want Superadmin and up to do it. My ranks are: (user>trusted>tmod>mod>admin>headadmin>superadmin>Communitymanager>developer>co-owner>owner
I can as of now with out the code above pick up perma-props, that is fine, I just dont want to be able to pick up doors.
make an table containing the allowed groups, and check if the players rank is in the table.
Edit:
Make the same with entities you want to be able to be picked up.
Could you explain more. I am newer to ulx.
[QUOTE=Lex Umbram;48769024]Could you explain more. I am newer to ulx.[/QUOTE]
it has nothing to do with ulx at all, if you develop for an server, you should know how to do such an simple task.. I'll give you an example code.
[editline]27th September 2015[/editline]
[code]
local groups = {
"superadmin" = true,
"developer" = true,
"WhiteKitty" = true,
"Garry" = true
}
-- check if the players group is in the table(allowed)
if groups[ply:GetUserGroup()] then
-- do your shit here
end
[/code]
and the same for the entities you want to be allowed.
Should I add this to my code above? So
[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)
local groups = {
"superadmin" = true,
"developer" = true,
"owner" = true,
"co-owner" = true,
}
--check if the players group is in the table(allowed)
if groups[ply:GetUserGroup()] then
--do your shit here
end[/CODE]
Sorry I mostly do jobs. This is out of my league
Oh. My. God. If you "MOSTLY" do DarkRP Jobs, then you AINT an developer AT ALL >-<
Let me spoonfeed you the code..
Mate, I am sorry if you feel that way. I never said I was any good at coding, I just said I did it.
Part of the problem is no one is willing to lend time to teach you any thing.
[code]
local function cheekycuntspickingshitup(ply, ent)
if (ent:GetClass():lower() == "func_door" or ent:GetClass():lower() == "player") and ply:IsSuperAdmin() then return true end
end
hook.Add("PhysgunPickup", "uwotm8", cheekycuntspickingshitup)
[/code]
your in a hook, you only need to return true if the player is super so that they can pick stuff up, don't return anything at all for other players as they already can't pick up doors and players by default
you also had it before where it would only block admins from picking that stuff up but would return true for regular users
[code]
local groups = {
"superadmin" = true,
"developer" = true,
"WhiteKitty" = true,
"Garry" = true,
}
function VehiclePickupForStaff( ply, ent )
if groups[ply:GetUserGroup()] and ent:IsVehicle() then
return true
end
end
hook.Add("PhysgunPickup", "Vehicle_Pickup_for_staff", VehiclePickupForStaff)
[/code]
About the teaching shit, read the stickies, that helps for newbies, its not hard to learn GLua, since its an really simple language, sadly MrCosmicSeagull is gone.
[editline]27th September 2015[/editline]
god tabbing in the code tag is shit
So do I just add any v. to it I want?
Just use THIS code:
[code]
local groups = {
"superadmin" = true,
"developer" = true,
"WhiteKitty" = true,
"Garry" = true,
}
function VehiclePickupForStaff( ply, ent )
if groups[ply:GetUserGroup()] and ent:IsVehicle() then
return true
end
end
hook.Add("PhysgunPickup", "Vehicle_Pickup_for_staff", VehiclePickupForStaff)
[/code]
Thanks for the help.
So:
[CODE]local groups = {
"superadmin" = true,
"developer" = true,
"owner" = true,
"co-owner" = true,
}
local _ents = {
"jeep" = true,
"Seat_Airboat" = true,
"Chair_Office2" = true,
"phx_seat" = true,
"Chair_Plastic" = true,
"Seat_Jeep" = true,
"Chair_Office1" = true,
"Chair_Wood" = true,
"Airboat" = true,
"Pod" = true,
"airtugtdm" = true,
"porcycletdm" = true,
}
function VehiclePickupForStaff( ply, ent )
if groups[ply:GetUserGroup()] and _ents[ent:GetClass()] then
return true
end
end
hook.Add("PhysgunPickup", "Vehicle_Pickup_for_staff", VehiclePickupForStaff)[/CODE]
Will this work, and should I just put this in the autorun file and name it ____.lua
just use the upper code, and put it into autorun as sh_shitvehicles.lua >-<
upper code?
[code]
local groups = {
"superadmin" = true,
"developer" = true,
"WhiteKitty" = true,
"Garry" = true,
}
function VehiclePickupForStaff( ply, ent )
if groups[ply:GetUserGroup()] and ent:IsVehicle() then
return true
end
end
hook.Add("PhysgunPickup", "Vehicle_Pickup_for_staff", VehiclePickupForStaff)
[/code]
or this:
[code]
local groups = {
"superadmin" = true,
"developer" = true,
"WhiteKitty" = true,
"Garry" = true,
}
function VehiclePickupForStaff( ply, ent )
if groups[ply:GetUserGroup()] and ent:IsVehicle() then
return true
end
end
hook.Add("PhysgunPickup", "Vehicle_Pickup_for_staff", VehiclePickupForStaff)
[/code]
or that one:
[code]
local groups = {
"superadmin" = true,
"developer" = true,
"WhiteKitty" = true,
"Garry" = true,
}
function VehiclePickupForStaff( ply, ent )
if groups[ply:GetUserGroup()] and ent:IsVehicle() then
return true
end
end
hook.Add("PhysgunPickup", "Vehicle_Pickup_for_staff", VehiclePickupForStaff)
[/code]
Here goes nothing. And again thanks, not sure it working yet but.
[editline]27th September 2015[/editline]
Nope. Did not work.
[QUOTE=Lex Umbram;48769215]Here goes nothing. And again thanks, not sure it working yet but.
[editline]27th September 2015[/editline]
Nope. Did not work.[/QUOTE]
try using prints inside the if check, to see if it works.
As you said I am a newbie. Is there a video or a idiots guide to how to do simple code?
just put print("Hai") above "return true". and check your console when you try to pickup cars.
So:
[CODE]local groups = {
"superadmin" = true,
"developer" = true,
"WhiteKitty" = true,
"Garry" = true,
}
function VehiclePickupForStaff( ply, ent )
if groups[ply:GetUserGroup()] and ent:IsVehicle() then (hai)
return true
end
end
hook.Add("PhysgunPickup", "Vehicle_Pickup_for_staff", VehiclePickupForStaff)[/CODE]
I FUCKING GIVE UP HOW CANT YOU READ SIMPLE INSTRUCTIONS
[editline]27th September 2015[/editline]
[code]
local groups = {
"superadmin" = true,
"developer" = true,
"WhiteKitty" = true,
"Garry" = true,
}
function VehiclePickupForStaff( ply, ent )
if groups[ply:GetUserGroup()] and ent:IsVehicle() then
print("FUCKING HAI FFS LEARN TO READ")
return true
end
end
hook.Add("PhysgunPickup", "Vehicle_Pickup_for_staff", VehiclePickupForStaff)
[/code]
I said I am new how was I to know?
"just put [B]print("hai")[/b] over return true"
Is that hard to read?!
Ok, I did it. Nothing happened in console.
Sir Joe<STEAM__:_:_________> spawned vehicle models/nova/chair_office02.mdl
Did you physgun it..?
Yes. It would not move.
[editline]27th September 2015[/editline]
So there is no way to modifly this to just not let me touch doors?
[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]
Maybe you got any prop protection on the server (FPP, UPP etc) specially in Dark-FUCKING_TOO_MANY_SERVERS-RP
Are you saying this whole time it could just have been FPP? I am going to go fire my self.
Now, how the hell do I fix this? Because looking at the FPP I should be able to, admins can pick them up but I can't
[QUOTE=Lex Umbram;48769361]Are you saying this whole time it could just have been FPP? I am going to go fire my self.[/QUOTE]
happens when you misconfigure FPP, since it allows admins to pickup ANY entity by default(also printers and such shit).
Soooo.... How do I fix this. Ingame or in the files?
Sorry, you need to Log In to post a reply to this thread.