Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- VORP Utils
- A Vorp Utility Script that allows you to easily interact with RedM Natives and VorpCore in a Vorp standardized way. The goal of this is to make it easier to use some of the more complicated, or heavily lined natives.
- API Docs
- Blips
- You can leverage Vorps built in function for map blips.
- Create a Blip
- Client Side Only
- Create a marker (blip) on the players map
- Parameter Description
- text What the blip will display on the map
- blipash The hashname of the blip (found here)
- scale How big the blip is
- x The x coordinate in the game world
- and The y coordinate in the game world
- With The z coordinate in the game world
- vector3 instead of params send whole vector3 just add nil to x y z
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local blip = VORPutils.Blips:SetBlip('Gift', 'blip_special_series_1', 0.2, x, y, z, vector3 or nil)
- end)
- Get Raw Blip
- Client Side Only
- If you want to use any natives that are not yet included, you can utilize the raw blip.
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local blip = VORPutils.Blips:SetBlip('Gift', 'blip_special_series_1', 0.2, x, y, z,vector3 or nil)
- local rawblip = blip.rawblip
- -- OR
- -- local rawblip = blip:Get()
- -- use rawblip with any other native.
- end)
- Delete a Blip
- Client Side Only
- Delete a marker (blip) on the players map
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local blip = VORPutils.Blips:SetBlip('Gift', 'blip_special_series_1', 0.2, x, y, z,vecotr3 or nil)
- blip:Remove()
- -- OR
- --- VORPutils.Blips:RemoveBlip(blip.rawblip)
- end)
- Add Radius to Blip
- Client Side Only
- Create a Radius blip
- Parameter Description
- radius A decimal radius
- bliphahashsh The hashname of the blip (found here) [Optional, will default to -1282792512]
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local blip = VORPutils.Blips:SetBlip('Gift', 'blip_special_series_1', 0.2, x, y, z,vector3 or nil)
- blip:AddRadius(64.0, -1282792512)
- -- OR
- -- VorpUtils.Blips:AddRadius(64.0, x, y, z, -1282792512)
- end)
- Prompts
- You can leverage Vorps built in function for easy in-game prompts.
- Setup a Prompt Group
- Client Side Only
- This sets up the Prompt Group, which will allow you to attach future prompts to this group so that they can be displayed. This is required.
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local PromptGroup = VORPutils.Prompts:SetupPromptGroup() --Setup Prompt Group
- end)
- Register Prompt
- Client Side Only
- Once you have the Prompt Group setup, you can now register a prompt to display within the group.
- Parameter Description
- title What the Prompt group will display next to the press button
- button The hash key (found here)
- enabled If 0 you cannot click, if 1 you can click
- visible If 0 you cannot see the prompt, if 1 you can see the group
- pulsing If true prompt will urgently pulse, if false it will not
- mode What kind of prompt. (Options: click, hold, customhold, mash, timed)
- options Extra Options for the Mode you select. (See Mode Options below)
- Modes Options
- Mode Key Options example
- click None None None
- hold timedeventhash SHORT_TIMED_EVENT_MP, SHORT_TIMED_EVENT, MEDIUM_TIMED_EVENT, LONG_TIMED_EVENT, RUSTLING_CALM_TIMING, PLAYER_FOCUS_TIMING, PLAYER_REACTION_TIMING
- customhold holdtime Miliseconds
- mash mashamount > 0
- timed depletiontime Miliseconds
- PromptGroup:RegisterPrompt(title, button, enabled, visible, pulsing, mode, options)
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local PromptGroup = VORPutils.Prompts:SetupPromptGroup() --Setup Prompt Group
- local firstprompt = PromptGroup:RegisterPrompt("Press Me", 0x4CC0E2FE, 1, 1, true, 'hold', {timedeventhash = "MEDIUM_TIMED_EVENT"}) --Register your first prompt
- while true do
- Citizen.Wait(0)
- end
- end)
- Display Prompt Group
- Client Side Only
- Now that you have a Group setup and a registered Prompt, you can now display the group!
- Parameter Description
- text Text to display under all the prompts
- PromptGroup:ShowGroup(text)
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local PromptGroup = VORPutils.Prompts:SetupPromptGroup() --Setup Prompt Group
- local firstprompt = PromptGroup:RegisterPrompt("Press Me", 0x4CC0E2FE, 1, 1, true, 'hold', {timedeventhash = "MEDIUM_TIMED_EVENT"}) --Register your first prompt
- while true do
- Citizen.Wait(0)
- PromptGroup:ShowGroup("My first prompt group") --Show your prompt group
- end
- end)
- Handle Prompt Completion Events
- Client Side Only
- You can trigger code when a prompt has a completion event triggered (Example: clicked, held, etc)
- Parameter Description
- hideoncomplete Some Options may hide or disapear when completed, Set this to false to not hide. This will default to true if nothing is entered
- firstprompt:HasCompleted()
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local PromptGroup = VORPutils.Prompts:SetupPromptGroup() --Setup Prompt Group
- local firstprompt = PromptGroup:RegisterPrompt("Press Me", 0x4CC0E2FE, 1, 1, true, 'hold', {timedeventhash = "MEDIUM_TIMED_EVENT"}) --Register your first prompt
- while true do
- Citizen.Wait(0)
- --Show your prompt group
- PromptGroup:ShowGroup("My first prompt group")
- -- Lets listed for the prompt click and enact some code!
- if firstprompt:HasCompleted() then
- print("First Prompt Completed!")
- end
- end
- end)
- Handle Prompt Failure Events
- Client Side Only
- You can trigger code when a prompt has a failure event triggered (Example: timed, mashed)
- Parameter Description
- hideoncomplete Some Options may hide or disapear when completed, Set this to false to not hide. This will default to true if nothing is entered
- firstprompt:HasFailed()
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local PromptGroup = VORPutils.Prompts:SetupPromptGroup() --Setup Prompt Group
- local firstprompt = PromptGroup:RegisterPrompt("Press Me", 0x4CC0E2FE, 1, 1, true, 'hold', {timedeventhash = "MEDIUM_TIMED_EVENT"}) --Register your first prompt
- while true do
- Citizen.Wait(0)
- --Show your prompt group
- PromptGroup:ShowGroup("My first prompt group")
- -- Lets listed for the prompt click and enact some code!
- if firstprompt:HasCompleted() then
- print("First Prompt Completed!")
- end
- if firstprompt:HasFailed() then
- print("First Prompt Failed!")
- end
- end
- end)
- Delete Prompt
- Client Side Only
- Remove a prompt completely
- firstprompt:DeletePrompt()
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local PromptGroup = VORPutils.Prompts:SetupPromptGroup() --Setup Prompt Group
- local firstprompt = PromptGroup:RegisterPrompt("Press Me", 0x4CC0E2FE, 1, 1, true, 'hold', {timedeventhash = "MEDIUM_TIMED_EVENT"}) --Register your first prompt
- while true do
- Citizen.Wait(0)
- --Show your prompt group
- PromptGroup:ShowGroup("My first prompt group")
- Wait(3000)
- firstprompt:DeletePrompt()
- end
- end)
- Toggle Prompt Visibility
- Client Side Only
- Make a prompt visible or hidden
- Parameter Description
- toggle true or false; true = visible, false = hidden
- firstprompt:TogglePrompt(toggle)
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local PromptGroup = VORPutils.Prompts:SetupPromptGroup() --Setup Prompt Group
- local firstprompt = PromptGroup:RegisterPrompt("Press Me", 0x4CC0E2FE, 1, 1, true, 'hold', {timedeventhash = "MEDIUM_TIMED_EVENT"}) --Register your first prompt
- while true do
- Citizen.Wait(0)
- --Show your prompt group
- PromptGroup:ShowGroup("My first prompt group")
- Wait(3000)
- firstprompt:TogglePrompt(false)
- end
- end)
- Pedestrians (Peds)
- You can leverage Vorps built in function for easy spawn and manipulate in-game pedestrian entities.
- Create Ped
- Client Side Only
- This will spawn a pedestrian in your game world
- Parameter Description
- modelhash The hash of the model you want the ped to be
- x x world position coordinate
- and y world position coordinate
- With z world position coordinate
- heading The heading of the ped (Which way it is facing)
- location Where to spawn ped. (world, vehicle, mount)
- safeground Should the ped spawn in a known ok location (default true, disable for more dine accuracy of ped placement)
- options Extra Options for the Location you select. (See Mode Options below)
- Modes Options
- Location Key Options example
- world None None None
- vehicle vehicle vehicle entity
- vehicle seat VS_ANY_PASSENGER, VS_DRIVER, VS_FRONT_RIGHT, VS_BACK_LEFT, VS_BACK_RIGHT, VS_EXTRA_LEFT_1, VS_EXTRA_RIGHT_1, VS_EXTRA_LEFT_2, VS_EXTRA_RIGHT_2, VS_EXTRA_LEFT_3, VS_EXTRA_RIGHT_3, VS_NUM_SEATS
- mount mount mount entity
- VORPutils.Peds:Create()
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local ped = VORPutils.Peds:Create('u_f_m_tumgeneralstoreowner_01', coords.x, coords.y, coords.z, 0, 'world', false, isnetwork or false)
- end)
- Freeze Ped
- Client Side Only
- Freeze a ped where they stand
- Parameter Description
- state freeze or unfreeze (true/false), default true
- ped:Freeze()
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local ped = VORPutils.Peds:Create('u_f_m_tumgeneralstoreowner_01', coords.x, coords.y, coords.z, 0, 'world', false)
- ped:Freeze()
- end)
- Invincible Ped
- Client Side Only
- Make a ped Invincible
- Parameter Description
- state Invincible (true/false), default true
- ped:Invincible()
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local ped = VORPutils.Peds:Create('u_f_m_tumgeneralstoreowner_01', coords.x, coords.y, coords.z, 0, 'world', false)
- ped:Invincible()
- end)
- Ped CanBeDamaged
- Client Side Only
- Make a ped not take damage
- Parameter Description
- state CanBeDamaged (true/false), default true
- ped:CanBeDamaged()
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local ped = VORPutils.Peds:Create('u_f_m_tumgeneralstoreowner_01', coords.x, coords.y, coords.z, 0, 'world', false)
- ped:CanBeDamaged()
- end)
- Set Ped Heading
- Client Side Only
- change the directon a ped is facing
- Parameter Description
- head the game world direction to face
- ped:SetHeading()
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local ped = VORPutils.Peds:Create('u_f_m_tumgeneralstoreowner_01', coords.x, coords.y, coords.z, 0, 'world', false)
- ped:SetHeading(0)
- end)
- Set Ped Seeing Range
- Client Side Only
- Change how far the ped can see
- Parameter Description
- range 0.0 - 100.0
- ped:SeeingRange()
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local ped = VORPutils.Peds:Create('u_f_m_tumgeneralstoreowner_01', coords.x, coords.y, coords.z, 0, 'world', false)
- ped:SeeingRange(70.0)
- end)
- Set Ped Hearing Range
- Client Side Only
- Change how far the ped can hear
- Parameter Description
- range 0.0 - 100.0
- ped:HearingRange()
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local ped = VORPutils.Peds:Create('u_f_m_tumgeneralstoreowner_01', coords.x, coords.y, coords.z, 0, 'world', false)
- ped:HearingRange(80.0)
- end)
- Set Ped Can Mount
- Client Side Only
- Change if a ped can mount something.
- Parameter Description
- state true/false
- ped:CanBeMounted(true)
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local ped = VORPutils.Peds:Create('u_f_m_tumgeneralstoreowner_01', coords.x, coords.y, coords.z, 0, 'world', false)
- ped:CanBeMounted(true)
- end)
- Add Ped to Group
- Client Side Only
- Add ped to a group
- Parameter Description
- group index of the group to add to
- ped:AddPedToGroup(group)
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local ped = VORPutils.Peds:Create('s_m_m_valdeputy_01', coords.x, coords.y, coords.z, 0, 'world', false)
- ped:AddPedToGroup(GetPedGroupIndex(PlayerPedId()))
- end)
- Clear a ped task
- Client Side Only
- Clear any active tasks
- ped:ClearTasks()
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local ped = VORPutils.Peds:Create('s_m_m_valdeputy_01', coords.x, coords.y, coords.z, 0, 'world', false)
- ped:ClearTasks()
- end)
- Get Task Status
- Client Side Only
- Check the status of a ped task
- ped:GetTaskStatus(taskid)
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local ped = VORPutils.Peds:Create('s_m_m_valdeputy_01', coords.x, coords.y, coords.z, 0, 'world', false)
- while (ped:GetTaskStatus(0x4924437d) ~= 8) do
- Wait(1000)
- end
- print("Ped task done!")
- end)
- Follow to offset
- Client Side Only
- Add ped to a group
- Parameter Description
- ask id of ped to follow
- ped:FollowToOffsetOfEntity(pedid)
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local ped = VORPutils.Peds:Create('s_m_m_valdeputy_01', coords.x, coords.y, coords.z, 0, 'world', false)
- ped:FollowToOffsetOfEntity(PlayerPedId(), 0.0, -1.5, 0.0, 1.0, -1, 10, 1, 1)
- end)
- Follow to offset
- Client Side Only
- Add ped to a group
- Parameter Description
- skinhash hash of skin meta cloth
- ped:ChangeOutfit(skinhash)
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local ped = VORPutils.Peds:Create('A_C_DogBluetickCoonhound_01', coords.x, coords.y, coords.z, 0, 'world', false)
- ped:ChangeOutfit(0xDC567AF8)
- end)
- Set Ped Blip
- Client Side Only
- Set a blip on ped that follows
- Parameter Description
- blipash What the blip should show on the map
- title What the blip should say
- ped:SetBlip(bliphash, title)
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local ped = VORPutils.Peds:Create('s_m_m_valdeputy_01', coords.x, coords.y, coords.z, 0, 'world', false)
- ped:SetBlip(953018525, 'Person')
- end)
- Give Ped Weapon
- Client Side Only
- Give a ped a weapon (they will only use it if they are set to be agro)
- Parameter Description
- weaponhash What the weapon will be
- ammocount how much ammo
- forceinhand Force the weapon to be held
- forceinholster Force the weapon to be holstered
- attachpoint Where to attach to the body
- allowmultiplecopies How many of this gun can the ped have
- ignoreunlocks Ingore unlockables
- permanentdegredation permanent degredation
- ped:GiveWeapon(weaponhash, ammocount, forceinhand, forceinholster, attachpoint, allowmultiplecopies, ignoreunlocks, permanentdegredation)
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local ped = VORPutils.Peds:Create('s_m_m_valdeputy_01', coords.x, coords.y, coords.z, 0, 'world', false)
- ped:AttackTarget(PlayerPedId())
- ped:GiveWeapon(0x64356159, 500, true, true, 3, false, true, true)
- end)
- Set Ped Flee Attribute
- Client Side Only
- Enable or disable pedestrian flee attributes
- Parameter Description
- flag What flee attribute to enable/disable
- enabled is active of not (true/false)
- ped:FleeAtribute(flag, enabled)
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local ped = VORPutils.Peds:Create('s_m_m_valdeputy_01', coords.x, coords.y, coords.z, 0, 'world', false)
- ped:FleeAtribute('DISABLE_ENTER_VEHICLES', true)
- end)
- Set Ped Combat Attributes
- Client Side Only
- Enable or disable pedestrian combat attributes
- Parameter Description
- attributes This is a list of attributes you want to change Example { {flag = 1, enabled = false}, {flag = 2, enabled = false} }
- attackrange The distance for aggro
- abilitylevel how good or not the ped is at fighting
- movement What kind of movement (0: Stationary (Will just stand in place), 1: Defensive (Will try to find cover and very likely to blind fire), 2: Offensive (Will attempt to charge at enemy but take cover as well), 3: Suicidal Offensive (Will try to flank enemy in a suicidal attack))
- ped:SetPedCombatAttributes(attributes, attackrange, abilitylevel, movement)
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local ped = VORPutils.Peds:Create('s_m_m_valdeputy_01', coords.x, coords.y, coords.z, 0, 'world', false)
- ped:SetPedCombatAttributes({
- {flag = 0, enabled = false}
- }, 1, 0, 2)
- end)
- Set Ped Combat Style
- Client Side Only
- Set the pedestrians combat style
- Parameter Description
- combathash The combat style for the ped
- duration How long the ped has this combat style
- ped:SetCombatStyle(combathash, duration)
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local ped = VORPutils.Peds:Create('s_m_m_valdeputy_01', coords.x, coords.y, coords.z, 0, 'world', false)
- ped:SetCombatStyle('SituationAllStop', 240.0)
- end)
- Clear Ped Combat Style
- Client Side Only
- Clear the pedestrians combat style
- ped:ClearCombatStyle()
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local ped = VORPutils.Peds:Create('s_m_m_valdeputy_01', coords.x, coords.y, coords.z, 0, 'world', false)
- ped:ClearCombatStyle()
- end)
- Attack Target
- Client Side Only
- Set a target for the ped to attack
- Parameter Description
- target the ped to attack (can be player)
- style How long the ped has this combat style (GUARD, COMBAT_ANIMAL, LAW, LAW_SHERIFF)
- ped:AttackTarget(target, style)
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local ped = VORPutils.Peds:Create('s_m_m_valdeputy_01', coords.x, coords.y, coords.z, 0, 'world', false)
- ped:AttackTarget(PlayerPedId(), 'LAW')
- end)
- Remove Ped
- Client Side Only
- Remove a Ped
- ped:Remove()
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local ped = VORPutils.Peds:Create('s_m_m_valdeputy_01', coords.x, coords.y, coords.z, 0, 'world', false)
- ped:Remove()
- end)
- Get Ped
- Client Side Only
- If there are natives this util does not yet support, you can use this to get the ped to utilize against any native.
- ped:GetPed()
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local ped = VORPutils.Peds:Create('s_m_m_valdeputy_01', coords.x, coords.y, coords.z, 0, 'world', false)
- local rawped = ped:GetPed()
- -- Use rawped with whatever native required the ped entity
- end)
- Objects
- You can leverage Vorps built in function for easy spawn and manipulate in-game Object entities.
- Create Object
- Client Side Only
- This will spawn an object in your game world
- Parameter Description
- modelhash The hash of the model you want the ped to be
- x x world position coordinate
- and y world position coordinate
- With z world position coordinate
- heading The heading of the ped (Which way it is facing)
- networked Where to spawn ped. (world, vehicle, mount)
- method standard or custom - Standard will run place on ground and a few other house keeping
- VORPutils.Objects:Create()
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local obj = VORPutils.Objects:Create('p_package09', coords.x, coords.y, coords.z, 0, true, 'standard')
- end)
- Pickup Light
- Client Side Only
- Add a light to the object
- Parameter Description
- state True/False
- obj:PickupLight(state)
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local obj = VORPutils.Objects:Create('p_package09', coords.x, coords.y, coords.z, 0, true, 'standard')
- obj:PickupLight(true)
- end)
- Freeze
- Client Side Only
- Freeze Object
- Parameter Description
- state True/False
- obj:Freeze(state)
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local obj = VORPutils.Objects:Create('p_package09', coords.x, coords.y, coords.z, 0, true, 'standard')
- obj:Freeze(true)
- end)
- Set Heading
- Client Side Only
- Set the heading of an object
- Parameter Description
- heading number coord relative to the game world
- obj:SetHeading(heading)
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local obj = VORPutils.Objects:Create('p_package09', coords.x, coords.y, coords.z, 0, true, 'standard')
- obj:SetHeading(0)
- end)
- Place On Ground
- Client Side Only
- place the object on the groun properly
- Parameter Description
- state true/false
- obj:PlaceOnGround(state)
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local obj = VORPutils.Objects:Create('p_package09', coords.x, coords.y, coords.z, 0, true, 'standard')
- obj:PlaceOnGround(true)
- end)
- Set As Mission
- Client Side Only
- The engine will keep object when players leave the area
- Parameter Description
- state true/false
- obj:SetAsMission(state)
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local obj = VORPutils.Objects:Create('p_package09', coords.x, coords.y, coords.z, 0, true, 'standard')
- obj:SetAsMission(true)
- end)
- Set As No Longer Needed
- Client Side Only
- The engine will remove when players leave the area
- obj:SetAsNoLongerNeeded()
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local obj = VORPutils.Objects:Create('p_package09', coords.x, coords.y, coords.z, 0, true, 'standard')
- obj:SetAsNoLongerNeeded()
- end)
- Invincible
- Client Side Only
- Set object as invincible
- Parameter Description
- state true/false
- obj:Invincible(state)
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local obj = VORPutils.Objects:Create('p_package09', coords.x, coords.y, coords.z, 0, true, 'standard')
- obj:Invincible(true)
- end)
- Horse Jumpable
- Client Side Only
- Sets object as not jumpable by horse.
- Parameter Description
- state true/false
- obj:SetNotHorseJumpable(state)
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local obj = VORPutils.Objects:Create('p_package09', coords.x, coords.y, coords.z, 0, true, 'standard')
- obj:SetNotHorseJumpable(true)
- end)
- Remove
- Client Side Only
- Remove Object
- obj:Remove()
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local obj = VORPutils.Objects:Create('p_package09', coords.x, coords.y, coords.z, 0, true, 'standard')
- Wait(5000)
- obj:Remove()
- end)
- Get Object
- Client Side Only
- Remove Object
- obj:GetObj()
- Example Usage:
- two
- -- client side only
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local coords = {
- z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625
- }
- local obj = VORPutils.Objects:Create('p_package09', coords.x, coords.y, coords.z, 0, true, 'standard')
- Wait(5000)
- local tobj = obj:GetObj()
- end)
- DataView
- A DataView utility
- Example Usage:
- two
- -- client side only
- local view = DataView.ArrayBuffer(512)
- if Citizen.InvokeNative(0x79923CD21BECE14E, 1, view:Buffer(), Citizen.ReturnResultAnyway()) then
- local dlc = {
- validCheck = view:GetInt64(0),
- weaponHash = view:GetInt32(8),
- val3 = view:GetInt64(16),
- weaponCost = view:GetInt64(24),
- ammoCost = view:GetInt64(32),
- ammoType = view:GetInt64(40),
- defaultClipSize = view:GetInt64(48),
- nameLabel = view:GetFixedString(56, 64),
- descLabel = view:GetFixedString(120, 64),
- simpleDesc = view:GetFixedString(184, 64),
- upperCaseName = view:GetFixedString(248, 64),
- }
- end
- Files
- An easy to use file manipulation system.
- Open
- Server Side Only
- Open a file from a given file path
- Parameter Description
- resourcename the string name of your resource
- filepath the path to the file you with to open or create
- VORPutils.Files:Open(resourcename, filepath))
- Example Usage:
- two
- -- Server side
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local file = VORPutils.Files:Open(GetCurrentResourceName(), 'data.txt')
- end)
- Read
- Server Side Only
- Read the file that you have openned.
- Parameter Description
- mode if nothing, it will default to standard read, mode are 'standard' or 'table'. Table will store a table to the file properly
- file:Read(mode)
- Example Usage:
- two
- -- Server side
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local file = VORPutils.Files:Open(GetCurrentResourceName(), 'data.txt')
- local filedata = file:Read()
- end)
- Save
- Server Side Only
- Save data to the file that you have opened.
- Parameter Description
- content The data you with to save to the file
- mode if nothing, it will default to standard save, modes are 'standard' or 'table'. Table will store a table to the file properly
- file:Save(content, mode)
- Example Usage:
- two
- -- Server side
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local file = VORPutils.Files:Open(GetCurrentResourceName(), 'data.txt')
- local filedata = file:Read()
- local data = "Some Awesome stuff!"
- file:Save(data)
- end)
- Update
- Server Side Only
- Instead of needing to open and save a file, you can update data directly to the file.
- Parameter Description
- content The data you with to save to the file
- mode if nothing, it will default to standard save, modes are 'standard' or 'table'. Table will store a table to the file properly
- file:Update(content, mode)
- Example Usage:
- two
- -- Server side
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local file = VORPutils.Files:Open(GetCurrentResourceName(), 'data.txt')
- file:Update("Some Awesome stuff!")
- end)
- Lazy Functions
- Server Side Only
- There is a way to use these functions without needing to call the Open() function, this can be used for quick usage or prototyping, but is non-optimal and slower than the above.
- Load File
- Server Side Only
- Read the file that you have openned.
- Parameter Description
- resourcename Name of the resource
- filepath path to the file you with to load
- mode if nothing, it will default to standard read, mode are 'standard' or 'table'. Table will store a table to the file properly
- VORPutils.Files:Load(resourcename, filepath, mode)
- Example Usage:
- two
- -- Server side
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- -- Lazy functions, not as optimized
- Citizen.CreateThread(function()
- local file = VORPutils.Files:Load(GetCurrentResourceName(), 'data.txt')
- end)
- Save File
- Server Side Only
- Save the file that you have openned.
- Parameter Description
- resourcename Name of the resource
- filepath path to the file you with to load
- content data to save to the file
- mode if nothing, it will default to standard read, mode are 'standard' or 'table'. Table will store a table to the file properly
- VORPutils.Files:Load(resourcename, filepath, mode)
- Example Usage:
- two
- -- Server side
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- -- Lazy functions, not as optimized
- Citizen.CreateThread(function()
- VORPutils.Files:Save(GetCurrentResourceName(), 'data.txt', "Some cool stuff!")
- end)
- Update File
- Server Side Only
- Update the file that you have openned.
- Parameter Description
- resourcename Name of the resource
- filepath path to the file you with to load
- content data to update to the file
- mode if nothing, it will default to standard read, mode are 'standard' or 'table'. Table will store a table to the file properly
- VORPutils.Files:Update(resourcename, filepath, content, mode)
- Example Usage:
- two
- -- Server side
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- -- Lazy functions, not as optimized
- Citizen.CreateThread(function()
- VORPutils.Files:Update(GetCurrentResourceName(), 'data.txt', "Some cool stuff!")
- end)
- Print Logs
- Vorp Utils provides an enhanced print functionality to the default Lua.
- Features
- Table printing support
- ANSI Color and text formatting support
- Setup
- two
- -- Server and Client
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- print = VORPutils.Print:initialize(print) --Initial setup
- end)
- Citizen.CreateThread(function()
- --Use print as you normally would.
- print('%{bold} %{red}TEST', {
- hello = "world"
- })
- -- Print Output: TEST, { "hello" = "world"}
- end)
- Colors
- Colors and backgrounds can be used usilizing the %{attribute} format
- Type format Description
- Text Format % Make Text Font weight heavier
- Text Color % Set back to default color
- Text Color %
- Text Color %
- Text Color %
- Text Color %
- Text Color %{magenta} or %
- Text Color %
- Text Color %{gray} or %
- Text Color %{lightgray} or %
- Text Color %
- Text Color %
- Text Color %
- Text Color %
- Text Color %
- Text Color %
- Background Color %
- Background Color %
- Background Color %
- Background Color %
- Background Color %
- Background Color %
- Background Color %{highlight gray} or %
- Background Color %{highlight lightgray} or %
- Background Color %
- Background Color %
- Background Color %
- Background Color %
- Background Color %
- Background Color %
- Example Usage:
- two
- print('%{blue}moon over the rainbow')
- image
- Advanced Classes
- Many Programming languages, including Lua, provide a method to use a programing methedology called classes.
- Lua, unfortunately does this in a way that is very non-standard to other languages, and can make it a bit confusing for some. This is an attempt to make it more in-line with other languages.
- Benefits
- Classes are nice for developers as it allows you to have a single, contained context (self) for the class to utilize.
- Example Usage:
- two
- -- Server and Client
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local myClass = VORPutils.General:CreateClass(function(setup, register)
- -- Setup is a constructor, meaning it is used to setup your default variables than can then be used in the following fuctions.
- setup({
- message = "Initial Text"
- })
- -- return the functions that you wish to register to the class.
- return {
- ChangeText = function(self, t) --This can now be called anywhere as myClass:ChangeText(t)
- -- self is always in the first paramater above, this is required to manipulate the setup data.
- self.message = t
- end,
- GetText = function(self) --This can now be called anywhere as myClass:GetText()
- return self.message
- end
- }
- end)
- print(myClass:GetText()) -- Prints: Initial Text
- myClass:ChangeText('HELLO WORLD!')
- print(myClass:GetText()) -- Prints: HELLO WORLD!
- end
- Destruction
- Objects (ymaps) can have built in destruction thanks to the engines use of RayFire, which is a tool for dynamic destruction.
- This allows for things like like bank walls being blown out, railroad bridge blown up, trees falling over, etc.
- Note that they are not networked and you'll need to sync clients manually.
- Get Destruction Object
- Client Side Only
- Get nearby RawFire map Objects
- Parameter Description
- x in-game x coordinate
- and in-game y coordinate
- With in-game z coordinate
- radius the radius from the coordinate
- objectname destruction object name with RayFire attached
- VORPutils.Destruct:GetMapObject(GetEntityCoords(PlayerPedId()), 150.0, 'des_val_sheriff')
- Example Usage:
- two
- -- Client
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- RegisterCommand('trigger', function()
- local object = VORPutils.Destruct:GetMapObject(GetEntityCoords(PlayerPedId()), 150.0, 'des_val_sheriff')
- end)
- Check if the Destruction Object Exists
- Client Side Only
- Check if the RayFire Destruction Object exists.
- object:DoesExist()
- Example Usage:
- two
- -- Client
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- RegisterCommand('trigger', function()
- local object = VORPutils.Destruct:GetMapObject(GetEntityCoords(PlayerPedId()), 150.0, 'des_val_sheriff')
- if object:DoesExist() then
- --Exists!
- end
- end)
- Reset State
- Client Side Only
- Reset the RayFire Destruction Objects state.
- object:resetState()
- Example Usage:
- two
- -- Client
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- RegisterCommand('trigger', function()
- local object = VORPutils.Destruct:GetMapObject(GetEntityCoords(PlayerPedId()), 150.0, 'des_val_sheriff')
- if object:DoesExist() then
- object:resetState()
- end
- end)
- Reset State
- Client Side Only
- Reset the RayFire Destruction Objects state.
- Parameter Description
- state the state of the object. (6 will trigger most objects)
- object:resetState()
- Example Usage:
- two
- -- Client
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- RegisterCommand('trigger', function()
- local object = VORPutils.Destruct:GetMapObject(GetEntityCoords(PlayerPedId()), 150.0, 'des_val_sheriff')
- if object:DoesExist() then
- object:resetState()
- Wait(3000)
- object:SetState(6)
- end
- end)
- Render
- Render is an API to help with in-world and on screen drawing. (Text, Sprites, etc.)
- WorldToScreen
- Client Side Only
- Converts an in-world coordinate to a screen position
- Parameter Description
- pos (vector3) in-world position
- Returns vector 2 screen coords.
- Returns Bool if its on screen
- object:WorldToScreen(vector3(x, y, z))
- Example Usage:
- two
- -- Client
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- RegisterCommand('trigger', function()
- local coords, onscreen = VORPutils.Render:WorldToScreen(GetEntityCoords(PlayerPedId()))
- print(coords.x, coords.y, onscreen)
- end)
- WorldToHud
- Client Side Only
- Converts in-world coordinate to a hud position (bounded to screen)
- Parameter Description
- pos (vector3) in-world position
- Returns vector 2 screen coords
- Returns Bool if its on screen
- object:WorldToHud(vector3(x, y, z))
- Example Usage:
- two
- -- Client
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- RegisterCommand('trigger', function()
- local coords, onscreen = VORPutils.Render:WorldToHud(GetEntityCoords(PlayerPedId()))
- print(coords.x, coords.y, onscreen)
- end)
- DrawSprite
- Client Side Only
- Draw Sprites on screen
- Parameter Description
- pos (vector2) table containing x and y coords of sprite position on screen
- size (vector2) table containing x and y sizes (relative to screen x and y size, ranges from 0.0-1.0)
- rotation (float) number of sprite rotation in degrees
- color (vector3) table of rgba values
- texturedict Name of texture dictionary to load texture from (e.g. "CommonMenu", "MPWeaponsCommon", etc.)
- texturename Name of texture to load from texture dictionary (e.g. "last_team_standing_icon", "tennis_icon", etc.)
- VORPutils.Render:DrawSprite(pos, size, rotation, color, texturedict, texturename)
- Example Usage:
- two
- -- Client
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- while true do
- Citizen.Wait(0)
- local onScreen, _x, _y = GetScreenCoordFromWorldCoord(GetEntityCoords(PlayerPedId()))
- if onScreen then
- VORPutils.Render:DrawSprite(vector2(_x, _y), vector2(0.2, 0.2), 190.0, {r: 255, g: 0, b: 0, a: 255}, "feeds", "hud_menu_4a")
- end
- end
- end)
- Draw Rectangle
- Client Side Only
- Draw a rectangle on screen
- Parameter Description
- pos (vector2) table containing x and y coords of sprite position on screen (ranges from 0.0-1.0)
- size (vector2) table containing x and y sizes (ranges from 0.0-1.0)
- color (vector3) table of rgba values
- VORPutils.Render:DrawRectangle(pos, size, color)
- Example Usage:
- two
- -- Client
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- while true do
- Citizen.Wait(0)
- local onScreen, _x, _y = GetScreenCoordFromWorldCoord(GetEntityCoords(PlayerPedId()))
- if onScreen then
- VORPutils.Render:DrawRectangle(vector2(_x, _y), vector2(0.2, 0.2), {r: 255, g: 0, b: 0, a: 255})
- end
- end
- end)
- Draw Marker
- Client Side Only
- Draw a Marker in-world
- Parameter Description
- type
- pos table containing x y and z coords
- you table containing x y and z coords
- rot rotation of the marker
- scale table containing x y and z scale
- color table of rgba values
- bobupanddown does it bounce (true/false)
- facecamera should it face the camera (true/false)
- rotate does the marker rotate (true/false)
- drawonents (true/false)
- VORPutils.Render:DrawMarker(type, pos, dir, rot, scale, color, bob, facevamera, rotate, drawonents)
- Example Usage:
- two
- -- Client
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- while true do
- Citizen.Wait(0)
- VORPutils.Render:DrawMarker(0x50638AB9, GetEntityCoords(PlayerPedId()), vector3(0.0, 0.0, 0.0), vector3(0.0, 0.0, 0.0), vecotr3(0.15, 0.15, 0.15), {r: 255, g: 0, b: 0, a: 255}, false, false, false, false)
- end
- end)
- Draw Text
- Client Side Only
- Draw a Text on screen
- Parameter Description
- pos table containing x and y coords of text position (0-1, 0-1)
- text table containing x y and z coords
- color table of rgba values
- scale scale of the text
- shadow if shadow is enabled (true/false)
- VORPutils.Render:DrawText(pos, text, color, scale, shadow)
- Example Usage:
- two
- -- Client
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- while true do
- Citizen.Wait(0)
- local onScreen, _x, _y = GetScreenCoordFromWorldCoord(GetEntityCoords(PlayerPedId()))
- if onScreen then
- VORPutils.Render:DrawText(vector2(_x, _y), 'Vorp Rules!', {r: 255, g: 0, b: 0, a: 255}, 1.0, false)
- end
- end
- end)
- Game Events
- Vorp_Utils has a built-in network and entity event watcher that can be utilized by other scripts easily.
- Register Event Listener
- Client Side Only
- Register a callback that will be triggered whenever an in-game client event triggers.
- Parameter Description
- eventname name of the event to watch/listen to
- callback fucntion to be triggered when an event is triggered
- VORPutils.Events:RegisterEventListener(eventname, callback)
- Example Usage:
- two
- -- Client
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- VORPutils.Events:RegisterEventListener('EVENT_PICKUP_CARRIABLE', function(args)
- print("EVENT TRIGGERED: EVENT_PICKUP_CARRIABLE", args[1], args[2])
- end)
- end)
- Remove Event Listener
- Client Side Only
- Removes an event from the listener queue, listener will no longer listen once removed. This frees up in-game memory andis best practice if using listeners in a dynamic, or temporary way.
- Parameter Description
- listener object returns from RegisterEventListener
- VORPutils.Events:RemoveEventListener(listener)
- Example Usage:
- two
- -- Client
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- local listener = VORPutils.Events:RegisterEventListener('EVENT_PICKUP_CARRIABLE', function(args)
- print("EVENT TRIGGERED: EVENT_PICKUP_CARRIABLE", args[1], args[2])
- end)
- Wait(40000)
- VORPutils.Events:RemoveEventListener(listener)
- end)
- DevMode
- Client Side Only
- This provides the ability to print every in-game event for development purpose.
- Parameter Description
- state object returns from RegisterEventListener
- type (optional, will default to all) the type of event to listen too (entities, network, or all)
- VORPutils.Events:DevMode(listener)
- Example Usage:
- two
- -- Client
- local VORPutils = {}
- TriggerEvent("getUtils", function(utils)
- VORPutils = utils
- end)
- Citizen.CreateThread(function()
- VORPutils.Events:DevMode(true, 'entities')
- -- VORPutils.Events:DevMode(true, 'network')
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement