GanJaRuleZ Posted February 2, 2012 Share Posted February 2, 2012 Hai I've finished the infopanel , but i got an problem Everytime i edit the 'administrate memo' (memo7 in script ) , it will output binds too , including the 'say' one That means if i write 'there' , it will trigger the 'say' command.. Any way to solve it? Here is the client script if you need it.. infoPanel = guiCreateWindow(103,113,521,357,"F1 - Info",false) guiSetVisible (infoPanel, false) tabPanel = guiCreateTabPanel(10,21,502,327,false,infoPanel) tab1 = guiCreateTab("Tab",tabPanel) memo1 = guiCreateMemo(6,9,490,284,"",false,tab1) guiMemoSetReadOnly(memo1, true) tab2 = guiCreateTab("Tab",tabPanel) memo2 = guiCreateMemo(6,9,490,284,"",false,tab2) guiMemoSetReadOnly(memo2, true) tab3 = guiCreateTab("Tab",tabPanel) memo3 = guiCreateMemo(6,9,490,284,"",false,tab3) guiMemoSetReadOnly(memo3, true) tab4 = guiCreateTab("Tab",tabPanel) memo4 = guiCreateMemo(6,9,490,284,"",false,tab4) guiMemoSetReadOnly(memo4, true) tab5 = guiCreateTab("Tab",tabPanel) memo5 = guiCreateMemo(6,9,490,284,"",false,tab5) guiMemoSetReadOnly(memo5, true) tab6 = guiCreateTab("Tab",tabPanel) memo6 = guiCreateMemo(6,9,490,284,"",false,tab6) guiMemoSetReadOnly(memo6, true) tab7 = guiCreateTab("Administrate",tabPanel) memo7 = guiCreateMemo(6,9,379,283,"",false,tab7) label1 = guiCreateLabel(391,14,73,17,"<-- Edit here",false,tab7) button1 = guiCreateButton(398,97,89,28,"Send to TAB1",false,tab7) button2 = guiCreateButton(398,128,89,28,"Send to TAB2",false,tab7) button3 = guiCreateButton(398,159,89,28,"Send to TAB3",false,tab7) button4 = guiCreateButton(398,190,89,28,"Send to TAB4",false,tab7) button5 = guiCreateButton(398,221,89,28,"Send to TAB5",false,tab7) button6 = guiCreateButton(398,252,89,28,"Send to TAB6",false,tab7) function saveXml1() local theText = guiGetText( memo7 ) triggerServerEvent( 'setServer1Text', localPlayer ,theText) end addEvent ( "saveToXML1", true ) addEventHandler ( "saveToXML1", getRootElement(), saveXml1 ) function saveXml2() local theText = guiGetText( memo7 ) triggerServerEvent( 'setServer2Text', localPlayer ,theText) end addEvent ( "saveToXML2", true ) addEventHandler ( "saveToXML2", getRootElement(), saveXml2 ) function saveXml3() local theText = guiGetText( memo7 ) triggerServerEvent( 'setServer3Text', localPlayer ,theText) end addEvent ( "saveToXML3", true ) addEventHandler ( "saveToXml3", getRootElement(), saveXml3 ) function saveXml4() local theText = guiGetText( memo7 ) triggerServerEvent( 'setServer4Text', localPlayer ,theText) end addEvent ( "saveToXML4", true ) addEventHandler ( "saveToXML4", getRootElement(), saveXml4 ) function saveXml5() local theText = guiGetText( memo7 ) triggerServerEvent( 'setServer5Text', localPlayer ,theText) end addEvent ( "saveToXML5", true ) addEventHandler ( "saveToXML5", getRootElement(), saveXml5 ) function saveXml6() local theText = guiGetText( memo7 ) triggerServerEvent( 'setServer6Text', localPlayer ,theText) end addEvent ( "saveToXML6", true ) addEventHandler ( "saveToXML6", getRootElement(), saveXml6 ) function onGuiClick (button, state, absoluteX, absoluteY) if (source == button1) then triggerServerEvent ("admin1", getLocalPlayer()) elseif (source == button2) then triggerServerEvent ("admin2", getLocalPlayer()) elseif (source == button3) then triggerServerEvent ("admin3", getLocalPlayer()) elseif (source == button4) then triggerServerEvent ("admin4", getLocalPlayer()) elseif (source == button5) then triggerServerEvent ("admin5", getLocalPlayer()) elseif (source == button6) then triggerServerEvent ("admin6", getLocalPlayer()) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) function showInfoPanel () if (guiGetVisible (infoPanel)) then guiSetVisible (infoPanel, false) showCursor (false) else guiSetVisible(infoPanel, true) showCursor (true) end end bindKey ("F1", "down", showInfoPanel) addEvent( 'setMemo1Text', true ) addEventHandler( 'setMemo1Text', root, function( text1 ) guiSetText( memo1, text1 ) end) addEvent( 'setMemo2Text', true ) addEventHandler( 'setMemo2Text', root, function( text2 ) guiSetText( memo2, text2 ) end) addEvent( 'setMemo3Text', true ) addEventHandler( 'setMemo3Text', root, function( text3 ) guiSetText( memo3, text3 ) end) addEvent( 'setMemo4Text', true ) addEventHandler( 'setMemo4Text', root, function( text4 ) guiSetText( memo4, text4 ) end) addEvent( 'setMemo5Text', true ) addEventHandler( 'setMemo5Text', root, function( text5 ) guiSetText( memo5, text5 ) end) addEvent( 'setMemo6Text', true ) addEventHandler( 'setMemo6Text', root, function( text6 ) guiSetText( memo6, text6 ) end) function refreshAllTheMemo() triggerServerEvent( 'refreshRights', localPlayer ) end addCommandHandler ( "refreshMemo", refreshAllTheMemo ) Link to comment
Castillo Posted February 2, 2012 Share Posted February 2, 2012 infoPanel = guiCreateWindow(103,113,521,357,"F1 - Info",false) guiSetVisible (infoPanel, false) tabPanel = guiCreateTabPanel(10,21,502,327,false,infoPanel) tab1 = guiCreateTab("Tab",tabPanel) memo1 = guiCreateMemo(6,9,490,284,"",false,tab1) guiMemoSetReadOnly(memo1, true) tab2 = guiCreateTab("Tab",tabPanel) memo2 = guiCreateMemo(6,9,490,284,"",false,tab2) guiMemoSetReadOnly(memo2, true) tab3 = guiCreateTab("Tab",tabPanel) memo3 = guiCreateMemo(6,9,490,284,"",false,tab3) guiMemoSetReadOnly(memo3, true) tab4 = guiCreateTab("Tab",tabPanel) memo4 = guiCreateMemo(6,9,490,284,"",false,tab4) guiMemoSetReadOnly(memo4, true) tab5 = guiCreateTab("Tab",tabPanel) memo5 = guiCreateMemo(6,9,490,284,"",false,tab5) guiMemoSetReadOnly(memo5, true) tab6 = guiCreateTab("Tab",tabPanel) memo6 = guiCreateMemo(6,9,490,284,"",false,tab6) guiMemoSetReadOnly(memo6, true) tab7 = guiCreateTab("Administrate",tabPanel) memo7 = guiCreateMemo(6,9,379,283,"",false,tab7) label1 = guiCreateLabel(391,14,73,17,"<-- Edit here",false,tab7) button1 = guiCreateButton(398,97,89,28,"Send to TAB1",false,tab7) button2 = guiCreateButton(398,128,89,28,"Send to TAB2",false,tab7) button3 = guiCreateButton(398,159,89,28,"Send to TAB3",false,tab7) button4 = guiCreateButton(398,190,89,28,"Send to TAB4",false,tab7) button5 = guiCreateButton(398,221,89,28,"Send to TAB5",false,tab7) button6 = guiCreateButton(398,252,89,28,"Send to TAB6",false,tab7) function saveXml1() local theText = guiGetText( memo7 ) triggerServerEvent( 'setServer1Text', localPlayer ,theText) end addEvent ( "saveToXML1", true ) addEventHandler ( "saveToXML1", getRootElement(), saveXml1 ) function saveXml2() local theText = guiGetText( memo7 ) triggerServerEvent( 'setServer2Text', localPlayer ,theText) end addEvent ( "saveToXML2", true ) addEventHandler ( "saveToXML2", getRootElement(), saveXml2 ) function saveXml3() local theText = guiGetText( memo7 ) triggerServerEvent( 'setServer3Text', localPlayer ,theText) end addEvent ( "saveToXML3", true ) addEventHandler ( "saveToXml3", getRootElement(), saveXml3 ) function saveXml4() local theText = guiGetText( memo7 ) triggerServerEvent( 'setServer4Text', localPlayer ,theText) end addEvent ( "saveToXML4", true ) addEventHandler ( "saveToXML4", getRootElement(), saveXml4 ) function saveXml5() local theText = guiGetText( memo7 ) triggerServerEvent( 'setServer5Text', localPlayer ,theText) end addEvent ( "saveToXML5", true ) addEventHandler ( "saveToXML5", getRootElement(), saveXml5 ) function saveXml6() local theText = guiGetText( memo7 ) triggerServerEvent( 'setServer6Text', localPlayer ,theText) end addEvent ( "saveToXML6", true ) addEventHandler ( "saveToXML6", getRootElement(), saveXml6 ) function onGuiClick (button, state, absoluteX, absoluteY) if (source == button1) then triggerServerEvent ("admin1", getLocalPlayer()) elseif (source == button2) then triggerServerEvent ("admin2", getLocalPlayer()) elseif (source == button3) then triggerServerEvent ("admin3", getLocalPlayer()) elseif (source == button4) then triggerServerEvent ("admin4", getLocalPlayer()) elseif (source == button5) then triggerServerEvent ("admin5", getLocalPlayer()) elseif (source == button6) then triggerServerEvent ("admin6", getLocalPlayer()) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) function showInfoPanel () if (guiGetVisible (infoPanel)) then guiSetVisible (infoPanel, false) showCursor (false) guiSetInputEnabled(false) else guiSetVisible(infoPanel, true) showCursor (true) guiSetInputEnabled(true) end end bindKey ("F1", "down", showInfoPanel) addEvent( 'setMemo1Text', true ) addEventHandler( 'setMemo1Text', root, function( text1 ) guiSetText( memo1, text1 ) end) addEvent( 'setMemo2Text', true ) addEventHandler( 'setMemo2Text', root, function( text2 ) guiSetText( memo2, text2 ) end) addEvent( 'setMemo3Text', true ) addEventHandler( 'setMemo3Text', root, function( text3 ) guiSetText( memo3, text3 ) end) addEvent( 'setMemo4Text', true ) addEventHandler( 'setMemo4Text', root, function( text4 ) guiSetText( memo4, text4 ) end) addEvent( 'setMemo5Text', true ) addEventHandler( 'setMemo5Text', root, function( text5 ) guiSetText( memo5, text5 ) end) addEvent( 'setMemo6Text', true ) addEventHandler( 'setMemo6Text', root, function( text6 ) guiSetText( memo6, text6 ) end) function refreshAllTheMemo() triggerServerEvent( 'refreshRights', localPlayer ) end addCommandHandler ( "refreshMemo", refreshAllTheMemo ) Link to comment
GanJaRuleZ Posted February 2, 2012 Author Share Posted February 2, 2012 Hmm , ty ! You really saved my day Link to comment
GanJaRuleZ Posted February 2, 2012 Author Share Posted February 2, 2012 (edited) Hmm , i tried to reduce it to 4 tabs + 1 the administrate one , but it seems it doesn't refreshes when i write /refreshMemo Can you help me please? Clientside -- By me , edited by solidsnake infoPanel = guiCreateWindow(103,113,521,357,"F1 - Info",false) guiSetVisible (infoPanel, false) tabPanel = guiCreateTabPanel(10,21,502,327,false,infoPanel) tab1 = guiCreateTab("News",tabPanel) memo1 = guiCreateMemo(6,9,490,284,"",false,tab1) guiMemoSetReadOnly(memo1, true) tab2 = guiCreateTab("Rules",tabPanel) memo2 = guiCreateMemo(6,9,490,284,"",false,tab2) guiMemoSetReadOnly(memo2, true) tab3 = guiCreateTab("@@@ Members",tabPanel) memo3 = guiCreateMemo(6,9,490,284,"",false,tab3) guiMemoSetReadOnly(memo3, true) tab4 = guiCreateTab("Admins",tabPanel) memo4 = guiCreateMemo(6,9,490,284,"",false,tab4) guiMemoSetReadOnly(memo4, true) tab7 = guiCreateTab("Administrate",tabPanel) memo7 = guiCreateMemo(6,9,379,283,"",false,tab7) label1 = guiCreateLabel(391,14,73,17,"<-- Edit here",false,tab7) button1 = guiCreateButton(398,97,89,28,"Send to TAB1",false,tab7) button2 = guiCreateButton(398,128,89,28,"Send to TAB2",false,tab7) button3 = guiCreateButton(398,159,89,28,"Send to TAB3",false,tab7) button4 = guiCreateButton(398,190,89,28,"Send to TAB4",false,tab7) function saveXml1() local theText = guiGetText( memo7 ) triggerServerEvent( 'setServer1Text', localPlayer ,theText) end addEvent ( "saveToXML1", true ) addEventHandler ( "saveToXML1", getRootElement(), saveXml1 ) function saveXml2() local theText = guiGetText( memo7 ) triggerServerEvent( 'setServer2Text', localPlayer ,theText) end addEvent ( "saveToXML2", true ) addEventHandler ( "saveToXML2", getRootElement(), saveXml2 ) function saveXml3() local theText = guiGetText( memo7 ) triggerServerEvent( 'setServer3Text', localPlayer ,theText) end addEvent ( "saveToXML3", true ) addEventHandler ( "saveToXml3", getRootElement(), saveXml3 ) function saveXml4() local theText = guiGetText( memo7 ) triggerServerEvent( 'setServer4Text', localPlayer ,theText) end addEvent ( "saveToXML4", true ) addEventHandler ( "saveToXML4", getRootElement(), saveXml4 ) function onGuiClick (button, state, absoluteX, absoluteY) if (source == button1) then triggerServerEvent ("admin1", getLocalPlayer()) elseif (source == button2) then triggerServerEvent ("admin2", getLocalPlayer()) elseif (source == button3) then triggerServerEvent ("admin3", getLocalPlayer()) elseif (source == button4) then triggerServerEvent ("admin4", getLocalPlayer()) elseif (source == button5) then triggerServerEvent ("admin5", getLocalPlayer()) elseif (source == button6) then triggerServerEvent ("admin6", getLocalPlayer()) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) function showInfoPanel () if (guiGetVisible (infoPanel)) then guiSetVisible (infoPanel, false) showCursor (false) guiSetInputEnabled(false) else guiSetVisible(infoPanel, true) showCursor (true) guiSetInputEnabled(true) end end bindKey ("F1", "down", showInfoPanel) addEvent( 'setMemo1Text', true ) addEventHandler( 'setMemo1Text', root, function( text1 ) guiSetText( memo1, text1 ) end) addEvent( 'setMemo2Text', true ) addEventHandler( 'setMemo2Text', root, function( text2 ) guiSetText( memo2, text2 ) end) addEvent( 'setMemo3Text', true ) addEventHandler( 'setMemo3Text', root, function( text3 ) guiSetText( memo3, text3 ) end) addEvent( 'setMemo4Text', true ) addEventHandler( 'setMemo4Text', root, function( text4 ) guiSetText( memo4, text4 ) end) function refreshAllTheMemo() triggerServerEvent( 'refreshRights', localPlayer ) end addCommandHandler ( "refreshMemo", refreshAllTheMemo ) memotext.xml -- By me <memotext> <memo1text text="" /> <memo2text text="" /> <memo3text text="" /> <memo4text text="" /> </memotext> No erros Edited February 5, 2012 by Guest Link to comment
Castillo Posted February 2, 2012 Share Posted February 2, 2012 Works perfectly fine, I write /refreshMemo and the text is updated. Link to comment
GanJaRuleZ Posted February 5, 2012 Author Share Posted February 5, 2012 @Solidsnake , yes when there are max 2 or 3 players , everybody can see the updated memo , but , if there are more then 3 players , if i do /refreshMemo , nobody can see , including me .. EDIT : No i didn't here are the new errors : [2012-02-05 12:55:43] WARNING: infopanel\infopanel_s.lua:135: Bad argument @ 'setTimer' [Expected function at argument 1, got boolean] [2012-02-05 12:55:43] WARNING: infopanel\infopanel_s.lua:136: Bad argument @ 'setTimer' [Expected function at argument 1, got boolean] [2012-02-05 12:55:43] WARNING: infopanel\infopanel_s.lua:137: Bad argument @ 'setTimer' [Expected function at argument 1, got boolean] [2012-02-05 12:55:43] WARNING: infopanel\infopanel_s.lua:138: Bad argument @ 'setTimer' [Expected function at argument 1, got boolean] [2012-02-05 12:55:43] WARNING: infopanel\infopanel_s.lua:139: Bad argument @ 'setTimer' [Expected function at argument 1, got boolean] [2012-02-05 12:55:43] WARNING: infopanel\infopanel_s.lua:140: Bad argument @ 'setTimer' [Expected function at argument 1, got boolean] [2012-02-05 12:55:43] WARNING: infopanel\infopanel_s.lua:141: Bad argument @ 'setTimer' [Expected function at argument 1, got boolean] Here are that lines function refreshAll() local memotext1 = xmlFindChild(memotextxml, "memo1text", 0) local memotext2 = xmlFindChild(memotextxml, "memo2text", 0) local memotext3 = xmlFindChild(memotextxml, "memo3text", 0) local memotext4 = xmlFindChild(memotextxml, "memo4text", 0) local text1 = xmlNodeGetAttribute(memotext1, "text") local text2 = xmlNodeGetAttribute(memotext2, "text") local text3 = xmlNodeGetAttribute(memotext3, "text") local text4 = xmlNodeGetAttribute(memotext4, "text") local account = getPlayerAccount ( source ) if isGuestAccount ( account ) then outputChatBox("#990000You must login to use this function!", source, 255, 0, 0, true) else local accName = getAccountName ( account ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then local players = getElementsByType("player") for k,v in ipairs(players) do setTimer( triggerClientEvent ( "setMemo1Text", getRootElement(), text1) , 1000 , 1) setTimer( triggerClientEvent ( "setMemo2Text", getRootElement(), text2) , 1500 , 1) setTimer( triggerClientEvent ( "setMemo3Text", getRootElement(), text3) , 2000 , 1) setTimer( triggerClientEvent ( "setMemo4Text", getRootElement(), text4) , 3000 , 1) setTimer(outputChatBox ( "#FF9912Memo's succesfully updated.", getRootElement(), 255, 255, 255, true ), 4000 ,1) setTimer(xmlSaveFile(memotextxml) , 4000 ,1) setTimer(outputChatBox ( "#FF9912Memo's succesfully saved.", getRootElement(), 255, 255, 255, true ), 4000 ,1) end else outputChatBox("#990000Just admins can use this function!", source, 99, 0, 0, true) end end end addEvent( "refreshRights", true ) addEventHandler( "refreshRights", getRootElement(), refreshAll) Can anybody help me? Link to comment
Kenix Posted February 5, 2012 Share Posted February 5, 2012 function refreshAll( ) local memotext1 = xmlFindChild( memotextxml, "memo1text", 0 ) local memotext2 = xmlFindChild( memotextxml, "memo2text", 0 ) local memotext3 = xmlFindChild( memotextxml, "memo3text", 0 ) local memotext4 = xmlFindChild( memotextxml, "memo4text", 0 ) local text1 = xmlNodeGetAttribute( memotext1, "text" ) local text2 = xmlNodeGetAttribute( memotext2, "text" ) local text3 = xmlNodeGetAttribute( memotext3, "text" ) local text4 = xmlNodeGetAttribute( memotext4, "text" ) local account = getPlayerAccount ( source ) if isGuestAccount ( account ) then outputChatBox("#990000You must login to use this function!", source, 255, 0, 0, true) else local accName = getAccountName ( account ) if isObjectInACLGroup ( "user."..accName, aclGetGroup ( "Admin" ) ) then setTimer( function( ) triggerClientEvent ( "setMemo1Text", root, text1 ) end, 1000 , 1 ) setTimer( function( ) triggerClientEvent ( "setMemo2Text", root, text2 ) end, 1500 , 1 ) setTimer( function( ) triggerClientEvent ( "setMemo3Text", root, text3 ) end, 2000 , 1 ) setTimer( function( ) triggerClientEvent ( "setMemo4Text", root, text4 ) end, 3000 , 1 ) setTimer( function( ) outputChatBox ( "#FF9912Memo's succesfully updated.", root, 255, 255, 255, true ) xmlSaveFile( memotextxml ) outputChatBox ( "#FF9912Memo's succesfully saved.", root, 255, 255, 255, true ) end,4000, 1 ) else outputChatBox( "#990000Just admins can use this function!", source, 99, 0, 0, true ) end end end addEvent( "refreshRights", true ) addEventHandler( "refreshRights", root, refreshAll ) P.S You can tabulate code? 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