Sticmy Posted May 20, 2015 Posted May 20, 2015 hola amigos estuve haciendo un panel de compra y quería hacer que para comprar necesita tener 1500$ de vida hice la función todo pero da error Código: function ComproVida50 (thePlayer) local dinero = getPlayerMoney(thePlayer) -- get the amount of money from the player who entered the command if (dinero > 1500) then outputChatBox("No tienes suficiente dinero para comprar 50% de vida.", thePlayer, 0, 255, 0) else takePlayerMoney(thePlayer, 1500) outputChatBox("Has comprado 50% de vida.", thePlayer, 255, 0, 0) end end addEvent( "onGreeting", true ) addEventHandler( "onGreeting", resourceRoot, ComproVida50 ) Me ayudaría a resolver eso y el error acá dejo una foto: http://i.imgur.com/8qE1bAM.png My name in the game is: Sticmy My discord: Sticmy#3817 My discord community: https://discord.gg/366Y9bB
MTA Team 0xCiBeR Posted May 20, 2015 MTA Team Posted May 20, 2015 Como ejecutas el evento "onGreeting" ? DevOps Engineer, Cloud Advocate & Security Engineer(Red Team) | Coffee, Containers & Burp
Sticmy Posted May 20, 2015 Author Posted May 20, 2015 Ah? no te entiendo Con el triggerServerEvent My name in the game is: Sticmy My discord: Sticmy#3817 My discord community: https://discord.gg/366Y9bB
MTA Team 0xCiBeR Posted May 20, 2015 MTA Team Posted May 20, 2015 Si, pero postea esa parte del código ya que el error viene desde el trigger. Sino usa esto: function ComproVida50 () local dinero = getPlayerMoney(client) -- get the amount of money from the player who entered the command if (dinero > 1500) then outputChatBox("No tienes suficiente dinero para comprar 50% de vida.", client, 0, 255, 0) else takePlayerMoney(client, 1500) outputChatBox("Has comprado 50% de vida.", client, 255, 0, 0) end end addEvent( "onGreeting", true ) addEventHandler( "onGreeting", root, ComproVida50 ) DevOps Engineer, Cloud Advocate & Security Engineer(Red Team) | Coffee, Containers & Burp
Sticmy Posted May 20, 2015 Author Posted May 20, 2015 Aver My name in the game is: Sticmy My discord: Sticmy#3817 My discord community: https://discord.gg/366Y9bB
Sticmy Posted May 20, 2015 Author Posted May 20, 2015 Funciono pero el problema es que no sale el texto de que no tiene suficiente dinero. My name in the game is: Sticmy My discord: Sticmy#3817 My discord community: https://discord.gg/366Y9bB
MTA Team 0xCiBeR Posted May 20, 2015 MTA Team Posted May 20, 2015 Postea tu función de trigger. DevOps Engineer, Cloud Advocate & Security Engineer(Red Team) | Coffee, Containers & Burp
Sticmy Posted May 20, 2015 Author Posted May 20, 2015 function ComprasxD() if ( source == comprar ) then local row = guiGridListGetSelectedItem( lista_de_compras ) local nombre = guiGridListGetItemText( lista_de_compras, row, listas_compras) if nombre == "Vida 50%" then guiSetText(label_variable, "Tendrás que esperar 15 segundos para seguir comprando vida de 50%!.") triggerServerEvent ( "onGreeting", resourceRoot ) end if nombre == "Vida 100%" then guiSetText(label_variable, "Tendrás que esperar 15 segundos para seguir comprando vida de 100%!.") end if nombre == "Chaleco 50%" then guiSetText(label_variable, "Tendrás que esperar 15 segundos para seguir comprando chaleco de 50%!.") end if nombre == "Chaleco 100%" then guiSetText(label_variable, "Tendrás que esperar 15 segundos para seguir comprando chaleco de 100%!.") end end end addEventHandler("onClientGUIClick", root, ComprasxD) My name in the game is: Sticmy My discord: Sticmy#3817 My discord community: https://discord.gg/366Y9bB
MTA Team 0xCiBeR Posted May 20, 2015 MTA Team Posted May 20, 2015 Client: function ComprasxD() if ( source == comprar ) then local row = guiGridListGetSelectedItem( lista_de_compras ) local nombre = guiGridListGetItemText( lista_de_compras, row, listas_compras) if nombre == "Vida 50%" then guiSetText(label_variable, "Tendrás que esperar 15 segundos para seguir comprando vida de 50%!.") triggerServerEvent ( "onGreeting", getLocalPlayer() ) end if nombre == "Vida 100%" then guiSetText(label_variable, "Tendrás que esperar 15 segundos para seguir comprando vida de 100%!.") end if nombre == "Chaleco 50%" then guiSetText(label_variable, "Tendrás que esperar 15 segundos para seguir comprando chaleco de 50%!.") end if nombre == "Chaleco 100%" then guiSetText(label_variable, "Tendrás que esperar 15 segundos para seguir comprando chaleco de 100%!.") end end end addEventHandler("onClientGUIClick", root, ComprasxD) Server: function ComproVida50 () local dinero = getPlayerMoney(client) -- get the amount of money from the player who entered the command if (dinero > 1500) then outputChatBox("No tienes suficiente dinero para comprar 50% de vida.", source, 0, 255, 0) else takePlayerMoney(client, 1500) outputChatBox("Has comprado 50% de vida.", source, 255, 0, 0) end end addEvent( "onGreeting", true ) addEventHandler( "onGreeting", root, ComproVida50 ) DevOps Engineer, Cloud Advocate & Security Engineer(Red Team) | Coffee, Containers & Burp
Sticmy Posted May 20, 2015 Author Posted May 20, 2015 Ya funciono gracias! My name in the game is: Sticmy My discord: Sticmy#3817 My discord community: https://discord.gg/366Y9bB
MTA Team 0xCiBeR Posted May 20, 2015 MTA Team Posted May 20, 2015 De nada. DevOps Engineer, Cloud Advocate & Security Engineer(Red Team) | Coffee, Containers & Burp
Recommended Posts