#
Placeholders
#
They way placeholders work it's pretty simple
- You'll find placeholders defined inside
{} - When a placeholder is found in the template, it's replaced with the corresponding data.
- The contents inside the brackets correspond to the path that returns a valid handler (not everything is valid).
#
What placeholders can I use by default?
You have three types of placeholders that we provide:
- Framework based (a valid framework is required)
- Default placeholders (command data, cfx natives...)
- Check placeholders (these are parsed in the checking step)
#
Built-in placeholders
Coding skills required
Please note that you must have so basic knowledge on how lua syntax work, functions and variables among other things.
If you don't manage to understand how this works, use the built-in command tool or hire a developer.
#
Creating a custom placeholder
You must head to client/custom/placeholder.lua and you'll find the following:
Client.Custom["Placeholder"]["ServerId"] = function(placeholder, orTable, args)
return tostring(GetPlayerServerId(PlayerId()))
end
Client.Custom["Placeholder"]["CfxName"] = function(placeholder, orTable, args)
return GetPlayerName(PlayerId())
end
-- ... add as many as you want
#
Creating a placeholder
In order to create a placeholder we'll simply copy and paste one of the above placeholders and rename the second table field DO NOT RENAME "Placeholder".
-- @param placeholder string
-- @param orTable table
-- @param args table
-- @return string
Client.Custom["Placeholder"]["GetHealth"] = function(placeholder, orTable, args) -- See, we only rename the second field.
return GetEntityHealth(PlayerId())
end
-- @param placeholder string
-- @param orTable table
-- @param args table
-- @return string
Client.Custom["Placeholder"]["GetRank"] = function(placeholder, orTable, args) -- See, we only rename the second field.
return exports.myCoolResource:GetPlayerRank()
end