Madonz Posted February 7, 2012 Posted February 7, 2012 Hola a todos,son nuevo en el tema y estoy aprendiendo de a poco,en este caso tengo un problema que me gustaria que vieran: function okGUI(button,state) if button == "left" and state == "up" then if (source == ok) then local text = guiGetText ( memo ) outputChatBox ( text ) if (text == "stats") then outputChatBox("BLABLA",255,0,0); end end end end no funciona porque sera,lo que yo quiero es que cuando escribo una palabra especial en este caso "stats" salga el mensaje de chatbox.Cada vez que pongo stats sale la palabra stats que claro es la linea correspondiente a lo de arriba. espero que me puedan ayudar gracias Como uso debugscript 3?
Arsilex Posted February 7, 2012 Posted February 7, 2012 no se entiende nada eso es un boton o un comando...
Madonz Posted February 7, 2012 Author Posted February 7, 2012 Es que el boton ya esta creado,toda la ventana tambine,lo unico que quiero es para que la palabra que yo escriba tenga su funcion especial solo ose
Madonz Posted February 7, 2012 Author Posted February 7, 2012 Ok function GUI() window = guiCreateWindow(15,75,500,500,"Admin Adding Car",false) guiWindowSetMovable( Window, false ) guiWindowSetSizable( Window, false ) memo = guiCreateMemo(150,100,250,50,"",false,window) ok = guiCreateButton(100, 100, 50, 50,"OK",false,window) label = guiCreateLabel(13,35,500,100,"Cars:",false,window) guiLabelSetColor(label,255,255,255) guiLabelSetVerticalAlign(label,"top") guiLabelSetHorizontalAlign(label,"left",false) exit = guiCreateButton(171,19,19,19,"X",false,window) guiSetVisible(window,false) addEventHandler("onClientGUIClick",exit,exitGUI); addEventHandler("onClientGUIClick",ok,okcar); end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () GUI() end ) function openTeleportWindow() local PlayerName = getPlayerName(getLocalPlayer()) if PlayerName == "BLABLA" then guiSetVisible(window,true) showCursor(true,true) else return end end addCommandHandler("OpenGUI",openTeleportWindow) function exitGUI() if (source == exit) then guiSetVisible(window,false); showCursor(false); end end function okcar(button,state) if button == "left" and state == "up" then if (source == ok) then local text = guiGetText ( memo ) outputChatBox ( text ) if (text == "stats") then outputChatBox("BLABLA",255,0,0); end end end end
Castillo Posted February 7, 2012 Posted February 7, 2012 function GUI() window = guiCreateWindow(15,75,500,500,"Admin Adding Car",false) guiWindowSetMovable( Window, false ) guiWindowSetSizable( Window, false ) memo = guiCreateMemo(150,100,250,50,"",false,window) ok = guiCreateButton(100, 100, 50, 50,"OK",false,window) label = guiCreateLabel(13,35,500,100,"Cars:",false,window) guiLabelSetColor(label,255,255,255) guiLabelSetVerticalAlign(label,"top") guiLabelSetHorizontalAlign(label,"left",false) exit = guiCreateButton(171,19,19,19,"X",false,window) guiSetVisible(window,false) addEventHandler("onClientGUIClick",exit,exitGUI,false); addEventHandler("onClientGUIClick",ok,okcar,false); end addEventHandler("onClientResourceStart",resourceRoot,GUI) function openTeleportWindow() local PlayerName = getPlayerName(getLocalPlayer()) if PlayerName == "BLABLA" then guiSetVisible(window,true) showCursor(true,true) end end addCommandHandler("OpenGUI",openTeleportWindow) function exitGUI() if (source == exit) then guiSetVisible(window,false); showCursor(false); end end function okcar(button,state) if (button == "left" and state == "up") then local text = guiGetText ( memo ) outputChatBox ( text ) if (string.lower(text) == "stats") then outputChatBox("BLABLA",255,0,0) end end end
Madonz Posted February 7, 2012 Author Posted February 7, 2012 Si,pero sigue sin aparecer el outputChatBox("BLABLA",255,0,0) no encuentro el problema,si escribo stats aparece el chatbox stats porque es la linea de arriba pero mi BLABLA no aparece
Castillo Posted February 7, 2012 Posted February 7, 2012 Cambie el "memo" a un "edit" y ahora funciona: function GUI() window = guiCreateWindow(15,75,500,500,"Admin Adding Car",false) guiWindowSetMovable( window, false ) guiWindowSetSizable( window, false ) memo = guiCreateEdit(150,100,250,50,"",false,window) ok = guiCreateButton(100, 100, 50, 50,"OK",false,window) label = guiCreateLabel(13,35,500,100,"Cars:",false,window) guiLabelSetColor(label,255,255,255) guiLabelSetVerticalAlign(label,"top") guiLabelSetHorizontalAlign(label,"left",false) exit = guiCreateButton(171,19,19,19,"X",false,window) guiSetVisible(window,false) addEventHandler("onClientGUIClick",exit,exitGUI,false); addEventHandler("onClientGUIClick",ok,okcar,false); end addEventHandler("onClientResourceStart",resourceRoot,GUI) function openTeleportWindow() local PlayerName = getPlayerName(getLocalPlayer()) if PlayerName == "BLABLA" then guiSetVisible(window,true) showCursor(true,true) end end addCommandHandler("OpenGUI",openTeleportWindow) function exitGUI() if (source == exit) then guiSetVisible(window,false) showCursor(false) end end function okcar(button,state) if (button == "left" and state == "up") then local text = tostring(guiGetText ( memo )) outputChatBox ( text ) if (text == "stats") then outputChatBox("BLABLA",255,0,0) end end end
Recommended Posts