PlayerUse Hook Help

Hi, I’ve having some issues with the PlayerUse hook.

Basically I have script X - script X runs code when the use key is pressed.
Then I have scripy Y - Scripy Y runs code also when use key is pressed.

For reference, script X is a passenger script for my cars. Script Y is a way to add things into your players inventory. I can get Script X to work if I disable scripy Y, and vice versa. However I can not get them to work together.

Script X:


function ChooseSeat( ply, car )
		if ply:InVehicle() then
			ply.canuse = false
			timer.Simple(2, function() ply.canuse = true end)
			return true
		end
	   
		ply.canuse = ply.canuse or true
	   
		if (car:IsVehicle() && IsValid(car:GetDriver()) && ply.canuse) then
 
		ply.canuse = false
		timer.Simple(2, function() ply.canuse = true end)
   
			local distancetable = {}
   
			for k, v in pairs(ents.FindInSphere(ply:GetPos(), 100 )) do
				if v:GetClass() == "prop_vehicle_prisoner_pod" && IsValid( v ) && car != v && v.locked == false then
					if !(IsOnCar( v, car )) then continue end
					local dtable = {
							seat = v,
							distance = v:GetPos():Distance( ply:GetPos() )
					}
					table.insert( distancetable, dtable )
				end
			end
		   
		   
			local maxdist = 500
			local nearestseat = 1
			local found = false
			for k, v in pairs( distancetable ) do
					if v.distance < maxdist then
							maxdist = v.distance
							nearestseat = k
							found = true
					end
			end
		   
		   
			if !(found) then return false end
		   
			ply:EnterVehicle( distancetable[nearestseat].seat )

		else
				return true
		end
end
hook.Add("PlayerUse", "ChooseSeattwo", ChooseSeat)

Script Y:


hook.Add("PlayerUse", "CheckItem", function(ply, ent)
		if (!ply:KeyDown(IN_WALK)) then return end
		if (!RPI.Items[ent:GetClass()]) then return false end
		if (ply.NextPickup and ply.NextPickup > CurTime()) then return end

		ply.NextPickup = CurTime() + 0.2
		
		if (ply:GetItemCount() >= ply:GetMaxItems()) then
			ply:ChatPrint("Your inventory is full.")
			return
		end
		
		if (ent:GetClass() == "spawned_shipment") then
			local id = ent:Getcontents()
			local shipment = CustomShipments[id]
		
			ply:AddItem({
				class = "spawned_shipment",
				name = shipment.name,
				count = ent:Getcount(),
				id = ent:Getcontents()
			})
		elseif (ent:GetClass() == "spawned_weapon") then
			local class = ent.weaponclass
			local weapon = {}

			for _, v in pairs (CustomShipments) do
				if (v.entity == class) then
					weapon = v
					break
				end
			end
		
			ply:AddItem({
				class = "spawned_weapon",
				name = weapon.name,
				model = weapon.model,
				weaponclass = class
			})
		elseif (ent:GetClass() == "spawned_food") then
			ply:AddItem({
				class = "spawned_food",
				name = "Food",
				model = ent:GetModel(),
				foodenergy = ent.FoodEnergy
			})
		else		
			ply:AddItem(ent:GetClass())
		end
		ply:SavePlayerInventory()

		ply:EmitSound(PICKUP_SOUND)
		ent:Remove()
		
		return false
	end)
	
	hook.Add("PlayerDisconnected", "SavePlayerInventory", function(ply)
		ply:SavePlayerInventory()
	end)
	
	concommand.Add("rp_inventory", function(ply)
		if (!ply.Inventory) then 
			ply:ChatPrint("There was en error while loading your inventory. If after rejoining this doesn't fix, contact the server administrator.") 
			return 
		end
		
		ply:OpenInventory()
	end)
	
	concommand.Add("rp_dropitem", function(ply, cmd, args)
		if (!ply.Inventory) then 
			ply:ChatPrint("There was en error while loading your inventory. If after rejoining this doesn't fix, contact the server administrator.") 
			return 
		end
		
		local itm = tostring(args[1] or "")
		if (!RPI.Items[itm]) then return end
		
		if (ply:GetItemCount(itm) <= 0) then return end
		
		local pos = ply:GetShootPos()
		local ang = ply:GetAimVector()
		
		local tracedata = {}
		tracedata.start = pos
		tracedata.endpos = pos + (ang * 100)
		tracedata.filter = ply
		local trace = util.TraceLine(tracedata)

		local ent = ents.Create(itm)
		if (!ent or !ent:IsValid()) then return end
		
		if (ply.SID) then ent.SID = ply.SID end
		if (ent.Setowning_ent) then ent:Setowning_ent(ply) end

		ent.nodupe = true
		ent:SetPos(trace.HitPos)
		ent:Spawn()
		
		ply:RemoveItem(itm)
		ply:SavePlayerInventory()
		
		ply:OpenInventory()
	end)

Thanks in advance.

[editline]15th June 2013[/editline]

Bump

using “return” in hooks will block all the next ones.
You might want to arrange your code better to allow other codes to run.