I want to create a user interface window with yes/no buttons, like the trading window in vanilla, using client and server commands, but at the moment of calling the commands the code crashes, please tell me how to fix it, does anyone know, this code should display a window with a choice for the player to whom the request was sent:
client:
ISWorldObjectContextMenu.SendAnswerWindow = function(worldobjects, playerObj, clickedPlayer)
print(playerObj)
print(clickedPlayer)
if playerObj and clickedPlayer then
print("players data successfully transferred")
sendClientCommand("123", "TradeRequestSent", playerObj)
end
end
function receiveTradeRequestSentNotification(senderName)
local player = getPlayer()
local modal = ISModalDialog:new(getCore():getScreenWidth() / 2 - 175,getCore():getScreenHeight() / 2 - 75, 350, 150, getText("IGUI_TradingUI_Youreceivedtraderequest", senderName), true, nil, ISTradingUI.onAnswerTradeRequest);
modal:initialise()
modal:addToUIManager()
modal.requester = player;
modal.moveWithMouse = true;
ISTradingUI.tradeQuestionUI = modal;
end
Events.OnServerCommand.Add(function(command, player, ...)
if command == 'TradeRequestSent' then
receiveTradeRequestSentNotification(...)
end
end)
server:
Events.OnClientCommand.Add(function(command, playerObj, recipientName)
if command == "TradeRequestSent" then
sendServerCommand(playerObj, 'TradeRequestSent', recipientName)
end
end)
code fucks up at this line:
sendClientCommand("123", "TradeRequestSent", playerObj)