#Raiden Posted August 26, 2015 Share Posted August 26, 2015 Hola, Hace unos dias me descargue un script para vender autos, Y me puse a editarlo, Le intente Poner para que se le puedan poner upgrades (Ya tengo las upgrades en la gridlist y esas cosas) Pero lo que quiero hacer es que el jugador al elegir la mejora se le añada al Auto Mientras el carro este girando, Y también, Que al comprar el auto con esas mejoras, Aprezcan las upgrades al comprar el auto, No sé si me entienden... Link to comment
Tomas Posted August 26, 2015 Share Posted August 26, 2015 Hay muchos modshops en la comunidad. Link to comment
Platin Posted August 27, 2015 Share Posted August 27, 2015 Hay muchos modshops en la comunidad. Además sin referencias no podemos hacer mucho. Postea las funciones que editaste. Link to comment
#Raiden Posted August 27, 2015 Author Share Posted August 27, 2015 Esta es la parte donde compra la upgrade: function buyUpgrade() if (source == ComprarMejora) then -- Buy > Armor player = localPlayer local price_Upgrade = 500 money = getPlayerMoney (source) if (money >= price_Upgrade) then outputChatBox ("Le has hecho una mejora a tu #FF0000Auto #FFFFFFPor tan solo #00ff00$#FF0000"..price_Upgrade.."", 255, 255, 255, true) takePlayerMoney(price_Upgrade) triggerServerEvent("giveUpgrade", player, giveUpgrade) else outputChatBox("No tienes suficiente dinero mejorar tu auto.", 255, 0, 0) end end end addEventHandler("onClientGUIClick", root, buyUpgrade) y esta es la gridlist no sé si la necesiten for i, v in ipairs(sideSkit) do mas = mas + 1 row = guiGridListAddRow ( GridMejora ) row = guiGridListAddRow ( GridMejora ) guiGridListSetItemText(GridMejora, row, upgradeColumn, v[1], false, false) guiGridListSetItemText(GridMejora, row, upgradeColumnCost, v[3], false, false) end Link to comment
Platin Posted August 27, 2015 Share Posted August 27, 2015 Esta es la parte donde compra la upgrade: function buyUpgrade() if (source == ComprarMejora) then -- Buy > Armor player = localPlayer local price_Upgrade = 500 money = getPlayerMoney (source) if (money >= price_Upgrade) then outputChatBox ("Le has hecho una mejora a tu #FF0000Auto #FFFFFFPor tan solo #00ff00$#FF0000"..price_Upgrade.."", 255, 255, 255, true) takePlayerMoney(price_Upgrade) triggerServerEvent("giveUpgrade", player, giveUpgrade) else outputChatBox("No tienes suficiente dinero mejorar tu auto.", 255, 0, 0) end end end addEventHandler("onClientGUIClick", root, buyUpgrade) y esta es la gridlist no sé si la necesiten for i, v in ipairs(sideSkit) do mas = mas + 1 row = guiGridListAddRow ( GridMejora ) row = guiGridListAddRow ( GridMejora ) guiGridListSetItemText(GridMejora, row, upgradeColumn, v[1], false, false) guiGridListSetItemText(GridMejora, row, upgradeColumnCost, v[3], false, false) end Manda que el evento server-side "giveUpgrade". Link to comment
#Raiden Posted August 27, 2015 Author Share Posted August 27, 2015 ¿Y cómo lo hago? Yo intente usando addVehicleUpgrade,Pero no paso nada , ademas no sé si solo poniendole la upgrade Se comprara junto con el vehículo. Link to comment
aka Blue Posted August 27, 2015 Share Posted August 27, 2015 Yo te recomendaría que tú mismo te hagas el script. No es difícil utilizando tablas y te ahorrarás el tiempo de analizar códigos de otras personas. PD: Se usa addVehicleUpgrade por cojones . Postea el código del evento que pone la mejora. Link to comment
#Raiden Posted August 27, 2015 Author Share Posted August 27, 2015 Arriba lo puse, Pero no se hacer que en el server side le ponga la mejora al auto Link to comment
Platin Posted August 27, 2015 Share Posted August 27, 2015 Arriba lo puse, Pero no se hacer que en el server side le ponga la mejora al auto Hace un Trigger a Server-Side, quiero ver donde lleva ese Trigger. El código que pasaste no ayuda. Link to comment
aka Blue Posted August 27, 2015 Share Posted August 27, 2015 El script te habrá venido con un apartado client y otro server. Publica el código del apartado server para que te podamos ayudar. Link to comment
#Raiden Posted August 27, 2015 Author Share Posted August 27, 2015 Server.. function getFreeID() local result = dbPoll(dbQuery(db, "SELECT ID FROM VehicleList ORDER BY ID ASC"), -1) newID = false for i, id in pairs (result) do if id["ID"] ~= i then newID = i break end end if newID then return newID else return #result + 1 end end function getVehicleByID(id) v = false for i, veh in ipairs (getElementsByType("vehicle")) do if getElementData(veh, "ID") == id then v = veh break end end return v end function updateVehicleInfo(player) if isElement(player) then local result = dbPoll(dbQuery(db, "SELECT * FROM VehicleList WHERE Account = ?", getAccountName(getPlayerAccount(player))), -1) if type(result) == "table" then setElementData(player, "VehicleInfo", result) end end end addEventHandler("onResourceStart", resourceRoot, function() db = dbConnect("sqlite", "database.db") dbExec(db, "CREATE TABLE IF NOT EXISTS VehicleList (ID, Account, Model, X, Y, Z, RotZ, Colors, Upgrades, Paintjob, Cost, HP)") for i, player in ipairs(getElementsByType("player")) do updateVehicleInfo(player) end end) addEvent("onOpenGui", true) addEventHandler("onOpenGui", root, function() updateVehicleInfo(source) end) function destroyVehicle(theVehicle) if isElement(theVehicle) then local Owner = getElementData(theVehicle, "Owner") if Owner then local x, y, z = getElementPosition(theVehicle) local _, _, rz = getElementRotation(theVehicle) local r1, g1, b1, r2, g2, b2 = getVehicleColor(theVehicle, true) local color = r1..","..g1..","..b1..","..r2..","..g2..","..b2 upgrade = "" for _, upgradee in ipairs (getVehicleUpgrades(theVehicle)) do if upgrade == "" then upgrade = upgradee else upgrade = upgrade..","..upgradee end end local Paintjob = getVehiclePaintjob(theVehicle) or 3 local id = getElementData(theVehicle, "ID") dbExec(db, "UPDATE VehicleList SET X = ?, Y = ?, Z = ?, RotZ = ?, HP = ?, Colors = ?, Upgrades = ?, Paintjob = ? WHERE Account = ? AND ID = ?", x, y, z, rz, getElementHealth(theVehicle), color, upgrade, Paintjob, getAccountName(getPlayerAccount(Owner)), id) updateVehicleInfo(Owner) local attached = getAttachedElements(theVehicle) if (attached) then for k,element in ipairs(attached) do if getElementType(element) == "blip" then destroyElement(element) end end end end destroyElement(theVehicle) end end addEvent("onBuyNewVehicle", true) addEventHandler("onBuyNewVehicle", root, function(Model, cost, r1, g1, b1, r2, g2, b2) abc = false local data = dbPoll(dbQuery(db, "SELECT * FROM VehicleList WHERE Account = ?", getAccountName(getPlayerAccount(source))), -1) for i, data in ipairs (data) do if data["Model"] == Model then abc = true break end end if #data >= 50 then outputChatBox("[server] #FF0000Lo Sentimos, Solo Puedes Comprar 50 Autos.", source, 38, 122, 216, true) return end if abc then outputChatBox("[sistema De Vehiculo] #FF0000Ya Compraste Este Auto.", source, 38, 122, 216, true) return end if getPlayerMoney(source) >= tonumber(cost) then takePlayerMoney ( source, cost ) local x, y, z = getElementPosition(source) local _, _, rz = getElementRotation(source) local color = r1..","..g1..","..b1..","..r2..","..g2..","..b2 vehicle = createVehicle(Model, x-5, y+5, z, 0, 0, rz) setVehicleColor(vehicle, r1, g1, b1, r2, g2, b2) setElementData(vehicle, "Owner", source) local NewID = getFreeID() setElementData(vehicle, "ID", NewID) dbExec(db, "INSERT INTO VehicleList VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", NewID, getAccountName(getPlayerAccount(source)), Model, x-5, y+5, z, rz, color, "", 3, cost, 1000) outputChatBox("[server] #FFFF00Has Comprado Un: #00FFFF"..getVehicleNameFromModel(Model), source, 38, 122, 216, true) outputChatBox("[server] #FFFF00Costo: #00FF00$"..cost, source, 38, 122, 216, true) updateVehicleInfo(source) vv[vehicle] = setTimer(function(source) if not isElement(source) then killTimer(vv[source]) vv[source] = nil end if isElement(source) and getElementHealth(source) <= 255 then setElementHealth(source, 255.5) setVehicleDamageProof(source, true) setVehicleEngineState(source, false) end end, 50, 0, vehicle) addEventHandler("onVehicleDamage", vehicle, function(loss) local account = getAccountName(getPlayerAccount(getElementData(source, "Owner"))) setTimer(function(source) if isElement(source) then dbExec(db, "UPDATE VehicleList SET HP = ? WHERE Account = ? AND Model = ?", getElementHealth(source), account, getElementModel(source)) updateVehicleInfo(getElementData(source, "Owner")) end end, 100, 1, source) end) addEventHandler("onVehicleEnter", vehicle, function(player) if getElementHealth(source) <= 255.5 then setVehicleEngineState(source, false) else if isVehicleDamageProof(source) then setVehicleDamageProof(source, false) end end end) else outputChatBox("[server] #FF0000No tienes suficiente dinero para comprar este auto.", source, 38, 122, 216, true) end end) addEvent("SpawnMyVehicle", true) addEventHandler("SpawnMyVehicle", root, function(id) local data = dbPoll(dbQuery(db, "SELECT * FROM VehicleList WHERE Account = ? AND ID = ?", getAccountName(getPlayerAccount(source)), id), -1) if type(data) == "table" and #data ~= 0 then if getVehicleByID(id) then outputChatBox("[sistema De Vehiculo] #58FAF4Su Vehiculo #FFFF00"..getVehicleNameFromModel(data[1]["Model"]).." #58FAF4Ya Esta Spawneado.", source, 38, 122, 216, true) else local color = split(data[1]["Colors"], ',') r1 = color[1] or 255 g1 = color[2] or 255 b1 = color[3] or 255 r2 = color[4] or 255 g2 = color[5] or 255 b2 = color[6] or 255 vehicle = createVehicle(data[1]["Model"], data[1]["X"], data[1]["Y"], data[1]["Z"], 0, 0, data[1]["RotZ"]) setElementData(vehicle, "ID", id) local upd = split(tostring(data[1]["Upgrades"]), ',') for i, upgrade in ipairs(upd) do addVehicleUpgrade(vehicle, upgrade) end local Paintjob = data[1]["Paintjob"] or 3 setVehiclePaintjob(vehicle, Paintjob) setVehicleColor(vehicle, r1, g1, b1, r2, g2, b2) if data[1]["HP"] <= 255.5 then data[1]["HP"] = 255 end setElementHealth(vehicle, data[1]["HP"]) setElementData(vehicle, "Owner", source) vv[vehicle] = setTimer(function(source) if not isElement(source) then killTimer(vv[source]) vv[source] = nil end if isElement(source) and getElementHealth(source) <= 255 then setElementHealth(source, 255.5) setVehicleDamageProof(source, true) setVehicleEngineState(source, false) end end, 50, 0, vehicle) addEventHandler("onVehicleDamage", vehicle, function(loss) local account = getAccountName(getPlayerAccount(getElementData(source, "Owner"))) setTimer(function(source) if isElement(source) then dbExec(db, "UPDATE VehicleList SET HP = ? WHERE Account = ? AND Model = ?", getElementHealth(source), account, getElementModel(source)) updateVehicleInfo(getElementData(source, "Owner")) end end, 100, 1, source) end) addEventHandler("onVehicleEnter", vehicle, function(player) if getElementHealth(source) <= 255.5 then setVehicleEngineState(source, false) else if isVehicleDamageProof(source) then setVehicleDamageProof(source, false) end end end) outputChatBox("[Vehiculos] #58FAF4Su Vehiculo #FFFF00"..getVehicleNameFromModel(data[1]["Model"]).." #00FF00A sido Spawneado.", source, 38, 122, 216, true) end else outputChatBox("[Vehiculos] #FF0000Puede Ser Que/Hay Un Problema Es Su Vehiculo, Hable Con Un Administrador.", source, 38, 122, 216, true) end end) addEvent("DestroyMyVehicle", true) addEventHandler("DestroyMyVehicle", root, function(id) local vehicle = getVehicleByID(id) if isElement(vehicle) then local data = dbPoll(dbQuery(db, "SELECT * FROM VehicleList WHERE Account = ? AND ID = ?", getAccountName(getPlayerAccount(source)), id), -1) if type(data) == "table" and #data ~= 0 then destroyVehicle(vehicle) outputChatBox ("[Vehiculos] #58FAF4Su Vehiculo #FFFF00"..getVehicleNameFromModel(data[1]["Model"]).." #FF0000A Sido Ocultado.", source, 38, 122, 216, true) else outputChatBox("[Vehiculos] #FF0000Seleccione EL Vehiculo Que Desea Ocultar.", source, 38, 122, 216, true) end else outputChatBox("[Vehiculos] #58FAF4Su Vehiculo #FF0000No Esta Spawneado.", source, 38, 122, 216, true) end end) addEvent("LightsMyVehicle", true) addEventHandler("LightsMyVehicle", root, function(id) local vehicle = getVehicleByID(id) if isElement(vehicle) then local Vehicle = getPedOccupiedVehicle(source) if Vehicle == vehicle then if getVehicleOverrideLights(vehicle) ~= 2 then setVehicleOverrideLights(vehicle, 2) outputChatBox("[Vehiculos] #58FAF4Su Vehiculo #FFFF00"..getVehicleNameFromModel(getElementModel(vehicle)).." #00FF00Tiene Luces Encendidas.", source, 38, 122, 216, true) elseif getVehicleOverrideLights(vehicle) ~= 1 then setVehicleOverrideLights(vehicle, 1) outputChatBox("[Vehiculos #58FAF4Su Vehiculo #FFFF00"..getVehicleNameFromModel(getElementModel(vehicle)).." #FF0000Tiene Luces Apagadas.", source, 38, 122, 216, true) end else outputChatBox("[Vehiculos] #FF0000Usted No Esta En Un Vehiculo!", source, 38, 122, 216, true) end else outputChatBox("[Vehiculos] #58FAF4Su Vehiculo #FF0000No Esta Spawneado.", source, 38, 122, 216, true) end end) addEvent("LockMyVehicle", true) addEventHandler("LockMyVehicle", root, function(id) local vehicle = getVehicleByID(id) if isElement(vehicle) then if not isVehicleLocked(vehicle) then setVehicleLocked(vehicle, true) setVehicleDoorsUndamageable(vehicle, true) setVehicleDoorState(vehicle, 0, 0) setVehicleDoorState(vehicle, 1, 0) setVehicleDoorState(vehicle, 2, 0) setVehicleDoorState(vehicle, 3, 0) outputChatBox("[Vehiculos] #58FAF4Su Vehiculo #FFFF00"..getVehicleNameFromModel(getElementModel(vehicle)).." #FF0000Esta Bloqueado.", source, 38, 122, 216, true) elseif isVehicleLocked(vehicle) then setVehicleLocked(vehicle, false) setVehicleDoorsUndamageable(vehicle, false) outputChatBox("[Vehiculos] #58FAF4Su Vehiculo #FFFF00"..getVehicleNameFromModel(getElementModel(vehicle)).." #00FF00Esta Desbloqueado.", source, 38, 122, 216, true) end else outputChatBox("[Vehiculos] #58FAF4Su Vehiculo #FF0000No Esta Spawndeado.", source, 38, 122, 216, true) end Link to comment
aka Blue Posted August 27, 2015 Share Posted August 27, 2015 (edited) Cuanto elementData asqueroso... En ningún sitio sale el evento de la mejora o es que estoy to' siego. Edited August 27, 2015 by Guest Link to comment
Platin Posted August 27, 2015 Share Posted August 27, 2015 Guanto elementData asqueroso... En ningún sitio sale el evento de la mejora o es que estoy to' siego. Estas en lo correcto, no sale. ¿No hay más archivos .lua? Link to comment
#Raiden Posted August 27, 2015 Author Share Posted August 27, 2015 Perdón, Se me olvidó que habia borrado esa parte por que no me sirvío, Aquí esta: function comprar(theVehicle) addVehicleUpgrade(theVehicle, 1030) end addEvent("giveUpgrade", true) addEventHandler("giveUpgrade", root, comprar) Creo que esto que hice no tiene nada que ver con lo que quiero hacer por que quiero que se le ponga la mejora mientres el carro este girando, Y con eso que tengo No se le pone ni la mejora. Link to comment
aka Blue Posted August 27, 2015 Share Posted August 27, 2015 El propio script te tiene que dar ese código pero el bueno, ¿dónde está? PD: Perdón por el "GUANDO", se me fue la pinza . Link to comment
Platin Posted August 27, 2015 Share Posted August 27, 2015 Perdón, Se me olvidó que habia borrado esa parte por que no me sirvío, Aquí esta: function comprar(theVehicle) addVehicleUpgrade(theVehicle, 1030) end addEvent("giveUpgrade", true) addEventHandler("giveUpgrade", root, comprar) Creo que esto que hice no tiene nada que ver con lo que quiero hacer por que quiero que se le ponga la mejora mientres el carro este girando, Y con eso que tengo No se le pone ni la mejora. Editaste mucho del script, borrando cosas importantes. ¿Alguna vez scripteaste? Te explico, el Vehículo nunca se le fue dicho al Script, ni tampoco la update (giveUpgrade no existe en el Client-Side) Pasa el script real. Link to comment
#Raiden Posted August 27, 2015 Author Share Posted August 27, 2015 El script Real No tiene nada de las upgrades, Solo la parte de Vender los autos Colores etc... Yo le quise agregar La parte de las upgrades pero no sé como, Al principio Del tema lo dije... Edit: Si el script me vendría con todo el código para que pediría ayuda? Si ya esta hecho todo... Link to comment
Platin Posted August 27, 2015 Share Posted August 27, 2015 El script Real No tiene nada de las upgrades, Solo la parte de Vender los autos Colores etc... Yo le quise agregar La parte de las upgrades pero no sé como, Al principio Del tema lo dije...Edit: Si el script me vendría con todo el código para que pediría ayuda? Si ya esta hecho todo... ¿Entonces intentaste juntar dos scripts? En ese caso, pasame los dos scripts. Te explico nuevamente lo que entendí que hiciste, hiciste una GUI con una gridlist y al seleccionar la upgrade haces un trigger, ese trigger no tiene nada de información por lo cual el coche no cambia además de, que en la propia función donde haces el trigger, está nisiquiera determina cual es la upgrade. Link to comment
#Raiden Posted August 27, 2015 Author Share Posted August 27, 2015 El script completo es este: client function centerWindow ( center_window ) local sx, sy = guiGetScreenSize ( ) local windowW, windowH = guiGetSize ( center_window, false ) local x, y = ( sx - windowW ) / 2, ( sy - windowH ) / 2 guiSetPosition ( center_window, x, y, false ) end setTimer ( function () local theCol = getElementData(root, "BlockExportCol") function isInColExport () if isElement(theCol) and isElementWithinColShape(localPlayer,theCol) then return true else return false end end function ClientExplosionCFunction() if isInColExport () then cancelEvent () end end addEventHandler("onClientExplosion", root, ClientExplosionCFunction) end , 1000, 1 ) local screX, screY = guiGetScreenSize() Window_VS = guiCreateWindow(500, 254, 330, 420,"Sistema De Autos",false) guiSetAlpha(Window_VS, 0.88) guiWindowSetSizable(Window_VS, false) guiSetVisible(Window_VS, false) centerWindow(Window_VS) Grid_VS = guiCreateGridList(11, 107, 255, 225,false,Window_VS) guiGridListSetSelectionMode(Grid_VS, 1) guiGridListAddColumn(Grid_VS,"Auto",0.29) guiGridListAddColumn(Grid_VS,"Precio $",0.29) guiGridListAddColumn(Grid_VS,"Vida",0.29) Label_SVS = guiCreateLabel(10, 386, 257, 15, "Reparar $500 | Warpear $50",false,Window_VS) guiLabelSetColor(Label_VeS, 38, 122, 216) guiLabelSetColor(Label_SVS, 38, 122, 216) guiSetFont(Label_VeS, "default-bold-small") guiSetFont(Label_SVS, "default-bold-small") Button_VS_JumpBMX = guiCreateButton(270, 120, 80, 39, "Super BMX", false, Window_VS) guiSetProperty(Button_VS_JumpBMX, "NormalTextColour", "FFDBE900") setElementData(Button_VS_JumpBMX, "tooltip-text", "Super salto en BMX") Button_VS_Jump = guiCreateButton(270, 223, 80, 39, "Super Salto", false, Window_VS) guiSetProperty(Button_VS_Jump, "NormalTextColour", "FFFFFFFF") setElementData(Button_VS_Jump, "tooltip-text", "Super salto ") Button_VS_Fly = guiCreateButton(270, 170, 80, 39, "Volar con Vehiculo", false, Window_VS) guiSetProperty(Button_VS_Fly, "NormalTextColour", "FF00E941") setElementData(Button_VS_Fly, "tooltip-text", "Volar Con Vehiculo") Button_VS_Water = guiCreateButton(270, 279, 80, 39, "Vehiculo en agua", false, Window_VS) guiSetProperty(Button_VS_Water, "NormalTextColour", "FF3AEAFF") setElementData(Button_VS_Water, "tooltip-text", "Andar con Vehiculo en agua") Button_VS_sn = guiCreateButton(10, 342, 61, 39, "Sacar", false, Window_VS) guiSetProperty(Button_VS_sn, "NormalTextColour", "FFFF0000") setElementData(Button_VS_sn, "tooltip-text", "Sacar auto") Button_VS_dy = guiCreateButton(75, 342, 61, 39, "Destrozar", false, Window_VS) guiSetProperty(Button_VS_dy, "NormalTextColour", "FFFFEF00") setElementData(Button_VS_dy, "tooltip-text", "Destrozar auto") Button_VS_lk = guiCreateButton(184, 54, 67, 43, "Des/Bloquear", false, Window_VS) guiSetProperty(Button_VS_lk, "NormalTextColour", "FFA35800") setElementData(Button_VS_lk, "tooltip-text", "Bloquear Desbloquear tu auto") Button_VS_bp = guiCreateButton(103, 54, 67, 43, "Des/Marcar", false, Window_VS) guiSetProperty(Button_VS_bp, "NormalTextColour", "FF6B3FFA") setElementData(Button_VS_bp, "tooltip-text", "Localizar Vehiculo") Button_VS_Fix = guiCreateButton(205, 342, 61, 39, "Reparar", false, Window_VS) guiSetProperty(Button_VS_Fix, "NormalTextColour", "FF00DDFF") setElementData(Button_VS_Fix, "tooltip-text", "Reparar Vehiculo") Button_VS_sl = guiCreateButton(19, 54, 67, 43, "Vender", false, Window_VS) guiSetProperty(Button_VS_sl, "NormalTextColour", "FF3CFD01") setElementData(Button_VS_sl, "tooltip-text", "Vender sus vehiculos") Button_VS_Warp = guiCreateButton(141, 342, 61, 39, "Warpear", false, Window_VS) guiSetProperty(Button_VS_Warp, "NormalTextColour", "FFFFFFFF") setElementData(Button_VS_Warp, "tooltip-text", "Warpear Vehiculo") Window_CHK = guiCreateWindow(screX/2-155,screY/2-60,310,120,"WARNING",false) guiSetVisible(Window_CHK, false) guiSetProperty(Window_CHK, "AlwaysOnTop", "true") guiWindowSetSizable(Window_CHK, false) Label_CHK = guiCreateLabel(21,28,266,36,"",false,Window_CHK) guiLabelSetColor(Label_CHK, 38, 122, 216) guiLabelSetHorizontalAlign(Label_CHK,"center",true) Button_CHK_Y = guiCreateButton(17,73,129,36,"Yes",false,Window_CHK) Button_CHK_N = guiCreateButton(161,73,129,36,"No",false,Window_CHK) flay = false function toggleflay() if flay == false then flay = true setWorldSpecialPropertyEnabled("aircars", true) outputChatBox("#ffFFffCarro Volador #00ff00activado", 255, 255, 255, true) playSoundFrontEnd(6) else flay = false setWorldSpecialPropertyEnabled("aircars", false) outputChatBox("#ffFFffCarro Volador #ff0000Desactivado", 255, 255, 255, true) playSoundFrontEnd(17) end end addEventHandler("onClientGUIClick",Button_VS_Fly, toggleflay, false ) waterwalk = false function togglewaterwalk() if waterwalk == false then waterwalk = true setWorldSpecialPropertyEnabled("hovercars", true) outputChatBox("#ffFFffAndar con carro en agua #00ff00activado", 255, 255, 255, true) playSoundFrontEnd(6) else waterwalk = false setWorldSpecialPropertyEnabled("hovercars", false) outputChatBox("#ffFFffAndar con carro en agua #ff0000Desactivado", 255, 255, 255, true) playSoundFrontEnd(17) end end addEventHandler("onClientGUIClick",Button_VS_Water, togglewaterwalk, false ) bunny = false function togglebunny() if bunny == false then bunny = true setWorldSpecialPropertyEnabled("extrabunny", true) outputChatBox("#ffFFffSuper Salto en BMX #00ff00activado", 255, 255, 255, true) playSoundFrontEnd(3) else bunny = false setWorldSpecialPropertyEnabled("extrabunny", false) outputChatBox("#ffFFffSuper Salto en BMX #ff0000Desactivado", 255, 255, 255, true) playSoundFrontEnd(18) end end addEventHandler("onClientGUIClick",Button_VS_JumpBMX, togglebunny, false ) ejump = false function toggleejump() if ejump == false then ejump = true setWorldSpecialPropertyEnabled("extrajump", true) outputChatBox("#ffFFffSuper Salto #00ff00activado", 255, 255, 255, true) playSoundFrontEnd(6) else ejump = false setWorldSpecialPropertyEnabled("extrajump", false) outputChatBox("#ffFFffSuper Salto #ff0000Desactivado", 255, 255, 255, true) playSoundFrontEnd(17) end end addEventHandler("onClientGUIClick",Button_VS_Jump, toggleejump, false ) function updateGridList() local data = getElementData(localPlayer, "VehicleInfo") if data then local rw, cl = guiGridListGetSelectedItem(Grid_VS) guiGridListClear(Grid_VS) for i, data in ipairs (data) do local carName = getVehicleNameFromModel(data["Model"]) local ID = data["ID"] local Cost = data["Cost"] local HP = math.floor(data["HP"]) local PreCost = math.ceil(Cost*.9*HP/100/10) local row = guiGridListAddRow(Grid_VS) guiGridListSetItemText(Grid_VS, row, 1, carName, false, true) guiGridListSetItemData(Grid_VS, row, 1, ID) guiGridListSetItemText(Grid_VS, row, 2, PreCost, false, true) guiGridListSetItemText(Grid_VS, row, 3, HP.." HP", false, true) end guiGridListSetSelectedItem(Grid_VS, rw, cl) end end bindKey("F6", "down", function() if getElementInterior(localPlayer) == 0 and getElementDimension(localPlayer) == 0 then if getElementData(localPlayer, "MissionWarProtection") and getElementData(localPlayer, "MissionProtection")then return end guiSetVisible(Window_VS, not guiGetVisible(Window_VS)) guiSetVisible (Window_CHK, false) showCursor(guiGetVisible(Window_VS)) end end) triggerServerEvent("onOpenGui", localPlayer) addEventHandler("onClientElementDataChange", root, function(dd) if getElementType(source) == "player" and source == localPlayer and dd == "VehicleInfo" then local data = getElementData(source, dd) if data then updateGridList() end end end) function WINDOW_CLICK_VEHICLE (button, state, absoluteX, absoluteY) local id = guiGridListGetSelectedItem(Grid_VS) local ID = guiGridListGetItemData(Grid_VS, id, 1) if source == Button_VS_close then guiSetVisible(Window_VS, false) showCursor(false) end if (source == Grid_VS) then if id == -1 and idd then guiGridListSetSelectedItem(Grid_VS, idd, 1) return false else idd = guiGridListGetSelectedItem(Grid_VS) end elseif id == -1 then elseif (source == Button_VS_sn) then if not isInColExport () then triggerServerEvent("SpawnMyVehicle", localPlayer, ID) end elseif (source == Button_VS_dy) then triggerServerEvent("DestroyMyVehicle", localPlayer, ID) elseif (source == Button_VS_lt) then triggerServerEvent("LightsMyVehicle", localPlayer, ID) elseif (source == Button_VS_bp) then triggerServerEvent("BlipMyVehicle", localPlayer, ID) elseif (source == Button_VS_lk) then triggerServerEvent("LockMyVehicle", localPlayer, ID) elseif (source == Button_VS_sl) then guiSetVisible(Window_CHK, true) local carName = guiGridListGetItemText(Grid_VS, guiGridListGetSelectedItem(Grid_VS), 1) local carprice = guiGridListGetItemText(Grid_VS, guiGridListGetSelectedItem(Grid_VS), 2) guiSetText(Label_CHK, 'Esta Seguro EN Vender Este Vehiculo "'..carName..'" Por $'..carprice) elseif source == Button_CHK_Y then triggerServerEvent("SellMyVehicle", localPlayer, ID) guiSetVisible(Window_VS, false) guiSetVisible(Window_CHK, false) showCursor(false) elseif source == Button_CHK_N then guiSetVisible (Window_CHK, false) elseif source == Button_VS_Spc then if getElementInterior(localPlayer) == 0 then if getElementData(localPlayer,"Stats") < 2 then SpecVehicle(ID) end end elseif source == Button_VS_Fix then triggerServerEvent("FixMyVehicle", localPlayer, ID) elseif source == Button_VS_Warp then if not isInColExport () then Link to comment
Kilfwan Posted August 27, 2015 Share Posted August 27, 2015 Edit: Perdón nada referente al tema Link to comment
Sticmy Posted August 28, 2015 Share Posted August 28, 2015 Utiliza está función ponlo en la parte donde compra el upgrade getPedOccupiedVehicle te funcionará y verás que al comprar el vehículo le añadirá el upgrade Link: https://wiki.multitheftauto.com/wiki/Ge ... iedVehicle function buyUpgrade() if (source == ComprarMejora) then -- Buy > Armor local theVehicle = getPedOccupiedVehicle ( localPlayer ) if theVehicle then money = getPlayerMoney (source) if (money >= 500) then outputChatBox ("Le has hecho una mejora a tu #FF0000Auto #FFFFFFPor tan solo #00ff00$#FF0000"..price_Upgrade.."", 255, 255, 255, true) takePlayerMoney(500) triggerServerEvent("giveUpgrade", localPlayer, theVehicle) else outputChatBox("No tienes suficiente dinero mejorar tu auto.", 255, 0, 0) end end end end addEventHandler("onClientGUIClick", root, buyUpgrade) Link to comment
#Raiden Posted August 28, 2015 Author Share Posted August 28, 2015 Utiliza está función ponlo en la parte donde compra el upgrade getPedOccupiedVehicle te funcionará y verás que al comprar el vehículo le añadirá el upgrade Link: https://wiki.multitheftauto.com/wiki/Ge ... iedVehicle function buyUpgrade() if (source == ComprarMejora) then -- Buy > Armor local theVehicle = getPedOccupiedVehicle ( localPlayer ) if theVehicle then money = getPlayerMoney (source) if (money >= 500) then outputChatBox ("Le has hecho una mejora a tu #FF0000Auto #FFFFFFPor tan solo #00ff00$#FF0000"..price_Upgrade.."", 255, 255, 255, true) takePlayerMoney(500) triggerServerEvent("giveUpgrade", localPlayer, theVehicle) else outputChatBox("No tienes suficiente dinero mejorar tu auto.", 255, 0, 0) end end end end addEventHandler("onClientGUIClick", root, buyUpgrade) No le añade el upgrade, Tampoco salen los outputChatBox, No sé si yo lo hice mal O esa parte no sirve. :v Link to comment
Kilfwan Posted August 28, 2015 Share Posted August 28, 2015 Tienes que mandar el evento a server side Link to comment
Platin Posted August 28, 2015 Share Posted August 28, 2015 Reitero de nuevo, nunca le decis que upgrade ponerle al vehículo, solo triggeas que el source sea el jugador Local y una variable sea el vehículo, pero no la upgrade!!!! Link to comment
#Raiden Posted August 28, 2015 Author Share Posted August 28, 2015 Reitero de nuevo, nunca le decis que upgrade ponerle al vehículo, solo triggeas que el source sea el jugador Local y una variable sea el vehículo, pero no la upgrade!!!! En el serverside tengo para ponerle el upgrade, Pero no sé hacerlo bien arriba Puse como lo hice pero me dijiste lo mismo Y no entendí, Mi pregunta es, En vez de repetir Que debo hacer eso, Por que no me dices como hacerlo?, Para eso pido ayuda... Link to comment
Recommended Posts