myonlake Posted November 4, 2011 Share Posted November 4, 2011 (edited) Hello, It seems that this code gives me an error: "Client triggered serverside event onCommand, but event is not added serverside" Client-side function onTrigger(cmd) triggerServerEvent("onCommand", getLocalPlayer()) end addCommandHandler("cmds", onTrigger) function onTrigger1() guiSetVisible(window2, true) showCursor(true) end addEvent("onTriggerCommand1", true) addEventHandler("onTriggerCommand1", getRootElement(), onTrigger1) function onTrigger2() guiSetVisible(window, true) showCursor(true) end addEvent("onTriggerCommand2", true) addEventHandler("onTriggerCommand2", getRootElement(), onTrigger2) Server-side function commandHandler(player) local account = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then triggerClientEvent("onTriggerCommand1", player) end if isObjectInACLGroup("user." .. account, aclGetGroup("MemberExtra")) then triggerClientEvent("onTriggerCommand2", player) end end addEvent("onCommand", true) addEventHandler("onCommand", getRootElement(), commandHandler) I haven't put the GUI on the code because it's not necessarry. Edited May 30, 2019 by myonlake Link to comment
Aibo Posted November 4, 2011 Share Posted November 4, 2011 what is the purpose of this? what's wrong with addCommandHandler? anyway, your problem is stated in that error message. it means that your server part either not running or stops somewhere before the event is added. Link to comment
myonlake Posted November 4, 2011 Author Share Posted November 4, 2011 Cool, just found out my god damn XML file had wrong type on the server thing. It had client, no shit it didn't work - thanks anyways Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now