RSGCore:Client:OnPlayerLoaded
- 处理角色选择后的玩家加载
此事件可以用作触发代码的事件处理程序,因为它表示播放器已成功加载到服务器中!
RegisterNetEvent('RSGCore:Client:OnPlayerLoaded', function()
print('Im a client and i just loaded into your server!')
end)
RSGCore:Client:OnPlayerUnload
- 处理玩家登录以选择角色
此事件可以用作触发代码的事件处理程序,因为它表示播放器已成功加载到服务器中!
RegisterNetEvent('RSGCore:Client:OnPlayerLoaded', function()
print('Im a client and i just loaded into your server!')
end)
RSGCore:Client:OnPlayerUnload
- 处理玩家登录以选择角色
此事件可以用作触发代码的事件处理程序,因为它表示玩家已成功卸载或注销服务器!
RegisterNetEvent('RSGCore:Client:OnPlayerUnload', function()
print('Im a client and i just logged out of your server!')
end)
RSGCore:Client:PvpHasToggled
- 处理玩家登录以选择角色
此事件可以用作触发代码的事件处理程序,因为它表示玩家已成功卸载或注销服务器!
RegisterNetEvent('RSGCore:Client:OnPlayerUnload', function()
print('Im a client and i just logged out of your server!')
end)
RSGCore:Client:PvpHasToggled
在播放器加载时,在检查 rsg-core 配置以查看是否应启用或禁用 PVP 后触发此事件检查.
RegisterNetEvent('RSGCore:Client:PvpHasToggled', function(pvp_state)
print('PVP mode has been set to '..pvp_state..'!')
end)
RSGCore:Command:SpawnVehicle
参数 | 类型 | 必填 | 违约 |
---|---|---|---|
购物车模型 | 字符串 | 是的 | 没有 |
客户端示例
RegisterCommand('spawnveh', function(_, args)
local vehicle = RSGCore.Shared.Trim(args[1])
TriggerEvent('RSGCore:Command:SpawnVehicle', vehicle)
end)
服务器示例
RegisterCommand('spawnveh', function(source, args)
local vehicle = RSGCore.Shared.Trim(args[1])
TriggerClientEvent('RSGCore:Command:SpawnVehicle', source, vehicle)
end)
RSGCore:Command:DeleteVehicle
参数 | 类型 | 必填 | 违约 |
---|---|---|---|
没有 | 没有 | 不 | 没有 |
客户端示例
RegisterCommand('deleteveh', function(_, args)
TriggerEvent('RSGCore:Command:DeleteVehicle')
end)
服务器示例
RegisterCommand('deleteveh', function(source, args)
TriggerClientEvent('RSGCore:Command:DeleteVehicle', source)
end)
RSGCore:Player:SetPlayerData
此事件可以用作触发代码的事件处理程序,因为它指示玩家数据已更改!
RegisterNetEvent('RSGCore:Player:SetPlayerData', function(val)
PlayerData = val
print(RSGCore.Debug(PlayerData))
end)
RSGCore:Client:UseItem
参数 | 类型 | 必填 | 违约 |
---|---|---|---|
项目名称 | 字符串 | 是的 | 没有 |
客户端示例(您的库存中必须有该商品)
RegisterCommand('useitem', function(_, args)
local item = {
name = args[1],
amount = tonumber(args[2])
}
TriggerEvent('RSGCore:Client:UseItem', item)
end)
服务器示例(您的库存中必须有该物品)
RegisterCommand('useitem', function(source, args)
local item = {
name = args[1],
amount = tonumber(args[2])
}
TriggerClientEvent('RSGCore:Client:UseItem', source, item)
end)
RSGCore:Client:UpdateObject
使用共享导出时,此事件必须用作处理程序,因为它会刷新资源中的核心对象
RegisterNetEvent('RGCore:Client:UpdateObject', function()
RSGCore = exports['rsg-core']:GetCoreObject()
end)
本站代码模板仅供学习交流使用请勿商业运营,严禁从事违法,侵权等任何非法活动,否则后果自负!
THE END
- 最新
- 最热
只看作者