ghost050 Posted February 10, 2012 Share Posted February 10, 2012 Server-side marcadorM1T = createMarker(44,1525.1999511719,12.800000190735,"cylinder",2,46,208,14,255) addEventHandler("onMarkerHit",marcadorM1T, function (hitPlayer) if getElementType(hitPlayer) == "player" then if getPlayerTeam(hitPlayer) == grupoTerrorista then triggerClientEvent(hitPlayer,"mostrarMisionTT",getRootElement()) end end end ) Client-Side mision = guiCreateWindow(266,136,294,325,"",false) guiWindowSetMovable(mision,false) guiWindowSetSizable(mision,false) memo = guiCreateMemo(9,121,275,150,"TEXTO DE MISION",false,mision) guiMemoSetReadOnly(memo,true) misionlabel = guiCreateLabel(99,35,99,32,"Misión 1",false,mision) guiSetFont(misionlabel,"sa-header") informe = guiCreateLabel(11,97,104,17,"Informe de misión",false,mision) guiSetFont(informe,"default-bold-small") botonabrir = guiCreateButton(46,282,204,22,">",false,mision) guiSetVisible(mision,false) choise = guiCreateWindow(561,367,156,94,"",false) aceptarM1 = guiCreateButton(10,25,137,28,"Aceptar misión",false,choise) rechazarM1 = guiCreateButton(10,54,137,28,"Rechazar misión",false,choise) guiSetVisible(choise,false) addEventHandler("onClientGUIClick",root, function (button) if button == botonabrir then if not guiGetVisible(choise) == true then guiSetVisible(choise,true) end elseif button == rechazarM1 then guiSetVisible(mision,false) guiSetVisible(choise,false) showCursor(false) end end ) function mostrarMision() guiSetVisible (mision,true) showCursor(true) end addEvent("mostrarMisionTT",true) addEventHandler("mostrarMisionTT",getRootElement(),mostrarMision) PD: El error es que cuando un player entra en el marcador el gui no se muestra Link to comment
Elcker Posted February 10, 2012 Share Posted February 10, 2012 (edited) Comenzemos: Me tome la libertad de acomodar algunos elementos para controlar a mi punto de vista mejor las funciones... y te agregue algunas cosas... ------------------------Client-side --------------------------- mision = guiCreateWindow(266,136,294,325,"",false) guiWindowSetMovable(mision,false) guiWindowSetSizable(mision,false) memo = guiCreateMemo(9,121,275,150,"TEXTO DE MISION",false,mision) guiMemoSetReadOnly(memo,true) misionlabel = guiCreateLabel(99,35,99,32,"Misión 1",false,mision) guiSetFont(misionlabel,"sa-header") informe = guiCreateLabel(11,97,104,17,"Informe de misión",false,mision) guiSetFont(informe,"default-bold-small") botonabrir = guiCreateButton(46,282,204,22,">",false,mision) guiSetVisible(mision,false) choise = guiCreateWindow(561,367,156,94,"",false) aceptarM1 = guiCreateButton(10,25,137,28,"Aceptar misión",false,choise) rechazarM1 = guiCreateButton(10,54,137,28,"Rechazar misión",false,choise) guiSetVisible(choise,false) function open() guiSetVisible(choise,true) showCursor(true) if button == rechazarM1 then guiSetVisible(mision,false) guiSetVisible(choise,false) showCursor(false) outputChatBox("Mision Rechazada",playeer,255,0,0) end end addEventHandler("onClientGUIClick", botonabrir, open) function mostrarMision() guiSetVisible (mision,true) showCursor(true) end addEvent("mostrarMisionTT",true) addEventHandler("mostrarMisionTT",getRootElement(),mostrarMision) ----------------------------Ahora el Server-side----------------- marcadorM1T = createMarker(44,1525.1999511719,12.800000190735,"cylinder",2,46,208,14,255) function hit(hitPlayer) if getElementType(hitPlayer) == "player" then if getPlayerTeam(hitPlayer) == grupoTerrorista then triggerClientEvent(hitPlayer,"mostrarMisionTT",getRootElement()) end end end addEventHandler("onMarkerHit",marcadorM1T,hit) addEvent("mostrarMisionTT",true) addEventHandler("mostrarMisionTT", getRootElement(), hit) Edited February 10, 2012 by Guest Link to comment
ghost050 Posted February 10, 2012 Author Share Posted February 10, 2012 El outputChatBox que agregaste en Client-Side está mal Link to comment
Castillo Posted February 10, 2012 Share Posted February 10, 2012 -- client side: mision = guiCreateWindow(266,136,294,325,"",false) guiWindowSetMovable(mision,false) guiWindowSetSizable(mision,false) memo = guiCreateMemo(9,121,275,150,"TEXTO DE MISION",false,mision) guiMemoSetReadOnly(memo,true) misionlabel = guiCreateLabel(99,35,99,32,"Misión 1",false,mision) guiSetFont(misionlabel,"sa-header") informe = guiCreateLabel(11,97,104,17,"Informe de misión",false,mision) guiSetFont(informe,"default-bold-small") botonabrir = guiCreateButton(46,282,204,22,">",false,mision) guiSetVisible(mision,false) choice = guiCreateWindow(561,367,156,94,"",false) aceptarM1 = guiCreateButton(10,25,137,28,"Aceptar misión",false,choice) rechazarM1 = guiCreateButton(10,54,137,28,"Rechazar misión",false,choice) guiSetVisible(choice,false) addEventHandler("onClientGUIClick",root, function () if (source == botonabrir) then if not guiGetVisible(choice) then guiSetVisible(choice,true) end elseif (source == rechazarM1) then guiSetVisible(mision,false) guiSetVisible(choice,false) showCursor(false) end end ) function mostrarMision() guiSetVisible (mision,true) showCursor(true) end addEvent("mostrarMisionTT",true) addEventHandler("mostrarMisionTT",getRootElement(),mostrarMision) -- server side: marcadorM1T = createMarker(44,1525.1999511719,12.800000190735,"cylinder",2,46,208,14,255) addEventHandler("onMarkerHit",marcadorM1T, function (hitPlayer) if getElementType(hitPlayer) == "player" then if (getPlayerTeam(hitPlayer) == grupoTerrorista) then triggerClientEvent(hitPlayer,"mostrarMisionTT",hitPlayer) end end end ) P.D: La variable "grupoTerrorista" esta en este script, verdad? Link to comment
ghost050 Posted February 10, 2012 Author Share Posted February 10, 2012 No en este script pero es una variable global. Link to comment
Castillo Posted February 10, 2012 Share Posted February 10, 2012 Pero esta en el mismo recurso, verdad? Link to comment
ghost050 Posted February 10, 2012 Author Share Posted February 10, 2012 Ahora si, . gracias Link to comment
Recommended Posts