[DarkRP] Unowned props from disconnected players not being removed after " X " amount of time?

Hello fellow FacePunchers!

Today, I’m look’n for some help with this script.

Basically this is supposed to remove all disconnected players unowned props from the server after " X " amount of time. but… it doesn’t…

I have no idea what’s wrong with it " no errors that I can see in console from first glance "


local function setCleanup( ply )

	if !sv_PProtect.Settings.Propprotection[ "enabled" ] or !sv_PProtect.Settings.Propprotection[ "propdelete" ] then return end
	if sv_PProtect.Settings.Propprotection[ "adminprops" ] and ( ply:IsSuperAdmin() or ply:IsAdmin() ) then return end

	print( "[Anti-Spam] " .. ply:Nick() .. " left the server. Props will be deleted in " .. tostring( sv_PProtect.Settings.Propprotection[ "delay" ] ) .. " seconds." )

	table.foreach( ents.GetAll(), function( k, v )
		if v:CPPIGetOwner() and v:CPPIGetOwner():UniqueID() == ply:UniqueID() then
			v.pprotect_cleanup = ply:Nick()

	end )

	local nick = ply:Nick()
	timer.Create( "pprotect_cleanup_" .. nick, sv_PProtect.Settings.Propprotection[ "delay" ], 1, function()

		table.foreach( ents.GetAll(), function( k, v )

			if v.pprotect_cleanup == nick then

		end )

		print( "[Anti-Spam] Removed " .. nick .. "s Props! ( Reason: Left the Server )" )

	end )

hook.Add( "PlayerDisconnected", "pprotect_playerdisconnected", setCleanup )

local function abortCleanup( ply )

	if !timer.Exists( "pprotect_cleanup_" .. ply:Nick() ) then return end

	print( "[Anti-Spam] Aborded Cleanup! " .. ply:Nick() .. " came back!" )
	timer.Destroy( "pprotect_cleanup_" .. ply:Nick() )

	table.foreach( ents.GetAll(), function( k, v )

		if v:CPPIGetOwner() and v:CPPIGetOwner():UniqueID() == ply:UniqueID() then
			v.pprotect_cleanup = nil
			v:CPPISetOwner( ply )

	end )

hook.Add( "PlayerSpawn", "pprotect_abortcleanup", abortCleanup )

If you’d like to take a’wak at it, I’d be extreamly greatful for the help! Thanks!

FPP has this built into it. Why use a different script?

FPP is case sensative. Therefor capitalisation isn’t prohibited with ulx groups.
This causes problems with some tools that I’ve allowed to certain groups. ( Mod, Admin, V.I.P, V.I.P+ etc.)

Plus, I’ve always kinda hated FPP. :stuck_out_tongue:

Why do you have capitalisation in your ulx usergroups?

Simple really. Which looks more professional? Mod > mod, Admin > admin.

Also, this is the way I have my donator ranks set up.

V.I.P $10.00 USD
V.I.P+ $20.00 USD
Super V.I.P $30.00 USD
Extreme V.I.P $40.00 USD

Having capitalisation looks cleaner, and more appealing in general.

Marketing 101, make them want it. More professonal = More trust in the product = More sales.

Having capitalisation is just a VERY small part of that. In the long run, it will stand my server out from others. no matter how miniscule it may be.

But on a side note: I really shouldn’t have to justify it. it’s just what I’m trying to accomplish. And I’m looking for help to do just that.

Players won’t be able to see the names of the ulx groups anyway.

Even if you have a scoreboard that shows the players ulx group then you can just check if they are in the group “vip” then set the text to “V.I.P” if they are.

Never make ULX groups with capitals in them.
Might talk to a couple of people and see about ulx automatically setting them to lower case so crap like this doesn’t happen in future.

alright actually, that sounds like it will work way better.

How would I go about that?

Find the line

local name = v:Nick()

and paste this under neath it

local ULXRanks = {
	["vip"]		= "V.I.P",
	["vip+"]	= "V.I.P+",
	["supervip"]	= "Super V.I.P",
	["extremevip"]	= "Extreme V.I.P",
	["mod"]		= "Mod",
	["admin"]	= "Admin",
	--Add as many as you need, just don't forget to add commas.

local plyRank = v:GetUserGroup() or ""

for k,v in pairs(ULXRanks) do
	if plyRank == k then
		plyRank = v

Now find


and replace “playerRank” with plyRank