Skip to content

Instantly share code, notes, and snippets.

@Koncord
Created July 23, 2016 14:21
Show Gist options
  • Select an option

  • Save Koncord/21ea1be2d827ca27df56d58517022034 to your computer and use it in GitHub Desktop.

Select an option

Save Koncord/21ea1be2d827ca27df56d58517022034 to your computer and use it in GitHub Desktop.
Example for TES3MP GUI
function OnPlayerSendMessage(pid, message)
local pname = tes3mp.GetName(pid)
print(pname.."("..pid.."): "..message)
if myMod.OnPlayerMessage(pid, message) == 0 then
return 0
end
if message:sub(1,1) == '/' then
local cmd = (message:sub(2, #message)):split(" ")
if cmd[1] == "test" then
if cmd[2] == "1" then
tes3mp.MessageBox(pid, 321, "Test Message Box")
elseif cmd[2] == "2" then
tes3mp.CustomMessageBox(pid, 2222, "Test Custom Message Box", "Btn1;Btn2;Btn3")
elseif cmd[2] == "3" then
tes3mp.InputDialog(pid, 31234, "Test Message Dialog")
end
return 0
end
end
return 1
end
function OnGUIAction(pid, idGui, data) -- idGua - any numeric value, data - is string returned from client
if idGui == 321 then
print("MessageBox returned")
elseif idGui == 2222 then
print("CustomMessageBox returned: "..data)
elseif idGui == 31234 then
print("InputDialog returned: "..data)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment