mirror of
https://github.com/SantaSpeen/CommandEngine-BeamMP.git
synced 2025-07-01 23:36:22 +00:00
Add wiki
This commit is contained in:
parent
27ac8cb298
commit
9f1d9dab57
34
README.md
34
README.md
@ -12,6 +12,34 @@ Plugin for handle commands from client chat or server console.
|
|||||||
**Installation**\
|
**Installation**\
|
||||||
Copy `CommandEngine` dir to `Resources/Server/`
|
Copy `CommandEngine` dir to `Resources/Server/`
|
||||||
|
|
||||||
* 1
|
**Add command to engine**
|
||||||
* 2
|
|
||||||
* 3
|
```lua
|
||||||
|
|
||||||
|
-- Plugin body
|
||||||
|
|
||||||
|
function onInit()
|
||||||
|
|
||||||
|
-- Plugin init then
|
||||||
|
|
||||||
|
-- Firstly: Wait to mod initialization
|
||||||
|
log("Wait CommandEngine init..")
|
||||||
|
local isCommandEngineReady = false
|
||||||
|
while not isCommandEngineReady do
|
||||||
|
local Future = MP.TriggerGlobalEvent("CE_isReady")
|
||||||
|
while not Future:IsDone() do MP.Sleep(100) end
|
||||||
|
local result = Future:GetResults()
|
||||||
|
if result[1] == true then isCommandEngineReady = true end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Secondary: Register commands
|
||||||
|
MP.TriggerGlobalEvent("CE_addCommand", {
|
||||||
|
ban = { "banUser", "a", { "ban <name> [reason]", "Ban user." }},
|
||||||
|
unban = { "unbanUser", "a", { "unban <name>", "Unban user." }},
|
||||||
|
banlist = { "seeBanList", "a", "See ban list on server."}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
end
|
||||||
|
```
|
||||||
|
This is real example from [AdminTools](https://github.com/SantaSpeen/AdminTools-BeamMP/blob/master/Resources/Server/AdminTools/AdminTools.lua#L41)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user