Files
The-Only-Cure/media/lua/server/TOC_MP_server.lua
2023-01-12 15:13:57 +01:00

47 lines
1.3 KiB
Lua

--- A rly big thx to Fenris_Wolf and Chuck to help me with that. Love you guy
---Server side
local Commands = {}
-- todo what is this?
Commands["SendServer"] = function(player, arg)
local otherPlayer = getPlayerByOnlineID(arg["To"])
print("The Only Cure Command: ", arg['command'])
sendServerCommand(otherPlayer, "TOC", arg["command"], arg)
end
local function OnTocClientCommand(module, command, player, args)
if module == 'TOC' then
print(command)
if command == 'GetPlayerData' then
local playerOne = getPlayerByOnlineID(args[1])
local playerTwo = getPlayerByOnlineID(args[2])
local playerOneID = args[1]
sendServerCommand(playerTwo, "TOC", "GivePlayerData", {playerOneID})
elseif command == 'SendPlayerData' then
local playerOne = getPlayerByOnlineID(args[1])
local playerOneID = args[1]
local toc_data = args[2]
sendServerCommand(playerOne, "TOC", "SendTocData", {playerOneID, toc_data})
end
end
end
local onClientCommand = function(module, command, player, args)
if module == 'TOC' and Commands[command] then
args = args or {}
Commands[command](_, args)
end
end
Events.OnClientCommand.Add(OnTocClientCommand)
--Client 1 -> Server -> Client 1