# Creating a command

# Why using our command system?

  • You'll be able to create new commands without coding experience.
  • Fast and efficient creation of basic commands.
  • No more boilerplate code for the same tasks, we handle everything.

Learn how templates work
../adding_your_template/
Learn how placeholders
../placeholders/

# 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

Identifier Description Example return
Framework:HasLoaded Has the player loaded in boolean
Framework:GetName Returns the name of the current client if loaded "Amyset Overflow"
Framework:GetNameMasked Returns the name of the current client if it's wearing a mask "Amyset Overflow" / "Anonymous"

Placeholder:ServerId Current client server id "164"
Placeholder:CfxName Returns the name of the current client "amyset #overflow"

Self:GetArgs Get all args "This is a concatenation of all args"
Self:GetFirstArg Get the first element of the args if any "burger"

Checks:IsDead Returns true if the player is dead true

# 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