MP menu works finally

This commit is contained in:
Pao
2023-01-12 17:16:44 +01:00
parent c049defe9d
commit 76c6f2f6db
3 changed files with 17 additions and 11 deletions

View File

@@ -7,15 +7,16 @@ local function OnTocServerCommand(module, command, args)
if command == 'GivePlayerData' then if command == 'GivePlayerData' then
--local surgeon = getPlayerByOnlineID(args[1]) --local surgeon = getPlayerByOnlineID(args[1])
local surgeon_id = args[1]
local patient = getPlayer()
local surgeon_id = args[1]
local patient = getPlayerByOnlineID(args[2])
local toc_data = patient:getModData().TOC local toc_data = patient:getModData().TOC
-- todo maybe we cant send a table like this. Let's try something easier -- todo maybe we cant send a table like this. Let's try something easier
--local moneyAmount = playerTwo:getInventory():getCountTypeRecurse("Money") --local moneyAmount = playerTwo:getInventory():getCountTypeRecurse("Money")
print("Giving info") print("Giving info")
sendClientCommand(patient, "TOC", "SendPlayerData", {surgeon_id, 69}) sendClientCommand(patient, "TOC", "SendPlayerData", {surgeon_id, toc_data})
elseif command == 'SendTocData' then elseif command == 'SendTocData' then
print("Sending TOC data") print("Sending TOC data")

View File

@@ -632,14 +632,14 @@ function ISNewHealthPanel.onClick_TOC(button)
-- button.character is patient -- button.character is patient
-- button.otherPlayer is surgeon -- button.otherPlayer is surgeon
sendClientCommand(button.otherPlayer, "TOC", "GetPlayerData", {button.otherPlayer:getOnlineID(), button.character:getOnlineID()}) -- sends 0 & 4 as arguments sendClientCommand(button.otherPlayer, "TOC", "GetPlayerData", {button.otherPlayer:getOnlineID(), button.character:getOnlineID()})
if MP_other_player_toc_data then -- if MP_other_player_toc_data ~= nil then
print("It works") -- print("It works")
print(MP_other_player_toc_data) -- print(MP_other_player_toc_data)
else -- else
print("Nopepppp") -- print("Nopepppp")
end -- end
if button.character ~= button.otherPlayer then if button.character ~= button.otherPlayer then

View File

@@ -25,10 +25,15 @@ local function OnTocClientCommand(module, command, player, args)
print(command) print(command)
if command == 'GetPlayerData' then if command == 'GetPlayerData' then
local surgeon_id = args[1]
local patient_id = args[2]
local playerOne = getPlayerByOnlineID(args[1]) local playerOne = getPlayerByOnlineID(args[1])
local playerTwo = getPlayerByOnlineID(args[2]) local playerTwo = getPlayerByOnlineID(args[2])
local playerOneID = args[1] local playerOneID = args[1]
sendServerCommand(playerTwo, "TOC", "GivePlayerData", {playerOneID}) sendServerCommand(playerTwo, "TOC", "GivePlayerData", {surgeon_id, patient_id})
elseif command == 'SendPlayerData' then elseif command == 'SendPlayerData' then
local playerOne = getPlayerByOnlineID(args[1]) local playerOne = getPlayerByOnlineID(args[1])
local playerOneID = args[1] local playerOneID = args[1]