Jump to content

aka Blue

Members
  • Posts

    2,106
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by aka Blue

  1. Osea, ¿modifico el trigger o pongo local node = node? Lo segundo es estúpido :v
  2. Revivo por una cosa (soy un pesao, lo sé :c). Bueno, pues tengo triggeada la función de ponerle el upgrade al vehículo pero no entiendo por qué no va --Cliente triggerServerEvent("onPoner", getLocalPlayer(), node[2]) --Servidor function poner(thePlayer, node) local node = node[2] local vehicle = getPedOccupiedVehicle(thePlayer) if vehicle then if exports.players:takeMoney(thePlayer, 1000) then addVehicleUpgrade(vehicle, node) exports.chat:me(thePlayer, "comienza a instalar la mejora en el vehículo") setTimer(function() outputChatBox("Instalando la mejora...", thePlayer, 0, 255, 120) end, 5000, 1) setTimer(function() outputChatBox("Mejora instalada satisfactoriamente", thePlayer, 0, 255, 120) end, 7000, 1) else outputChatBox("No te puedes permitir la instalación de éste tuneo", thePlayer, 255, 0, 0) end else outputChatBox("No estás en un vehículo", thePlayer, 255, 0, 0) end end addEvent("onPoner", true) addEventHandler("onPoner", getRootElement(), poner)
  3. Faltaba un "end" pero siguen sin salir ahora. local delanteros = { --Nombre, id, precio, vehiculo {"Slamin", 1188, 200, "Savanna"}, {"Chrome", 1189, 200, "Savanna"}, {"Slamin", 1190, 200, "Tornado"}, {"Chrome", 1191, 200, "Tornado"}, {"Slamin", 1185, 200, "Remington"}, {"Chrome", 1179, 200, "Remington"}, {"Slamin", 1181, 200, "Blade"}, {"Chrome", 1182, 200, "Blade"}, {"Chrome", 1176, 200, "Broadway"}, {"Chrome", 1174, 200, "Broadway"}, {"Alien", 1169, 200, "Sultan"}, {"X-Flow", 1170, 200, "Sultan"}, {"Alien", 1171, 200, "Elegy"}, {"X-Flow", 1172, 200, "Elegy"}, {"Alien", 1160, 200, "Jester"}, {"X-Flow", 1173, 200, "Jester"}, {"Alien", 1166, 200, "Uranus"}, {"X-Flow", 1165, 200, "Uranus"}, {"Alien", 1155, 200, "Stratum"}, {"X-Flow", 1157, 200, "Stratum"}, {"Alien", 1153, 200, "Flash"}, {"X-Flow", 1152, 200, "Flash"}, } windows.meca1 = { { type = "label", text = "Paragolpes", font = "bankgothic", alignX = "center", }, { type = "pane", panes = {} }, { type = "button", text = "Cerrar", alignX = "center", onClick = function() hide() showCursor(false) destroyElement() end, } } addEventHandler("onClientVehicleEnter", getRootElement(), function() if getVehicleName(source) == node[4] then windows.meca1[2].panes = {} for index, node in ipairs ( delanteros ) do table.insert( windows.meca1[2].panes, { image = ":players/images/skins/-1.png", title = "Parachoques "..node[1], text = "Cuesta "..node[3].."\nUn bonito parachoques para tu coche a un precio económico.", onHover = function( cursor, pos ) dxDrawRectangle( pos[1], pos[2], pos[3] - pos[1], pos[4] - pos[2], tocolor( unpack( { 0, 255, 120, 31 } ) ) ) end, onClick = function( key ) if key == 1 then hide() showCursor(false) end end, wordBreak = true, } ) end end end )
  4. Ahora solo aparece 1 de las mejoras del vehículo. ¿Se puede arreglar?
  5. Ahora sí. El problema es que se van acumulando cuando te subes a un coche. Osea, yo me subo a un Savanna y me pone Slammin y Chrome, luego, cuando me subo a un Sultan, me sale, Slammin y Chrome + Alien y X-Flow. Dependiendo de las veces que te subas me va agregando más y más... PD: Ahora subo una SS para que se vea. local delanteros = { --Nombre, id, precio, vehiculo {"Slamin", 1188, 200, "Savanna"}, {"Chrome", 1189, 200, "Savanna"}, {"Slamin", 1190, 200, "Tornado"}, {"Chrome", 1191, 200, "Tornado"}, {"Slamin", 1185, 200, "Remington"}, {"Chrome", 1179, 200, "Remington"}, {"Slamin", 1181, 200, "Blade"}, {"Chrome", 1182, 200, "Blade"}, {"Chrome", 1176, 200, "Broadway"}, {"Chrome", 1174, 200, "Broadway"}, {"Alien", 1169, 200, "Sultan"}, {"X-Flow", 1170, 200, "Sultan"}, {"Alien", 1171, 200, "Elegy"}, {"X-Flow", 1172, 200, "Elegy"}, {"Alien", 1160, 200, "Jester"}, {"X-Flow", 1173, 200, "Jester"}, {"Alien", 1166, 200, "Uranus"}, {"X-Flow", 1165, 200, "Uranus"}, {"Alien", 1155, 200, "Stratum"}, {"X-Flow", 1157, 200, "Stratum"}, {"Alien", 1153, 200, "Flash"}, {"X-Flow", 1152, 200, "Flash"}, } windows.meca1 = { { type = "label", text = "Paragolpes", font = "bankgothic", alignX = "center", }, { type = "pane", panes = {} }, { type = "button", text = "Cerrar", alignX = "center", onClick = function() hide() showCursor(false) destroyElement() end, } } addEventHandler("onClientVehicleEnter", getRootElement(), function() for index, node in ipairs ( delanteros ) do if getVehicleName(source) == node[4] then table.insert( windows.meca1[2].panes, { image = ":players/images/skins/-1.png", title = "Parachoques "..node[1], text = "Cuesta "..node[3].."\nUn bonito parachoques para tu coche a un precio económico.", onHover = function( cursor, pos ) dxDrawRectangle( pos[1], pos[2], pos[3] - pos[1], pos[4] - pos[2], tocolor( unpack( { 0, 255, 120, 31 } ) ) ) end, onClick = function( key ) if key == 1 then hide() showCursor(false) end end, wordBreak = true, } ) end end end )
  6. Prueba haciendo un doble loop. Supongo que al poner la misma variable de la gridList te lo meterá directamente. Te daré el código directamente, solo cambia las ID's y ya. normales = { {415, 10000}, {550, 100000} } deportivos = { {555, 1000000}, {411, 450000} } for i,v in ipairs (deportivos) do local carName = getVehicleNameFromModel (v[1]) local row = guiGridListAddRow (carGridList) guiGridListSetItemText (carGridList, row, 1, "Deportivos", false, true) guiGridListSetItemText (carGridList, row, 2, carName, false, true) guiGridListSetItemText (carGridList, row, 3, tostring(v[2]), false, true) end for i, v in ipairs(normales) do local carName2 = getVehicleNameFromModel (v[1]) local row = guiGridListAddRow(carGridList) guiGridListSetItemText(carGridList, row, 4, "Normales", false, true) guiGridListSetItemText(carGridList, row, 5, carName2, false, true) guiGridListSetItemText(carGridList, row, 6, tostring(v[2]), false, true) end Puedes hacer espacios añadiendo un row demás también. PD2: Lo hice muy a ojo y no lo he testeado.
  7. Ahí solo se ve el cars pero no se ven ningunas categorías. Para poner más categorías podrías loopear dos veces o en el mismo loop, insertar un item text que sea una línea o que ponga "deportivos" y de ahí hacia abajo que sean todos otro tipo de vehículos de otra tabla. Me explico, tú tienes ésto. local cars = { {555, 1000000}, {411, 450000} } for i,v in ipairs (cars) do local carName = getVehicleNameFromModel (v[1]) local row = guiGridListAddRow (carGridList) guiGridListSetItemText (carGridList, row, 1, carName, false, true) guiGridListSetItemText (carGridList, row, 2, tostring(v[2]), false, true) end Cambias local cars por deportivos, por ejemplo y en el loop pones, en el primer guiGridListSetItemText, el texto deportivos, luego, creas otra tabla con otro tipo de vehículos y haces otro guiGridListSetItemText con el texto "motos", por ejemplo. Para ahorrarte loops más que nada.
  8. Pon el código. Si no lo posteas no podemos hacer nada. PD: El código con las diferentes categorías.
  9. Abro nuevamente el tema porque tengo un pequeño problemilla. Resulta que ya me aparecen los upgrades, todo perfecto (gracias, Alex ), pero no se actualizan. Me explico. Como veis, en la tabla aparecen diferentes mejoras, su nombre, su precio blabla, pues lo que pasa es que por ejemplo me subo a un savanna y no me aparece nada, le doy a /restart y me aparecen sus mejoras. Acto seguido, me subo a un sultán y me aparecen las mejoras del savanna, hago /restart y ya me aparecen las de Sultán y así. local delanteros = { --Nombre, id, precio, vehiculo {"Slamin", 1188, 200, "Savanna"}, {"Chrome", 1189, 200, "Savanna"}, {"Slamin", 1190, 200, "Tornado"}, {"Chrome", 1191, 200, "Tornado"}, {"Slamin", 1185, 200, "Remington"}, {"Chrome", 1179, 200, "Remington"}, {"Slamin", 1181, 200, "Blade"}, {"Chrome", 1182, 200, "Blade"}, {"Chrome", 1176, 200, "Broadway"}, {"Chrome", 1174, 200, "Broadway"}, {"Alien", 1169, 200, "Sultan"}, {"X-Flow", 1170, 200, "Sultan"}, {"Alien", 1171, 200, "Elegy"}, {"X-Flow", 1172, 200, "Elegy"}, {"Alien", 1160, 200, "Jester"}, {"X-Flow", 1173, 200, "Jester"}, {"Alien", 1166, 200, "Uranus"}, {"X-Flow", 1165, 200, "Uranus"}, {"Alien", 1155, 200, "Stratum"}, {"X-Flow", 1157, 200, "Stratum"}, {"Alien", 1153, 200, "Flash"}, {"X-Flow", 1152, 200, "Flash"}, } windows.meca1 = { { type = "label", text = "Paragolpes", font = "bankgothic", alignX = "center", }, { type = "pane", panes = {} } } for index, node in ipairs ( delanteros ) do local veh = getPedOccupiedVehicle(getLocalPlayer()) if getVehicleName(veh) == node[4] then table.insert( windows.meca1[2].panes, { image = ":players/images/skins/-1.png", title = "Parachoques "..node[1], text = "Cuesta "..node[3].."\nUn bonito parachoques para tu coche a un precio económico.", onHover = function( cursor, pos ) dxDrawRectangle( pos[1], pos[2], pos[3] - pos[1], pos[4] - pos[2], tocolor( unpack( { 0, 255, 120, 31 } ) ) ) end, onClick = function( key ) if key == 1 then --AQUI LA MEJORA A AÑADIR end end, wordBreak = true, } ) end end
  10. Diferentes tablas. Algo como deportivos = { {"Infernus", 120000}, {"Bullet", 50000} }
  11. Existen los PM's, kilfmwan... Míralo en la página de LUA.
  12. Puedes mirarte la página oficial de LUA o comenzar a hacer script con tablas (yo estoy con eso ahora mismo). Podrías tambien empezar por un GameMode por ejemplo Freeroam e ir editandolo, fijandote en sus funciones y demás.
  13. Prueba poniendo ésto: addEventHandler("onClientResourceStart", root, funcion) --o también addEventHandler("onClientResourceStart, getRootElement(), funcion) Yo tuve tu problema pero con otro script haciendo un trigger. Y no sé por qué, el problema fue porque tenía 'root'. Era muy extraño, no obstante, pruebalo a ver.
  14. No sé mucho de eso pero podrías poner algo como... ¿? addEventHandler( "onClientResourceStart", getLocalPlayer( ), function () end ) EDITO: El problema que tienes es que si uno cierra un panel al otro también se le cierra, ¿no?
  15. ¿Y si pones getLocalPlayer?
  16. Siento doble post. Los panes serían algo como ésto. Es el GUI de los shops de MTA Paradise. --[[ Copyright (c) 2010 MTA: Paradise This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . ]] local closeButton = { type = "button", text = "Cerrar", onClick = function( key ) if key == 1 then hide( ) windows.shop = { closeButton } end end, } windows.shop = { closeButton } function updateShopContent( content, name ) -- scrap what we had before windows.shop = { onClose = function( ) triggerServerEvent( "shops:close", getLocalPlayer( ) ) windows.shop = { closeButton } end, { type = "label", text = name, font = "bankgothic", alignX = "center", }, { type = "pane", panes = { } } } -- let's add all items for k, value in ipairs( content ) do local description = value.description or exports.items:getDescription( value.itemID ) table.insert( windows.shop[2].panes, { image = exports.items:getImage( value.itemID, value.itemValue, value.name ) or ":players/images/skins/-1.png", title = value.name or exports.items:getName( value.itemID ), text = "Cuesta $" .. value.price .. ( description and description ~= "" and ( " - " .. description ) or "" ), onHover = function( cursor, pos ) dxDrawRectangle( pos[1], pos[2], pos[3] - pos[1], pos[4] - pos[2], tocolor( unpack( { 0, 255, 0, 31 } ) ) ) end, onClick = function( key ) if key == 1 then triggerServerEvent( "shops:buy", getLocalPlayer( ), k ) end end, wordBreak = true, } ) end -- add a close button as well table.insert( windows.shop, closeButton ) end
  17. No puse bien el meta.xml :facepalm: PD: Voy a probar ahora.
×
×
  • Create New...