Vic_RattleHead Posted May 11, 2016 Posted May 11, 2016 Hola, hace poco volví y decidí seguir aprendiendo como crear mis propios recursos, así que hice una gui sencilla para un panel de autos, una gridlist y 2 botones comprar y cerrar, como logro que al seleccionar el row y luego darle "comprar" aparezca el coche, gracias. CLIENT: function PANEL() COMPRAR = guiCreateButton(0.41, 0.55, 0.12, 0.11, "COMPRAR", true) guiSetProperty(COMPRAR, "NormalTextColour", "FFAAAAAA") CERRAR = guiCreateButton(328, 251, 96, 69, "CERRAR", false) addEventHandler("onClientGUIClick",CERRAR, CERRAR1) guiSetProperty(CERRAR, "NormalTextColour", "FFAAAAAA") LISTA = guiCreateGridList(0.17, 0.29, 0.23, 0.37, true) guiGridListAddColumn(LISTA, "CARS", 0.9) guiGridListAddRow(LISTA) guiGridListSetItemText(LISTA, 0, 1, "BUGATTI", false, false) showCursor(true) end addCommandHandler("carro", PANEL) function CERRAR1 () destroyElement(COMPRAR) destroyElement(LISTA) destroyElement(CERRAR) showCursor(false) end function SPAWNCAR() guiGridListSetSelectedItem ( LISTA, 1, 0) --ADMINISTRADOR, CREADOR Y DESARROLLADOR: GRUPO EN FACEBOOK: https://www.facebook.com/groups/778807552207175/?fref=ts [OVERKILL]PROJECT Multi[G]amemode --GANGWAR/ZOMBIEWAR/TACTICS/CIVILWAR/RACE/DEATHRACE¡¡TODO EN UNO!!-- PROXIMAMENTE http://overkillprojectserver.creatuforo.com/foro/
Enargy, Posted May 11, 2016 Posted May 11, 2016 triggerServerEvent createVehicle addEvent - Inactivo.
AlvareZ_ Posted May 11, 2016 Posted May 11, 2016 triggerServerEvent createVehicle addEvent También: "onClientGUIClick" addEventHandler
Vic_RattleHead Posted May 12, 2016 Author Posted May 12, 2016 Gracias, logre que al presionar "COMPRAR" aparezca el vehiculo, pero como hago para que al seleccionar la row "BUGATTI" y luego presionar "COMPRAR" aparezca? --ADMINISTRADOR, CREADOR Y DESARROLLADOR: GRUPO EN FACEBOOK: https://www.facebook.com/groups/778807552207175/?fref=ts [OVERKILL]PROJECT Multi[G]amemode --GANGWAR/ZOMBIEWAR/TACTICS/CIVILWAR/RACE/DEATHRACE¡¡TODO EN UNO!!-- PROXIMAMENTE http://overkillprojectserver.creatuforo.com/foro/
Enargy, Posted May 12, 2016 Posted May 12, 2016 Agrega esto en la función SPAWNCAR local r, c = guiGridListGetSelectedItem(gridlist) if (r ~= -1 and c ~= -1) then -- Lo que quieres hacer. end - Inactivo.
Vic_RattleHead Posted May 12, 2016 Author Posted May 12, 2016 Perfecto gracias con eso mismo pude agregar la imagen del auto, ahora quiero que se compre el coche pero no sirve lo que hice, incluso ya no me crea el auto, que esta mal? function SPAWN_BUGATTI(thePlayer) local money = getPlayerMoney(thePlayer) if money > 300 then takePlayerMoney(thePlayer, 300) carro = createVehicle(tonumber(411), 528.84295654297, -1287.8753662109, 16.701047897339 ) warpPedIntoVehicle(source, carro) outputChatBox("Compraste un Bugatti por $50000",thePlayer, 0, 255, 0) outputChatBox("¡¡GRACIAS POR TU COMPRA!!",thePlayer, 0, 255, 0) else outputChatBox("Necesitas $50000 para adquirir el vehiculo.",thePlayer, 255, 0, 0) destroyElement(carro, SPAWN_BUGATTI) end end --ADMINISTRADOR, CREADOR Y DESARROLLADOR: GRUPO EN FACEBOOK: https://www.facebook.com/groups/778807552207175/?fref=ts [OVERKILL]PROJECT Multi[G]amemode --GANGWAR/ZOMBIEWAR/TACTICS/CIVILWAR/RACE/DEATHRACE¡¡TODO EN UNO!!-- PROXIMAMENTE http://overkillprojectserver.creatuforo.com/foro/
Tomas Posted May 12, 2016 Posted May 12, 2016 Reemplaza la linea seis con esto: warpPedIntoVehicle(thePlayer, carro) Currently developing for International Gaming Community - Join us!
Enargy, Posted May 12, 2016 Posted May 12, 2016 Reemplaza la linea seis con esto: warpPedIntoVehicle(thePlayer, carro) Pero en lugar de thePlayer sería source por como el dijo que no le crea el auto, el error estaria en el getPlayerMoney. - Inactivo.
Vic_RattleHead Posted May 13, 2016 Author Posted May 13, 2016 Bueno solucione el problema getPlayerMoney debía estar con source, ahora existe un botón que dice "matricula" y abre una ventana con un memo y el botón aceptar como logro que lo que se escriba ahí sea el nombre de la matricula del vehiculo? se que debo usar getVehiclePlateText, pero no se como lograr que el jugador cree su propia matricula. --ADMINISTRADOR, CREADOR Y DESARROLLADOR: GRUPO EN FACEBOOK: https://www.facebook.com/groups/778807552207175/?fref=ts [OVERKILL]PROJECT Multi[G]amemode --GANGWAR/ZOMBIEWAR/TACTICS/CIVILWAR/RACE/DEATHRACE¡¡TODO EN UNO!!-- PROXIMAMENTE http://overkillprojectserver.creatuforo.com/foro/
Vic_RattleHead Posted May 13, 2016 Author Posted May 13, 2016 INTENTE LO SIGUIENTE PERO NO DA RESULTADO AL HACER CLICK SOBRE EL MEMO ME CREA EL AUTO Y ME WARPEA A EL Y APARECE EL ERROR: Bad argument @ 'setVehiclePlateText' [Expected string at argument 2, got nil] CLIENT: function PLACAOFICIAL() local r, c = guiGridListGetSelectedItem(LISTCAR) if (r ~= 1 and c ~= 0) and MATRICULABOTON and PLACATEXT and ACEPTARPLACA then triggerServerEvent("PLACA", getLocalPlayer()) end end SERVER: function SPAWN_BUGATTI(thePlayer) setVehiclePlateText( carro, text ) local money = getPlayerMoney(source) if money > 299 then takePlayerMoney(source, 300) carro = createVehicle(tonumber(411), 528.84295654297, -1287.8753662109, 16.701047897339 ) warpPedIntoVehicle(source, carro) outputChatBox("Compraste un Bugatti por $50000",thePlayer, 0, 255, 0) outputChatBox("¡¡GRACIAS POR TU COMPRA!!",thePlayer, 0, 255, 0) else outputChatBox("Necesitas $50000 para adquirir el vehiculo.",thePlayer, 255, 0, 0) end end addEvent("SPAWN1", true) addEventHandler("SPAWN1", getRootElement(), SPAWN_BUGATTI ) addEvent("PLACA",true) addEventHandler("PLACA", getRootElement(),SPAWN_BUGATTI) Y necesito que la placa se cree antes de spawnear el auto es decir: selecciono row, boton matricula, introduzco nombre, acepto, compro, spawneo y la placa tendría el nombre que coloque anteriormente. --ADMINISTRADOR, CREADOR Y DESARROLLADOR: GRUPO EN FACEBOOK: https://www.facebook.com/groups/778807552207175/?fref=ts [OVERKILL]PROJECT Multi[G]amemode --GANGWAR/ZOMBIEWAR/TACTICS/CIVILWAR/RACE/DEATHRACE¡¡TODO EN UNO!!-- PROXIMAMENTE http://overkillprojectserver.creatuforo.com/foro/
Recommended Posts