NodZen Posted March 24, 2013 Posted March 24, 2013 Nod, lo cambie y nada Postealo tal cual lo tienes ahora. Lo pruevo en mi Server.
JesusAliso Posted March 24, 2013 Author Posted March 24, 2013 Cuando entro al Marker, se crea el Cursor pero la "Window con los buttons y eso no se crea"
Plate Posted March 24, 2013 Posted March 24, 2013 Postea el código. lo posteo como 20 veces :facepalm:
EstrategiaGTA Posted March 24, 2013 Posted March 24, 2013 Postea el código. lo posteo como 20 veces :facepalm: Me refiero al que tiene ahora, Plate.
JesusAliso Posted March 24, 2013 Author Posted March 24, 2013 Client addEventHandler("onClientResourceStart", root, tienda) 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 miGUI () guiSetVisible (Window,true) showCursor (true) end addEvent ("showGUI",true) addEventHandler ("showGUI",getRootElement(),miGUI) Server local Marker = createMarker ( 1294.6767578125, -1337.5, 17.860641479492, "cylinder", 1.5, 255, 0, 0, 255 ) 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) 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 )
Plate Posted March 24, 2013 Posted March 24, 2013 (edited) 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 addEventHandler("onClientResourceStart", root, tienda) 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) Edited March 24, 2013 by Guest
EstrategiaGTA Posted March 24, 2013 Posted March 24, 2013 Server local Marker = createMarker ( 1294.6767578125, -1337.5, 17.860641479492, "cylinder", 1.5, 255, 0, 0, 255 ) 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) 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 ) ¿Porqué tienes 2 markers? Con los mismos x, y, z.
Sasu Posted March 24, 2013 Posted March 24, 2013 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 addEventHandler("onClientResourceStart", root, tienda) Te dije q lo pongas abajo.
JesusAliso Posted March 24, 2013 Author Posted March 24, 2013 Bueno, estoy medio loco ya se creo la window por que tenia 2 marker. bueno pero haora cunado le doy click a cada uno me tira error en todos los getPlayerMoney y la linea que le sigue a cada uno que es ""if money >= 25000 then"" me dice "attemp to compare number with boolean""
Plate Posted March 24, 2013 Posted March 24, 2013 Mira te presto un codigo que Alex_Steel(GROSO!) me presto function havePlayerTheMoney( player, money) return getPlayerMoney( player ) > money end y pones if(havePlayerTheMoney, 12000) then proba con eso
NodZen Posted March 24, 2013 Posted March 24, 2013 Ejemplo mark = createMarker ( 100, 1000.85446, 10.488, etc , etc ) --Primero creas la marker, en este caso en Client. function win () img = guiCreateStaticImage ( 100, 100, 400, 400, "Hola", false)-- Creas la window guiSetVisible( img, false)-- Pones para que la window sea invisible cuando se active el resource end addEventHandler("onClientResourceStart", resourceRoot, win) function () guiSetVisible( img, true ) playSound("Scripts/Type_client/Sounds/beep.mp3", false)-- Este es de mi script no cuenta end addEventHandler("onMarkerHit", mark, )-- El evento onMarkerHit , porque se verá cuando entra en la marker
EstrategiaGTA Posted March 24, 2013 Posted March 24, 2013 local Marker = createMarker ( 1294.6767578125, -1337.5, 17.860641479492, "cylinder", 1.5, 255, 0, 0, 255 ) 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) function arm11 (thePlayer) local money = getPlayerMoney ( thePlayer ) if money >= 120000 then takePlayerMoney ( thePlayer, 120000 ) giveWeapon ( thePlayer, 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 ( thePlayer, 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 ( thePlayer, 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 ( thePlayer, 29, 99 ) end end addEvent( "arm4", true ) addEventHandler( "arm4", getRootElement(), arm44 ) Prueba esto. ¿Funcionó?
JesusAliso Posted March 24, 2013 Author Posted March 24, 2013 Aun no entiend por que esta mal lo del take player money?
Sasu Posted March 24, 2013 Posted March 24, 2013 JesusAliso cuando vaya a mi casa , lo hago, lo testeo y te lo paso.
JesusAliso Posted March 24, 2013 Author Posted March 24, 2013 Bueno pero me dices como va en el error que meda.
Sasu Posted March 24, 2013 Posted March 24, 2013 Resulta que al final le faltaba crear la funcion "Salir" y estaba pasando mal los argumentos en triggerServerEvent. Solucionado!
JesusAliso Posted March 25, 2013 Author Posted March 25, 2013 Bueno, se que puedo hacer mas que esto le doy las gracias a todos ustedes que siempre me estarán ayudando.
NodZen Posted March 25, 2013 Posted March 25, 2013 Bueno, se que puedo hacer mas que esto le doy las gracias a todos ustedes que siempre me estarán ayudando. De nada bro, estamos para eso.
AlvareZ_ Posted March 25, 2013 Posted March 25, 2013 De nada. No te pude seguir ayudando por que estube ausente unos dias.
Recommended Posts