Turbe$Z Posted October 21, 2016 Posted October 21, 2016 local screenW, screenH = guiGetScreenSize() local GUIEditor = { button = {}, window = {}, edit = {} } GUIEditor.window[1] = guiCreateWindow(0.35, 0.40, 0.32, 0.12, "Event hírdető panel", true) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.button[1] = guiCreateButton(0.04, 0.68, 0.78, 0.23, "Beírt szöveg kiírása", true, GUIEditor.window[1]) GUIEditor.edit[1] = guiCreateEdit(0.03, 0.21, 0.93, 0.38, "", true, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(0.84, 0.68, 0.14, 0.23, "Bezár", true, GUIEditor.window[1]) guiSetVisible(GUIEditor.window[1], false) guiSetInputMode("no_binds_when_editing") function showGUI() guiSetVisible( GUIEditor.window[1], true ) showCursor( true ) end addEvent( "showguii", true ) addEventHandler( "showguii", localPlayer, showGUI ) addEventHandler("onClientGUIClick",root, function () if source == GUIEditor.button[2] then guiSetVisible(GUIEditor.window[1],false) showCursor(false) end end ) addEventHandler("onClientGUIClick",root, function () if source == GUIEditor.button[1] then guiSetVisible(GUIEditor.window[1],false) showCursor(false) end end ) addEventHandler("onClientGUIClick", GUIEditor.button[1], function ( ) text1 = guiGetText ( GUIEditor.edit[1] ) --text2 = guiGetText ( valasz1 ) --text3 = guiGetText ( valasz2 ) if text1 ~= "" then triggerServerEvent( "server",localPlayer,text1 ) setTimer ( function( ) text1 = nil end,5000, 1 ) end end,false ) addEventHandler ( 'onClientRender',root, function ( ) dxDrawText(text1, (screenW * 0.2924) + 1, (screenH * 0.3778) + 1, (screenW * 0.7014) + 1, (screenH * 0.5400) + 1, tocolor(0, 0, 0, 255), 2.50, "default-bold", "left", "top", false, true, false, false, false) dxDrawText(text1, screenW * 0.2924, screenH * 0.3778, screenW * 0.7014, screenH * 0.5400, tocolor(0, 186, 255, 255), 2.50, "default-bold", "left", "top", false, true, false, false, false) end ) the dx text why not show on all players screen? o-O 1
Simple0x47 Posted October 21, 2016 Posted October 21, 2016 Are you sure that text1 has a value? Try to make an outputChatBox in the onClientRender for checking if it has any value.
Turbe$Z Posted October 21, 2016 Author Posted October 21, 2016 3 minutes ago, Simple01 said: Are you sure that text1 has a value? Try to make an outputChatBox in the onClientRender for checking if it has any value. This just client side this is server: function teszt(p) if hasObjectPermissionTo(p,"function.kickPlayer") then triggerClientEvent(p,"showguii",p) else outputChatBox("Ehhez neked nincs jogod") end end addCommandHandler("eventp",teszt) addEvent("server",true) addEventHandler("server",root, function (text1,text2,text3) outputChatBox("#FF0000~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~",root,0,255,0, true) outputChatBox("#DD3333[FELHÍVÁS] ~> #00baff"..text1.."",root,0,255,0, true) outputChatBox("#FF0000~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~",root,0,255,0, true) end ) 1
Simple0x47 Posted October 21, 2016 Posted October 21, 2016 I don't see any definition, but anyway. Replace the onClientRender with this for checking if text1 has any value on clientside. addEventHandler ( 'onClientRender',root, function ( ) outputChatBox( text1 or "TEXT1 HAS NO VALUE", 0, 255, 0 ) dxDrawText(text1, (screenW * 0.2924) + 1, (screenH * 0.3778) + 1, (screenW * 0.7014) + 1, (screenH * 0.5400) + 1, tocolor(0, 0, 0, 255), 2.50, "default-bold", "left", "top", false, true, false, false, false) dxDrawText(text1, screenW * 0.2924, screenH * 0.3778, screenW * 0.7014, screenH * 0.5400, tocolor(0, 186, 255, 255), 2.50, "default-bold", "left", "top", false, true, false, false, false) end ) If the chat outputs "TEXT1 HAS NO VALUE" then take a look at the content of the editbox.
Turbe$Z Posted October 21, 2016 Author Posted October 21, 2016 when i type a word in window, the outputchatbox is working /sorry, for my bad english/ 1
Simple0x47 Posted October 21, 2016 Posted October 21, 2016 Check the coordinates if they're correct. Cuz maybe it fits out of the screen or something.
Turbe$Z Posted October 21, 2016 Author Posted October 21, 2016 when i type a word, the text working on my screen, when other player write a word, the word doesn't working just on localplayer screen 1
Simple0x47 Posted October 21, 2016 Posted October 21, 2016 Ah, so you're trying to make the text from a player show to all of them? If it's like that then this will help you. CLIENT: addEvent("onServerSynced", true) function syncText( c ) if ( c ) and ( guiGetVisible( GUIEditor.edit[1] ) then triggerServerEvent("onSyncText", localPlayer, text1 ) end end addEventHandler("onClientCharacter", root, syncText ) function changeText( text ) if ( text1 ~= text ) then text1 = text end end addEventHandler("onServerSynced", root, changeText) SERVER: addEvent("onSyncText", true) function syncServer( text ) if ( text ) then local players = getElementsByType("player") for i = 1, players do local p = players[ i ] triggerClientEvent( p, "onServerSynced", p, text ) end end end addEventHandler("onSyncText", root, syncServer)
pa3ck Posted October 21, 2016 Posted October 21, 2016 Whats the loop for? triggerClientEvent( "onServerSynced", root, text ) --> same thing...
Simple0x47 Posted October 21, 2016 Posted October 21, 2016 (edited) The loop is for syncing the text for all the players into the server, and the onServerSynced event it's for making the change of the text in the clientside. Edited October 21, 2016 by Simple01
pa3ck Posted October 21, 2016 Posted October 21, 2016 I know, but you don't need the loop, if you don't specify the sendTo element it will be triggered to every player, MTA does the loop for you.
Turbe$Z Posted October 21, 2016 Author Posted October 21, 2016 10 minutes ago, Simple01 said: Ah, so you're trying to make the text from a player show to all of them? If it's like that then this will help you. CLIENT: addEvent("onServerSynced", true) function syncText( c ) if ( c ) and ( guiGetVisible( GUIEditor.edit[1] ) then triggerServerEvent("onSyncText", localPlayer, text1 ) end end addEventHandler("onClientCharacter", root, syncText ) function changeText( text ) if ( text1 ~= text ) then text1 = text end end addEventHandler("onServerSynced", root, changeText) SERVER: addEvent("onSyncText", true) function syncServer( text ) if ( text ) then local players = getElementsByType("player") for i = 1, players do local p = players[ i ] triggerClientEvent( p, "onServerSynced", p, text ) end end end addEventHandler("onSyncText", root, syncServer) client.lua:81: ')' expected near 'then' 1
Simple0x47 Posted October 21, 2016 Posted October 21, 2016 Ah sorry, I forgot to close that quote. addEvent("onServerSynced", true) function syncText( c ) if ( c ) and ( guiGetVisible( GUIEditor.edit[1] ) ) then triggerServerEvent("onSyncText", localPlayer, text1 ) end end addEventHandler("onClientCharacter", root, syncText ) function changeText( text ) if ( text1 ~= text ) then text1 = text end end addEventHandler("onServerSynced", root, changeText)
Turbe$Z Posted October 21, 2016 Author Posted October 21, 2016 2 minutes ago, Simple01 said: Ah sorry, I forgot to close that quote. addEvent("onServerSynced", true) function syncText( c ) if ( c ) and ( guiGetVisible( GUIEditor.edit[1] ) ) then triggerServerEvent("onSyncText", localPlayer, text1 ) end end addEventHandler("onClientCharacter", root, syncText ) function changeText( text ) if ( text1 ~= text ) then text1 = text end end addEventHandler("onServerSynced", root, changeText) Thanks man 1
Turbe$Z Posted October 22, 2016 Author Posted October 22, 2016 22 hours ago, Simple01 said: Does it work now? No! 2
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