Core
API reference for core
This documentation is for developers who are making scripts for VORP Core Framework
Export
GetCore is a shared export that returns the core table containing all the getters and setters for VORP Core. some of the getters and setters are client side only and some are server side only.
The core table containing all the getters and setters.
local Core = exports.vorp_core:GetCore()
Notifications
notifications can also accept -1 as duration to always stay on screen and to clear them you need to use UiFeedClearChannel
The title of the notification
The subtitle of the notification
The dictionary for the icon
The icon name
Duration in milliseconds
Color of the notification
Core.NotifyLeft("title", "subtitle", "dict", "icon", 4000, "color")
The title of the notification
The subtitle of the notification
The dictionary for the icon
The icon name
Duration in milliseconds
Color of the notification
Core.NotifyLeft("title", "subtitle", "dict", "icon", 4000, "color")
The title of the notification
The subtitle of the notification
The audio reference
The audio name
Duration in milliseconds
Core.NotifyWarning("title", "subtitle", "audioref", "audioname", 4000)
The title of the notification
The subtitle of the notification
The dictionary for the icon
The icon name
Duration in milliseconds
Color of the notification
Core.NotifyLeftRank("title", "subtitle", "dict", "icon", 4000, "color")
The title of the notification
The subtitle of the notification
The dictionary for the icon
The icon name
Duration in milliseconds
Color of the notification
Core.NotifyLeft("title", "subtitle", "dict", "icon", 4000, "color")
The title of the notification
The subtitle of the notification
The dictionary for the icon
The icon name
Duration in milliseconds
Color of the notification
Core.NotifyLeft("title", "subtitle", "dict", "icon", 4000, "color")
The title of the notification
The subtitle of the notification
The audio reference
The audio name
Duration in milliseconds
Core.NotifyWarning("title", "subtitle", "audioref", "audioname", 4000)
The title of the notification
The subtitle of the notification
The dictionary for the icon
The icon name
Duration in milliseconds
Color of the notification
Core.NotifyLeftRank("title", "subtitle", "dict", "icon", 4000, "color")
The player ID
The title of the notification
The subtitle of the notification
The dictionary for the icon
The icon name
Duration in milliseconds
Color of the notification
Core.NotifyLeft(source, "title", "subtitle", "dict", "icon", 4000, "color")
The player ID
The title of the notification
The dictionary for the icon
The icon name
Color of the notification
Duration in milliseconds
Core.NotifyAvanced(source, "title", "dict", "icon", "color", 4000)
The player ID
The title of the notification
The subtitle of the notification
The audio reference
The audio name
Duration in milliseconds
Core.NotifyWarning(source, "title", "subtitle", "audioref", "audioname", 4000)
The player ID
The title of the notification
The subtitle of the notification
The dictionary for the icon
The icon name
Duration in milliseconds
Color of the notification
Core.NotifyLeftRank(source, "title", "subtitle", "dict", "icon", 4000, "color")
Characters
Get the character data to access getters and setters
The player ID
local user = Core.getUser(source) --[[@as User]]
if not user then return end -- is player in session?
local character = user.getUsedCharacter --[[@as Character]]
The unique identifier of the character
local identifier = character.identifier
The unique character identifier
local charIdentifier = character.charIdentifier
The group the character belongs to
local group = character.group
The job of the character
local job = character.job
The job grade of the character
local jobGrade = character.jobGrade
The job label of the character
local jobLabel = character.jobLabel
The amount of money the character has
local money = character.money
The amount of gold the character has
local gold = character.gold
The amount of rol the character has
local rol = character.rol
The amount of experience points the character has
local xp = character.xp
The first name of the character
local firstname = character.firstname
The last name of the character
local lastname = character.lastname
The status of the character
local status = character.status
The coordinates of the character
local coords = character.coords
Whether the character is dead or not
local isDead = character.isdead
The skin details of the character
local skin = character.skin
The component details of the character
local comps = character.comps
The component tints of the character
local compTints = character.compTints
The age of the character
local age = character.age
The gender of the character
local gender = character.gender
The description of the character
local charDescription = character.charDescription
The nickname of the character
local nickname = character.nickname
The inventory capacity of the character
local invCapacity = character.invCapacity
The skills of the character
local skills = character.skills
local skill = skills.Crafting
if not skill then return print("skill not found in core config or it doesn't exist") end
local skillExp = skill.Exp
local skillLevel = skill.Level
The unique identifier of the character
local identifier = character.identifier
The unique character identifier
local charIdentifier = character.charIdentifier
The group the character belongs to
local group = character.group
The job of the character
local job = character.job
The job grade of the character
local jobGrade = character.jobGrade
The job label of the character
local jobLabel = character.jobLabel
The amount of money the character has
local money = character.money
The amount of gold the character has
local gold = character.gold
The amount of rol the character has
local rol = character.rol
The amount of experience points the character has
local xp = character.xp
The first name of the character
local firstname = character.firstname
The last name of the character
local lastname = character.lastname
The status of the character
local status = character.status
The coordinates of the character
local coords = character.coords
Whether the character is dead or not
local isDead = character.isdead
The skin details of the character
local skin = character.skin
The component details of the character
local comps = character.comps
The component tints of the character
local compTints = character.compTints
The age of the character
local age = character.age
The gender of the character
local gender = character.gender
The description of the character
local charDescription = character.charDescription
The nickname of the character
local nickname = character.nickname
The inventory capacity of the character
local invCapacity = character.invCapacity
The skills of the character
local skills = character.skills
local skill = skills.Crafting
if not skill then return print("skill not found in core config or it doesn't exist") end
local skillExp = skill.Exp
local skillLevel = skill.Level
The job label to set
character.setJobLabel("Label")
Set the amount of Rol of the character
character.setRol(1000)
Set the amount of XP of the character
character.setXp(5000)
Set the first name of the character
character.setFirstname("Sadie")
Set the last name of the character
character.setLastname("Adler")
The skin in JSON format
character.updateSkin("skin")
The clothing components in JSON format
character.updateComps("comps")
The clothing components tints in JSON format
character.updateCompTints("comps")
The amount of XP to add
character.addXp(100)
The amount of XP to remove
character.removeXp(100)
The age to set to the character
character.setAge(45)
The character description to set to the character
character.setCharDescription("string")
The nickname to set to the character
character.setNickName("string")
The gender to set (male or female)
character.setGender("string")
The amount to change the inventory capacity by (can be positive or negative) its also incremental so 1000 will be 1000 + what you already have
character.updateInvCapacity(1)
The name of the skill to set, these skillNames will be in VORP Core config skills
the Exp value to be set to the skillName you passed values are incremental so 1000 exp will be 1000 + what you already have
character.setSkills("skillName", 10) -- skillname exp
Users
Get the user data to access getters and setters
The player ID
local user = Core.getUser(source) --[[@as User]]
if not user then return end -- is player in session?
The character ID
local user = Core.getUserByCharId(charid) --[[@as User]]
The user group (not character group)
local userGroup = user.getGroup
The user’s source (player ID)
local userSource = user.source
The character ID
local user = Core.getUserByCharId(charid) --[[@as User]]
The user group (not character group)
local userGroup = user.getGroup
The user’s source (player ID)
local userSource = user.source
The group to set for the user
user.SetGroup(group)
The steam ID of the user
local steam = user.getIdentifier()
All characters of the user
local data = user.getUserCharacters()
The warning status of the user
local warnstatus = user.getPlayerwarnings()
Whitelist
The identifier of the whitelist entry
local data = Core.Whitelist.getEntry(identifier)
print(json.encode(data),{ident = true})
The identifier of the whitelist entry
local data = Core.Whitelist.getEntry(identifier)
print(json.encode(data),{ident = true})
Webhooks
The title of the webhook
The webhook link
The description of the webhook
The color of the webhook
The name of the webhook
The logo of the webhook
The footerlogo of the webhook
The avatar of the webhook
Core.AddWebhook("title", "webhook", "description", 12345678, "name", "logo", "footerlogo", "avatar")
Instancing
to add a players to different instances use his server id + instance number to add players to same instance use only the instanceNumber
local instanceNumber = 54123 -- any number
VORPcore.instancePlayers(GetPlayerServerId(PlayerId())+ instanceNumber)
remove players from instance
VORPcore.instancePlayers(0)
Player
Available through core export
when using these functions you will benefit of the event listeners
OnPlayerDeath
OnPlayerRevive
OnPlayerRespawn
The player ID
Core.Player.Heal(source)
The player ID
Core.Player.Revive(source)
The player ID
Core.Player.Respawn(source)
Callbacks
Callbacks are available through core export or single exports
if you need only the call back system
local ServerRPC = exports.vorp_core:ServerRpcCall() --[[@as ServerRPC]] -- for intellisense
register a callback on the server to receive a client callback
The name of the callback
The callback function
The source of the callback
The callback function
The parameters to pass to the callback
The result of the callback
Core.Callback.Register(name, function(source,callback,...)
callback(...)
end)
if you need only the call back system
local ServerRPC = exports.vorp_core:ServerRpcCall() --[[@as ServerRPC]] -- for intellisense
register a callback on the server to receive a client callback
The name of the callback
The callback function
The source of the callback
The callback function
The parameters to pass to the callback
The result of the callback
Core.Callback.Register(name, function(source,callback,...)
callback(...)
end)
if you need only the call back system
local ClientRPC = exports.vorp_core:ClientRpcCall() --[[@as ClientRPC]] -- for intellisense
register a callback on the client to receive a server callback
The name of the callback
The callback function
The parameters to pass to the callback
The result of the callback
Core.Callback.Register(name, function(callback,...)
callback(...)
end)
Events
Event Listeners to detect changes in the player state
when player job and group changes these events are triggered
onGroupChange
AddEventHandler("vorp:playerGroupChange",function(source, newgroup,oldgroup) end)
onJobChange
AddEventHandler("vorp:playerJobChange", function(source, newjob,oldjob) end)
onJobGradeChange
AddEventHandler("vorp:playerJobGradeChange",function(source, newjobgrade,oldjobgrade) end)
onPlayerDeath
when player dies this event is triggered
--CLIENT
AddEventHandler("vorp_core:Client:OnPlayerDeath",function(killerserverid,causeofdeath) end)
--SERVER
RegisterNetEvent("vorp_core:Server:OnPlayerDeath",function(killerserverid,causeofdeath) end)
onPlayerRevive
when player is revived through VORP Core export this event will trigger
--SERVER
AddEventHandler("vorp_core:Server:OnPlayerRevive",function(source)end)
--CLIENT
RegisterNetEvent("vorp_core:Client:OnPlayerRevive")
onPlayerRespawn
when player respawns through VORP Core export this event will trigger
--SERVER
AddEventHandler("vorp_core:Server:OnPlayerRespawn"function(source)end)
--CLIENT
RegisterNetEvent("vorp_core:Client:OnPlayerRespawn")
onPlayerHeal
when player is healed through VORP Core export this event will trigger
--SERVER
AddEventHandler("vorp_core:Server:OnPlayerHeal",function(source) end)
--CLIENT
RegisterNetEvent("vorp_core:Client:OnPlayerHeal")
onPlayerLevelUp
--SERVER
AddEventHandler("vorp_core:Server:OnPlayerLevelUp",function(source,skillName,newLevel,oldLevel) end)
--CLIENT
RegisterNetEvent("vorp_core:Client:OnPlayerLevelUp",function(skillName,newLevel,oldLevel) end)
Dataview
call dataview in your script fxmanifest
client_scripts {
'@vorp_core/client/dataview.lua'
}
GlobalStates
- easily get players count from client or server
GlobalState.PlayersInSession
Statebags
statebag getters that allow you to get the character data
is player in session? this will return true when player choose his character
The IsInSession of the character
LocalPlayer.state.IsInSession
get the first name of the character
The first name of the character
LocalPlayer.state.Character.FirstName
get the last name of the character
The last name of the character
LocalPlayer.state.Character.LastName
get the job label of the character
The job label of the character
LocalPlayer.state.Character.JobLabel
get the grade of the character
The grade of the character
LocalPlayer.state.Character.Grade
get the group of the character
The group of the character
LocalPlayer.state.Character.Group
get the gender of the character
The gender of the character
LocalPlayer.state.Character.Gender
get the nickname of the character
The nickname of the character
LocalPlayer.state.Character.NickName
get the character description of the character
The character description of the character
LocalPlayer.state.Character.CharDescription
get the money of the character
The money of the character
LocalPlayer.state.Character.Money
get the gold of the character
The gold of the character
LocalPlayer.state.Character.Gold
get the charid of the character
The charid of the character
LocalPlayer.state.Character.CharId
is player in session? this will return true when player choose his character
The IsInSession of the character
LocalPlayer.state.IsInSession
get the first name of the character
The first name of the character
LocalPlayer.state.Character.FirstName
get the last name of the character
The last name of the character
LocalPlayer.state.Character.LastName
get the job label of the character
The job label of the character
LocalPlayer.state.Character.JobLabel
get the grade of the character
The grade of the character
LocalPlayer.state.Character.Grade
get the group of the character
The group of the character
LocalPlayer.state.Character.Group
get the gender of the character
The gender of the character
LocalPlayer.state.Character.Gender
get the nickname of the character
The nickname of the character
LocalPlayer.state.Character.NickName
get the character description of the character
The character description of the character
LocalPlayer.state.Character.CharDescription
get the money of the character
The money of the character
LocalPlayer.state.Character.Money
get the gold of the character
The gold of the character
LocalPlayer.state.Character.Gold
get the charid of the character
The charid of the character
LocalPlayer.state.Character.CharId
is player in session? this will return true when player choose his character
The IsInSession of the character
Player(source).state.IsInSession
get the first name of the character
The first name of the character
Player(source).state.Character.FirstName
get the last name of the character
The last name of the character
Player(source).state.Character.LastName
get the job label of the character
The job label of the character
Player(source).state.Character.JobLabel
get the grade of the character
The grade of the character
Player(source).state.Character.Grade
get the group of the character
The group of the character
Player(source).state.Character.Group
get the age of the character
The age of the character
Player(source).state.Character.Age
get the gender of the character
The gender of the character
Player(source).state.Character.Gender
get the nickname of the character
The nickname of the character
Player(source).state.Character.NickName
get the character description of the character
The character description of the character
Player(source).state.Character.CharDescription
get the money of the character
The money of the character
Player(source).state.Character.Money
get the gold of the character
The gold of the character
Player(source).state.Character.Gold
get the rol of the character
The rol of the character
Player(source).state.Character.Rol
get the charid of the character
The charid of the character
Player(source).state.Character.CharId
Version
Use vorp version check with change logs feature in your scripts
add this in your fxmanifest
-- version must match version.file
version '0.0.1'
vorp_checker 'yes'
-- can use color codes ^1
vorp_name '^5your resource name ^4version Check^3'
-- path to the github repository, in here it must have a version.file file type where your change logs will be, also must be public repository
vorp_github 'https://github.com/repository/resource_name'
example of a version.file
<0.0.1> -- version must be the same in fxmanifest
- new version
- added feature
- removed feature
- fixed something