scaryface87 Posted July 22, 2015 Share Posted July 22, 2015 window= guiCreateWindow(264, 189, 355, 294, "", false) guiWindowSetSizable(window, false) memo = guiCreateMemo(14, 25, 331, 259, "", false, window) guiSetVisible(window,false) Hello so i wanna make it so only people in ACL admin will be able to edit it. The one who arent admin shouldnt be able to edit it. So if player 1 does /memo and i write "this is a test" and then presses "save" button it would save if player 2 doess /memo he will see the SAME message that got last saved by player 1 for example Link to comment
anumaz Posted July 22, 2015 Share Posted July 22, 2015 Do you want it to save even if you restart the resource/server? Link to comment
scaryface87 Posted July 23, 2015 Author Share Posted July 23, 2015 If possible but if it requires a database i dont want it to ssave if u restart the resource then it"ll just saves till the script restartss Link to comment
KariiiM Posted July 23, 2015 Share Posted July 23, 2015 Try something like that, If you want to saves the memo even the resource restarted,you need to use either SQL, MySQL or XML. --client side: window= guiCreateWindow(264, 189, 355, 294, "", false) guiWindowSetSizable(window, false) memo = guiCreateMemo(14, 25, 331, 259, "", false, window) guiSetVisible(window,false) client = getLocalPlayer() function editMemo() guiSetText ( memo, "" ) triggerServerEvent ("memoEditable",client) end --server side: addEvent( "memoEditable", true ) addEventHandler("memoEditable", root, function () local account = getPlayerAccount(player) if not account or isGuestAccount(account) then return end local accountName = getAccountName(account) for k,v in ipairs ( { "Console","Owner" } ) do --You can change them by your ACL Admin names if isObjectInACLGroup ( "user." .. accountName, aclGetGroup (v) ) then end end end) Link to comment
anumaz Posted July 23, 2015 Share Posted July 23, 2015 Try something like that,If you want to saves the memo even the resource restarted,you need to use either SQL, MySQL or XML. --client side: window= guiCreateWindow(264, 189, 355, 294, "", false) guiWindowSetSizable(window, false) memo = guiCreateMemo(14, 25, 331, 259, "", false, window) guiSetVisible(window,false) client = getLocalPlayer() function editMemo() guiSetText ( memo, "" ) triggerServerEvent ("memoEditable",client) end --server side: addEvent( "memoEditable", true ) addEventHandler("memoEditable", root, function () local account = getPlayerAccount(player) if not account or isGuestAccount(account) then return end local accountName = getAccountName(account) for k,v in ipairs ( { "Console","Owner" } ) do --You can change them by your ACL Admin names if isObjectInACLGroup ( "user." .. accountName, aclGetGroup (v) ) then end end end) Doubt it'll work. Didn't test it, but you events don't return anything and the way you did it, it does not matter if he's acl admin or not. You need another event going from server to client again. Link to comment
LaCosTa Posted July 23, 2015 Share Posted July 23, 2015 This could help you but I didn't test it, you should change the code to your code to be synced -- client side -- you should get the ID from the data , try to save data first with -- setElementData(element, "id", value) because I don't know your code function saveInformation() local text = guiGetText(memo) local id = getElementData(localPlayer, "id") triggerServerEvent("memoInfo", resourceRoot, text, id) end addEventHandler("onClientGUIClick",button,saveInformation) --server side , you should have table where you can store the text in it and with this function -- we can get it yourTable = { -- id , text {1, "This is your Text"}, } function memoInfo(text, id) for k, v in pairs(yourTable) do if v[1] == id then v[2] = text return end end end addEvent("memoInfo", true) addEventHandler("memoInfo", root, memoInfo) 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