World Interactions

World Interaction Script (Tebex)

This is a Monday project (NOT escrowed) that allows you to make objects in the world interactive. The script is pre-configured to work with all electricity poles and most lampposts (So, there are hundreds, if not thousands, of potential interactive locations where players can obtain rewards.). Additionally, a few electrical boxes have been included in the configuration that do not require access to elevated areas. (Yes, this is a promotion for my ladder script.) You can easily add any new models in to the configuration.

  • Configure the job and item requirements
  • Set up the rewards players receive after completing the minigames
  • Define cooldowns for each model
  • The example configuration provides further details.
Config example
[hash] = {

	cooldown = 100, -- if nil then we use defaultCooldown
	-- We calculate unique identifier based on entity coordinates. Bigger objects need bigger cellSize
	--There are certainly situations where an object may be on the cell boundary, which could potentially result in the player being able to loot the same thing twice.
	cellSize = 3, -- if nil then we use defaultCellSize

	offset = vec3(0.0, 0.0, 10.0), -- target offset from entity

	radius = 1.5, -- How close we need to be

	callback(bool, bool)
	@bool cooldown
	@bool give reward
	action =  function(callback)
		PlayAnimation("amb@world_human_hammering@male@base", "base", 49)
		MiniGame(function(success)
			ClearPedTasks(PlayerPedId())
			callback(true, success)
		end)
	end,

	job = "police", -- nil or "" means no job required
	
	requiredItem = { -- nil means no item required
		name = "cigar",
		remove = true, -- remove after work
	},

	-- Choose bank, cash or items
	-- Random item will be selected from items math.random(min, max) amount
	reward = {
		-- bank = 100,
		-- cash = 100,
		items = { 
			{ name = "cigar", min = 1, max = 5 },
			{ name = "cigar2", min = 1, max = 5 },
			{ name = "cigar3", min = 1, max = 5 },
		}
	},
},

Compatibility

  • qb-core
  • ox_lib
  • ox_target
  • qb-target
  • ox_inventory
  • tgiann-inventory
  • qb-inventory
Code is accessible Yes
Subscription-based No
Lines (approximately) +300
Requirements Requirements
Support Yes

Most of my scripts are escrowed. However, any code related to frameworks is always NON-ESCROWED. This ensures you can modify these scripts to work with other frameworks if needed.

Other products

10 Likes

Good job mate!