Sasu Posted March 24, 2013 Share Posted March 24, 2013 Yo solo decia para que se de cuenta. Y en giveWeapon le ponga thePlayer. Link to comment
FraN-724 Posted March 24, 2013 Share Posted March 24, 2013 Yo solo lo puse así para que él vea los errores que tiene, ya que de los errores se aprende; y no siempre vamos a estar para ayudarlo, ya que él también tiene que poner de su parte y que aprenda solo. Link to comment
JesusAliso Posted March 24, 2013 Author Share Posted March 24, 2013 me explican lo del "triggerClientEvent" FranN, Se creo el marker "cuando entro al marker se cursor funciona pero la Window no aparece" Por que es esto? o hay que agregarle el triggerClientEvent Link to comment
EstrategiaGTA Posted March 24, 2013 Share Posted March 24, 2013 me explican lo del "triggerClientEvent"FranN, Se creo el marker "cuando entro al marker se cursor funciona pero la Window no aparece" Por que es esto? o hay que agregarle el triggerClientEvent Usa: triggerServerEvent en el client-side, porque no puedes juntar funciones client-side y server-side. Link to comment
Plate Posted March 24, 2013 Share Posted March 24, 2013 cylinder= createMarker ( 1294.6767578125, -1337.5, 17.860641479492, "cylinder", 1.5, 255, 0, 0, 255 ) function GUI(hitPlayer) triggerClientEvent(hitPlayer,"showGUI",getRootElement(),hitPlayer) end addEventHandler("onMarkerHit",cylinder,GUI) Link to comment
JesusAliso Posted March 24, 2013 Author Share Posted March 24, 2013 Tengo que agregar el "cylinder" en el Client? o no lo agrego a nada Link to comment
EstrategiaGTA Posted March 24, 2013 Share Posted March 24, 2013 Tengo que agregar el "cylinder" en el Client? o no lo agrego a nada Si te dio el código con: triggerClientEvent será en server-side, ¿no? Link to comment
JesusAliso Posted March 24, 2013 Author Share Posted March 24, 2013 Si si es que escribo antes de ver, ya lo agregue pero aun entro al marker y no se crea la "Window" Link to comment
EstrategiaGTA Posted March 24, 2013 Share Posted March 24, 2013 Prueba con esta: guiSetVisible Link to comment
FraN-724 Posted March 24, 2013 Share Posted March 24, 2013 Postea tu script como lo tienes ahora. Link to comment
JesusAliso Posted March 24, 2013 Author Share Posted March 24, 2013 Bueno, me confundí por que no sabia donde poner el guisetVisible ya que esta creada en la funcion mira. Server local Marker = createMarker ( 1294.6767578125, -1337.5, 17.860641479492, "cylinder", 1.5, 255, 0, 0, 255 ) function GUI(hitPlayer) triggerClientEvent(hitPlayer,"showGUI",getRootElement(),hitPlayer) end addEventHandler("onMarkerHit",cylinder,GUI) function showGUI (thePlayer) if (source == Marker) then triggerClientEvent (thePlayer,"showGUI",getRootElement(),thePlayer) end end addEventHandler ("onMarkerHit",getRootElement(),showGUI) function arm11 (thePlayer) local money = getPlayerMoney ( thePlayer ) if money >= 120000 then takePlayerMoney ( thePlayer, 120000 ) giveWeapon ( source, 31, 2880 ) end end addEvent( "arm1", true ) addEventHandler( "arm1", getRootElement(), arm11 ) function arm22 (thePlayer) local money = getPlayerMoney ( thePlayer ) if money >= 155000 then takePlayerMoney ( thePlayer, 155000 ) giveWeapon ( source, 34, 100 ) end end addEvent( "arm2", true ) addEventHandler( "arm2", getRootElement(), arm22 ) function arm33 (thePlayer) local money = getPlayerMoney ( thePlayer ) if money >= 20000 then takePlayerMoney ( thePlayer, 20000 ) giveWeapon ( source, 16, 1 ) end end addEvent( "arm3", true ) addEventHandler( "arm3", getRootElement(), arm33 ) function arm44 (thePlayer) local money = getPlayerMoney ( thePlayer ) if money >= 25000 then takePlayerMoney ( thePlayer, 25000 ) giveWeapon ( source, 29, 99 ) end end addEvent( "arm4", true ) addEventHandler( "arm4", getRootElement(), arm44 ) Client cylinder = createMarker ( 1294.6767578125, -1337.5, 17.860641479492, "cylinder", 1.5, 255, 0, 0, 255 ) function tienda() Window = guiCreateWindow(243,181,555,488,"Tienda de Armas/Weapon Shop",false) imagen4 = guiCreateStaticImage(0.0595,0.0902,0.2414,0.2172,"images/SNIPER.png",true,Window) imagen3 = guiCreateStaticImage(0.618,0.1004,0.2577,0.207,"images/M4.png",true,Window) imagen2 = guiCreateStaticImage(0.6505,0.5861,0.2306,0.2582,"images/MP5.png",true,Window) imagen1 = guiCreateStaticImage(0.0865,0.5922,0.2126,0.2275,"images/GRENADE.png",true,Window) Sniper = guiCreateButton(0.0631,0.3217,0.2324,0.1352,"Sniper/Costo:155000$",true,Window) M4 = guiCreateButton(0.6144,0.3217,0.2523,0.127,"M4/Costo:120000$",true,Window) Grenade = guiCreateButton(0.0649,0.8525,0.2559,0.1291,"Grenade/Costo:20000$x1",true,Window) MP5 = guiCreateButton(0.6432,0.8504,0.2685,0.1311,"MP5/Costo:25000$",true,Window) Cerrar = guiCreateButton(0.355,0.5082,0.2162,0.168,"Cerrar/Close",true,Window) showCursor ( true ) addEventHandler ( "onClientGUIClick", Cerrar, Salir, false ) addEventHandler ( "onClientGUIClick", M4, arma1, false ) addEventHandler ( "onClientGUIClick", Sniper, arma2, false ) addEventHandler ( "onClientGUIClick", Grenade, arma3, false ) addEventHandler ( "onClientGUIClick", MP5, arma4, false ) end function Salir() guiSetVisible (Window, not guiGetVisible ( Window ) ) showCursor ( false ) end function arma1() triggerServerEvent ( "arm1", getLocalPlayer() ) end function arma2() triggerServerEvent ( "arm2", getLocalPlayer() ) end function arma3() triggerServerEvent ( "arm3", getLocalPlayer() ) end function arma4() triggerServerEvent ( "arm4", getLocalPlayer() ) end function marker() triggerServerEvent ( "mark", getLocalPlayer() ) end function showGUI () guiSetVisible (Window,true) showCursor (true) end addEvent ("showGUI",true) addEventHandler ("showGUI",getRootElement(),showGUI) Bueno, hay me tira error en el server-side "Linea:7: donde esta el addEventHandler ("onMarkerHit" Link to comment
FraN-724 Posted March 24, 2013 Share Posted March 24, 2013 Prueba así. Server Side: local Marker = createMarker ( 1294.6767578125, -1337.5, 17.860641479492, "cylinder", 1.5, 255, 0, 0, 255 ) function GUI(hitPlayer) triggerClientEvent(hitPlayer,"showGUI",getRootElement(),hitPlayer) end addEventHandler("onMarkerHit",Marker,GUI) function arm11 (thePlayer) local money = getPlayerMoney ( thePlayer ) if money >= 120000 then takePlayerMoney ( thePlayer, 120000 ) giveWeapon ( source, 31, 2880 ) end end addEvent( "arm1", true ) addEventHandler( "arm1", getRootElement(), arm11 ) function arm22 (thePlayer) local money = getPlayerMoney ( thePlayer ) if money >= 155000 then takePlayerMoney ( thePlayer, 155000 ) giveWeapon ( source, 34, 100 ) end end addEvent( "arm2", true ) addEventHandler( "arm2", getRootElement(), arm22 ) function arm33 (thePlayer) local money = getPlayerMoney ( thePlayer ) if money >= 20000 then takePlayerMoney ( thePlayer, 20000 ) giveWeapon ( source, 16, 1 ) end end addEvent( "arm3", true ) addEventHandler( "arm3", getRootElement(), arm33 ) function arm44 (thePlayer) local money = getPlayerMoney ( thePlayer ) if money >= 25000 then takePlayerMoney ( thePlayer, 25000 ) giveWeapon ( source, 29, 99 ) end end addEvent( "arm4", true ) addEventHandler( "arm4", getRootElement(), arm44 ) Client Side: function tienda() Window = guiCreateWindow(243,181,555,488,"Tienda de Armas/Weapon Shop",false) imagen4 = guiCreateStaticImage(0.0595,0.0902,0.2414,0.2172,"images/SNIPER.png",true,Window) imagen3 = guiCreateStaticImage(0.618,0.1004,0.2577,0.207,"images/M4.png",true,Window) imagen2 = guiCreateStaticImage(0.6505,0.5861,0.2306,0.2582,"images/MP5.png",true,Window) imagen1 = guiCreateStaticImage(0.0865,0.5922,0.2126,0.2275,"images/GRENADE.png",true,Window) Sniper = guiCreateButton(0.0631,0.3217,0.2324,0.1352,"Sniper/Costo:155000$",true,Window) M4 = guiCreateButton(0.6144,0.3217,0.2523,0.127,"M4/Costo:120000$",true,Window) Grenade = guiCreateButton(0.0649,0.8525,0.2559,0.1291,"Grenade/Costo:20000$x1",true,Window) MP5 = guiCreateButton(0.6432,0.8504,0.2685,0.1311,"MP5/Costo:25000$",true,Window) Cerrar = guiCreateButton(0.355,0.5082,0.2162,0.168,"Cerrar/Close",true,Window) showCursor ( true ) addEventHandler ( "onClientGUIClick", Cerrar, Salir, false ) addEventHandler ( "onClientGUIClick", M4, arma1, false ) addEventHandler ( "onClientGUIClick", Sniper, arma2, false ) addEventHandler ( "onClientGUIClick", Grenade, arma3, false ) addEventHandler ( "onClientGUIClick", MP5, arma4, false ) end function Salir() guiSetVisible (Window, not guiGetVisible ( Window ) ) showCursor ( false ) end function arma1() triggerServerEvent ( "arm1", getLocalPlayer() ) end function arma2() triggerServerEvent ( "arm2", getLocalPlayer() ) end function arma3() triggerServerEvent ( "arm3", getLocalPlayer() ) end function arma4() triggerServerEvent ( "arm4", getLocalPlayer() ) end function marker() triggerServerEvent ( "mark", getLocalPlayer() ) end function showGUI () guiSetVisible (Window,true) showCursor (true) end addEvent ("showGUI",true) addEventHandler ("showGUI",getRootElement(),showGUI) Link to comment
JesusAliso Posted March 24, 2013 Author Share Posted March 24, 2013 Aun no se crea la Window pero el cursor si Link to comment
FraN-724 Posted March 24, 2013 Share Posted March 24, 2013 (edited) Prueba así ahora, ya que no lo estoy probando, si no que lo hago a la rápida. Client function tienda() Window = guiCreateWindow(243,181,555,488,"Tienda de Armas/Weapon Shop",false) imagen4 = guiCreateStaticImage(0.0595,0.0902,0.2414,0.2172,"images/SNIPER.png",true,Window) imagen3 = guiCreateStaticImage(0.618,0.1004,0.2577,0.207,"images/M4.png",true,Window) imagen2 = guiCreateStaticImage(0.6505,0.5861,0.2306,0.2582,"images/MP5.png",true,Window) imagen1 = guiCreateStaticImage(0.0865,0.5922,0.2126,0.2275,"images/GRENADE.png",true,Window) Sniper = guiCreateButton(0.0631,0.3217,0.2324,0.1352,"Sniper/Costo:155000$",true,Window) M4 = guiCreateButton(0.6144,0.3217,0.2523,0.127,"M4/Costo:120000$",true,Window) Grenade = guiCreateButton(0.0649,0.8525,0.2559,0.1291,"Grenade/Costo:20000$x1",true,Window) MP5 = guiCreateButton(0.6432,0.8504,0.2685,0.1311,"MP5/Costo:25000$",true,Window) Cerrar = guiCreateButton(0.355,0.5082,0.2162,0.168,"Cerrar/Close",true,Window) addEventHandler ( "onClientGUIClick", Cerrar, Salir, false ) addEventHandler ( "onClientGUIClick", M4, arma1, false ) addEventHandler ( "onClientGUIClick", Sniper, arma2, false ) addEventHandler ( "onClientGUIClick", Grenade, arma3, false ) addEventHandler ( "onClientGUIClick", MP5, arma4, false ) guiSetVisible (Window,false) end function arma1() triggerServerEvent ( "arm1", getLocalPlayer() ) end function arma2() triggerServerEvent ( "arm2", getLocalPlayer() ) end function arma3() triggerServerEvent ( "arm3", getLocalPlayer() ) end function arma4() triggerServerEvent ( "arm4", getLocalPlayer() ) end function marker() triggerServerEvent ( "mark", getLocalPlayer() ) end function showGUI () guiSetVisible (Window,true) showCursor (true) end addEvent ("showGUI",true) addEventHandler ("showGUI",getRootElement(),showGUI) Edited March 24, 2013 by Guest Link to comment
JesusAliso Posted March 24, 2013 Author Share Posted March 24, 2013 Sigue haciendo lo mismo. Por que no crea la Window? y si el cursor Link to comment
Plate Posted March 24, 2013 Share Posted March 24, 2013 Fijate asi function miGUI () guiSetVisible (Window,true) showCursor (true) end addEvent ("showGUI",true) addEventHandler ("showGUI",getRootElement(),miGUI) Link to comment
JesusAliso Posted March 24, 2013 Author Share Posted March 24, 2013 Igual sigue haciendo lo mismo no crea la Window pero si el cursor Link to comment
Sasu Posted March 24, 2013 Share Posted March 24, 2013 No estas creando la gui x ningun lado. Agrega esto en el client side: addEventHandler("onClientResourceStart", root, tienda) Link to comment
NodZen Posted March 24, 2013 Share Posted March 24, 2013 Si no te anda el Trigger, cambialo por este function MarkerHit( hitElement, matchingDimension ) local elementType = getElementType( hitElement ) triggerClientEvent(elementType,"showGUI",getRootElement(),elementType) end addEventHandler( "onMarkerHit", Marker, MarkerHit ) Link to comment
JesusAliso Posted March 24, 2013 Author Share Posted March 24, 2013 Ya lo agregue al principio y sigue igual ._. Link to comment
EstrategiaGTA Posted March 24, 2013 Share Posted March 24, 2013 ¿Que es lo que pasa, no se muestra el Marker, el GUI o que? Link to comment
NodZen Posted March 24, 2013 Share Posted March 24, 2013 (edited) Ya lo agregue al principio y sigue igual._. Probaste lo que te dijo Sasuke? Tambien guiSetVisible( window, false ) end addEventHandler("onClientResourceStart", getRootElement(), tu funcion) Edited March 24, 2013 by Guest Link to comment
Plate Posted March 24, 2013 Share Posted March 24, 2013 (edited) fijate si remplasas este code de la ventana el code de sasuke para que mi sirve e.e Window = guiCreateWindow(243,181,555,488,"Tienda de Armas/Weapon Shop",false) imagen4 = guiCreateStaticImage(0.0595,0.0902,0.2414,0.2172,"images/SNIPER.png",true,Window) imagen3 = guiCreateStaticImage(0.618,0.1004,0.2577,0.207,"images/M4.png",true,Window) imagen2 = guiCreateStaticImage(0.6505,0.5861,0.2306,0.2582,"images/MP5.png",true,Window) imagen1 = guiCreateStaticImage(0.0865,0.5922,0.2126,0.2275,"images/GRENADE.png",true,Window) Sniper = guiCreateButton(0.0631,0.3217,0.2324,0.1352,"Sniper/Costo:155000$",true,Window) M4 = guiCreateButton(0.6144,0.3217,0.2523,0.127,"M4/Costo:120000$",true,Window) Grenade = guiCreateButton(0.0649,0.8525,0.2559,0.1291,"Grenade/Costo:20000$x1",true,Window) MP5 = guiCreateButton(0.6432,0.8504,0.2685,0.1311,"MP5/Costo:25000$",true,Window) Cerrar = guiCreateButton(0.355,0.5082,0.2162,0.168,"Cerrar/Close",true,Window) addEventHandler ( "onClientGUIClick", Cerrar, Salir, false ) addEventHandler ( "onClientGUIClick", M4, arma1, false ) addEventHandler ( "onClientGUIClick", Sniper, arma2, false ) addEventHandler ( "onClientGUIClick", Grenade, arma3, false ) addEventHandler ( "onClientGUIClick", MP5, arma4, false ) guiSetVisible (Window,false) Edited March 24, 2013 by Guest Link to comment
JesusAliso Posted March 24, 2013 Author Share Posted March 24, 2013 Nod, lo cambie y nada Link to comment
Sasu Posted March 24, 2013 Share Posted March 24, 2013 Lo de addEventHandler lo debes agregar despues de la funcion. Link to comment
Recommended Posts