Hi.
1) TriggerClientEvent is not a valid function, correct is triggerClientEvent.
2) Player variable is not defined (so it's nil) in LoginPanelShow and LoginPanelDelete.
3) Third argument is missing in triggerClientEvent, check syntax on wiki.
-- CLIENT
local login = {};
function login_show()
login[1] = guiCreateWindow (0, 0, 0.5, 0.4, "Information", true);
login[2] = guiCreateTabPanel (0, 0.1, 1, 1, true, login[1]);
login[4] = guiCreateTab("Map Information", login[3]);
login[5] = guiCreateTab("Help", login[4]);
-- adds a label (text) to each tab
guiCreateLabel(0.02, 0.04, 0.94, 0.2, "This is information about the current map", true, login[4]);
guiCreateLabel(0.02, 0.04, 0.94, 0.92, "This is help text.", true, login[5]);
end;
addEvent("loginshow", true);
-- listen to those events, which source is 'resourceRoot'
addEventHandler("loginshow", resourceRoot, login_show);
function login_delete()
for i,k in ipairs(login) do
if login[i] then
guiSetVisible(login[i], false);
end;
end;
end;
addEvent("logindelete", true);
addEventHandler("logindelete", resourceRoot, login_delete);
-- SERVER
-- addCommandHandler pass the player's element to function at first argument. (only on server side, check addCommandHandler's syntax on wiki)
function LoginPanelShow(Player)
-- send this trigger to 'Player', and use 'resourceRoot' as source of the event
triggerClientEvent(Player, "loginshow", resourceRoot);
end
function LoginPanelDelete(Player)
triggerClientEvent(Player, "logindelete", resourceRoot);
end
addCommandHandler("test1", LoginPanelShow);
addCommandHandler("test2", LoginPanelDelete);
And here is some excellent tutorials:
- https://forum.multitheftauto.com/topic/64228-the-ultimate-lua-tutorial/
- https://forum.multitheftauto.com/topic/121619-lua-for-absolute-beginners
- https://forum.multitheftauto.com/topic/95654-tut-debugging/
- https://forum.multitheftauto.com/topic/114541-tut-events/
- https://forum.multitheftauto.com/topic/117472-tut-scaling-dx/