mirror of
https://github.com/kuitoi/kuitoi-Server.git
synced 2025-08-17 00:05:38 +00:00
I hate cobalt: cobaltSysChar!!!!!!!!!
This commit is contained in:
parent
6ccbe99d47
commit
d92aae7c47
@ -11,18 +11,7 @@ KiuToi几乎完全支持BeamMP的lua插件,所有必要的方法都已经创
|
||||
#### Cobalt Essentials V1.7.5(免费,[github ↗](https://github.com/prestonelam2003/CobaltEssentials/))
|
||||
|
||||
1. 要获取`pluginPath`,需要:`debug.getinfo(1).source:gsub("\\","/")` => `debug.getinfo(1).source:gsub("\\","/"):gsub("@", "")`,因为路径返回值中包含`@`,这破坏了插件。
|
||||
2. 必须将所有的`require()`移动到`onInit`之后。
|
||||
3. 在某些情况下,必须在函数声明之后注册`MP.RegisterEvent`,即:
|
||||
```lua
|
||||
--这样不正确,可能无法注册
|
||||
MP.RegisterEvent("onPlayerAuth","onPlayerAuth")
|
||||
function onPlayerAuth(name, role, isGuest)
|
||||
-- Some plugin code
|
||||
end
|
||||
|
||||
--这样就可以了
|
||||
MP.RegisterEvent("onPlayerAuth","onPlayerAuth")
|
||||
```
|
||||
2. `cobaltSysChar`
|
||||
|
||||
### 工作原理
|
||||
|
||||
|
@ -11,18 +11,7 @@ KiuToi does not support: `MP.Set()`
|
||||
#### Cobalt Essentials V1.7.5 (Free, [github](https://github.com/prestonelam2003/CobaltEssentials/))
|
||||
|
||||
1. To obtain `pluginPath`, use: `debug.getinfo(1).source:gsub("\\","/")` => `debug.getinfo(1).source:gsub("\\","/"):gsub("@", "")` as the path returns with `@`, which broke the plugin.
|
||||
2. All `require()` statements had to be moved after `onInit`.
|
||||
3. In some cases, `MP.RegisterEvent` had to be moved after the function declaration, i.e.:
|
||||
```lua
|
||||
--This is incorrect, registration may fail
|
||||
MP.RegisterEvent("onPlayerAuth","onPlayerAuth")
|
||||
function onPlayerAuth(name, role, isGuest)
|
||||
-- Some plugin code
|
||||
end
|
||||
|
||||
--This is the correct version
|
||||
MP.RegisterEvent("onPlayerAuth","onPlayerAuth")
|
||||
```
|
||||
2. `cobaltSysChar`
|
||||
|
||||
### A Little About How it Works
|
||||
|
||||
|
@ -11,18 +11,7 @@
|
||||
#### Cobalt Essentials V1.7.5 (Бесплатный, [github](https://github.com/prestonelam2003/CobaltEssentials/))
|
||||
|
||||
1. Для получения `pluginPath` нужно: `debug.getinfo(1).source:gsub("\\","/")` => `debug.getinfo(1).source:gsub("\\","/"):gsub("@", "")` так как пусть возвращается с `@`, что сломало плагин.
|
||||
2. Пришлось перенести все `require()` за `onInit`
|
||||
3. В некоторых моментах пришлось перенести `MP.RegisterEvent` уже после объявления функции, т.е.:
|
||||
```lua
|
||||
--Вот так не правильно, может не пройти регистрация
|
||||
MP.RegisterEvent("onPlayerAuth","onPlayerAuth")
|
||||
function onPlayerAuth(name, role, isGuest)
|
||||
-- Some plugin code
|
||||
end
|
||||
|
||||
--Вот такой вариант пройдёт
|
||||
MP.RegisterEvent("onPlayerAuth","onPlayerAuth")
|
||||
```
|
||||
2. `cobaltSysChar`
|
||||
|
||||
### Немного о принципе работы
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user