# :icon-cross-reference: 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.

!!!
Our command system does a good job for simple commands, simply route the commands and run a few checks. <br>
If you want something really specific you should probably code something of your own.<br><br>
Try it out by executing **/commandcreator**
!!!

[!ref text="Learn how templates work"](/chat/adding_your_template.md)
[!ref text="Learn how placeholders"](/chat/placeholders.md)

### 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
{.whitespace-nowrap .compact}
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"
<br>|  | 
Placeholder:ServerId | Current client server id | "164"
Placeholder:CfxName | Returns the name of the current client | "amyset #overflow"
<br>|  | 
Self:GetArgs | Get all args | "This is a concatenation of all args"
Self:GetFirstArg | Get the first element of the args if any | "burger"
<br>|  | 
Checks:IsDead | Returns true if the player is dead | true

!!!danger Coding skills required
  Please note that you must have so basic knowledge on how lua syntax work, functions and variables among other things. <br>
  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:
```lua
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"`.

+++ GetHealth
```lua
-- @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
```
+++ GetRank
```lua
-- @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
```
+++
