SimmerMemer Posted February 28, 2014 Share Posted February 28, 2014 Hola, estoy haciendo un Job de Transporte de Droga Y me quedé trabado en una parte: client: addEventHandler("onClientResourceStart", resourceRoot, function() ventanaJob = guiCreateWindow(605, 103, 383, 382, "Trabajito...", false) guiWindowSetSizable(ventanaJob, false) memo = guiCreateMemo(35, 38, 248, 75, "Hey! ¿Me harías un trabajito? Es sólo hasta Bayside, un garage..\n\nSi aceptas, podrías ganar $20 grandes.", false, ventanaJob) guiMemoSetReadOnly(memo, true) botonSi = guiCreateButton(10, 314, 90, 38, "Supongo que puedo", false, ventanaJob) botonNo = guiCreateButton(283, 314, 90, 38, "No, gracias", false, ventanaJob) addEventHandler("onClientGUIClick", guiRoot, aceptar) guiSetVisible(ventanaJob, false) showCursor(false) end ) function aceptar (button,state) if (button == "left") then if(source == botonSi) then triggerServerEvent("onClientAccept", localPlayer, "aceptar") elseif(source == botonNo) then triggerServerEvent("onClientAccept", localPlayer, "cerrar") end end end addEvent("CerrarJob",true) addEventHandler("CerrarJob",root, function() guiSetVisible(ventanaJob,not guiGetVisible(ventanaJob)) showCursor(not isCursorShowing()) end) server: function jobAccept () car = createVehicle (440, -1295.2314453125, 2507.701171875, 87.013702392578) warpPedIntoVehicle(source, car) markerLS = createMarker (-2258.43359375, 2385.3662109375, 4.9885883331299, "cylinder", 2, 255, 0, 0, 255) blipLS = createBlipAttachedTo (markerLS, 40) end addEvent ("onClientAccept", true) addEventHandler ("onClientAccept", root, jobAccept) function moneyLS (attacker) if (attacker) and (attacker ~= source) then givePlayerMoney(attacker, 20000) destroyElement(markerLS) destroyElement(blipLS) destroyElement(car) end end addEventHandler( "onMarkerHit", root, moneyLS ) Saludos. Link to comment
Castillo Posted February 28, 2014 Share Posted February 28, 2014 En que parte exactamente? no explicaste nada... Link to comment
SimmerMemer Posted February 28, 2014 Author Share Posted February 28, 2014 Yo me trabé en el final, no aparece el marker que abre la GUI, ni el que "termina" el Job. Link to comment
Castillo Posted February 28, 2014 Share Posted February 28, 2014 En ninguna parte estas abriendo la GUI. Link to comment
SimmerMemer Posted February 28, 2014 Author Share Posted February 28, 2014 server: function jobAccept () car = createVehicle (440, -1295.2314453125, 2507.701171875, 87.013702392578) warpPedIntoVehicle(source, car) markerLS = createMarker (-2258.43359375, 2385.3662109375, 4.9885883331299, "cylinder", 2, 255, 0, 0, 255) blipLS = createBlipAttachedTo (markerLS, 40) end addEvent ("onClientAccept", true) addEventHandler ("onClientAccept", root, jobAccept) function moneyLS (attacker) if (attacker) and (attacker ~= source) then givePlayerMoney(attacker, 20000) destroyElement(markerLS) destroyElement(blipLS) destroyElement(car) end end local marker = createMarker ( -1295.763671875, 2509.4091796875, 87.022048950195, "cylinder", 1.0, 255, 0, 0, 255) addEventHandler("onMarkerHit", marker, function(E) if(E) and getElementType(E) == "player" then triggerClientEvent(E,"CerrarJob",E) end end) client: addEventHandler("onClientResourceStart", resourceRoot, function() ventanaJob = guiCreateWindow(605, 103, 383, 382, "Trabajito...", false) guiWindowSetSizable(ventanaJob, false) memo = guiCreateMemo(35, 38, 248, 75, "Hey! ¿Me harías un trabajito? Es sólo hasta Bayside, un garage..\n\nSi aceptas, podrías ganar $20 grandes.", false, ventanaJob) guiMemoSetReadOnly(memo, true) botonSi = guiCreateButton(10, 314, 90, 38, "Supongo que puedo", false, ventanaJob) botonNo = guiCreateButton(283, 314, 90, 38, "No, gracias", false, ventanaJob) addEventHandler("onClientGUIClick", guiRoot, aceptar) guiSetVisible(ventanaJob, false) showCursor(false) end ) function aceptar (button,state) if (button == "left") then if(source == botonSi) then triggerServerEvent("onClientAccept", localPlayer, "botonSi") elseif(source == botonNo) then triggerServerEvent("onClientAccept", localPlayer, "bontonNo") end end end addEvent("CerrarJob",true) addEventHandler("CerrarJob",root, function() guiSetVisible(ventanaJob,not guiGetVisible(ventanaJob)) showCursor(not isCursorShowing()) end) Conseguí abrir la GUI pero ahora, al negarme a trabajar me aparece el camión de todas formas. Link to comment
Castillo Posted February 28, 2014 Share Posted February 28, 2014 Eso es porque estas enviando el evento de empezar el trabajo, simplemente oculta el GUI y el cursor. Link to comment
SimmerMemer Posted February 28, 2014 Author Share Posted February 28, 2014 Ya lo resolví, muchas gracias Link to comment
Recommended Posts