-
Posts
2,869 -
Joined
-
Last visited
Everything posted by Alexs
-
Te acabo de decir lo que debes hacer para ver si puedo ayudarte, al parecer, la variable 'm' debería ser un marcador, pero en cambio es algún otro tipo de variable y quiero saber si es un boolean o algo mas.
-
Añade esto al iniciar la función: outputChatBox( 'M: '..type( m )..' y V: '..type(v) ) Quiero saber que representan v y m, también si puedes muéstrame como se gatilla el evento 'onVehicleRefuel'.
-
chat_range = 100 -- Distancia function engineSwitch () if (isPedInVehicle (source)) then local veh = getPedOccupiedVehicle (source) if (getVehicleEngineState (veh) == true) then setVehicleEngineState (veh, false) outputChatBox ("Vehiculo Apagado.", source, 255, 0, 0) elseif (getVehicleEngineState (veh) == false) then setVehicleEngineState (veh, true) local px,py,pz = getElementPosition(source) for _,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then outputChatBox ("*".. getPlayerName(source) .." ah encendido el Vehiculo.", v, 255, 30, 50) end end end else outputChatBox ("You aren't in a vehicle!", source, 255, 0, 0) end end addEvent("engenieSwitch",true) addEventHandler("engenieSwitch",getRootElement(),engineSwitch) function isPlayerInRangeOfPoint(player,x,y,z,range) local px,py,pz=getElementPosition(player) return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5 <= range end No mire mas del código, así que dime si hay algún error.
-
Solo corregí ese error, así que revisa bien si funciona correctamente: chat_range = 100 -- Distancia function engineSwitch () if (isPedInVehicle (source)) then local veh = getPedOccupiedVehicle (source) if (getVehicleEngineState (veh) == true) then setVehicleEngineState (veh, false) outputChatBox ("Vehiculo Apagado.", source, 255, 0, 0) elseif (getVehicleEngineState (veh) == false) then setVehicleEngineState (veh, true) local px,py,pz = getElementPosition(source) for _,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then outputChatBox ("*".. getPlayerName(source) .." ah encendido el Vehiculo.", source, 255, 30, 50) end end end else outputChatBox ("You aren't in a vehicle!", source, 255, 0, 0) end end addEvent("engenieSwitch",true) addEventHandler("engenieSwitch",getRootElement(),engineSwitch) function isPlayerInRangeOfPoint(player,x,y,z,range) local px,py,pz=getElementPosition(player) return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5 <= range end
-
Vi esa misma frase en un comentario de alguna de estas webs.
-
Ya había visto esas imágenes en media docena de web's sensacionalistas llenas de rumores sin objetividad.
-
https://community.multitheftauto.com/index.php?p= ... ls&id=6542
-
http://www.ideal.es/almeria/20130918/ge ... 81108.html http://www.trucoteca.com/noticias/gener ... 13258.html
-
¿Lo creas mediante script o utilizando el Map Editor?
-
Acá te podrán ayudar con mayor profundidad: viewforum.php?f=104 ¿Te ocurre en el SinglePlayer?
-
Por lo que se sabe, no saldrá para PC.
-
No puedes cancelar ese evento, por utilizando 'toggleControl' puedes evitar que el jugador siga disparando. -| Pido a algún moderador que mueva este post a la sección correcta.
-
Algo asi: addEventHandler( 'onClientPlayerDamage', root, function( attacker ) if getElementData( source, 'Equipo' ) == (attacker and getElementData( attacker, 'Equipo' ) or '' ) then cancelEvent() end end )
-
Creo que en ese caso, es algo un tanto avanzado para ti, a pesar de ser muy básico.
-
No, eso no tiene mucho sentido.
-
No entiendo como podría darte un ejemplo para algo básico, creo que este tutorial podría ser mas útil: http://lua-users.org/wiki/TablesTutorial
-
Tablas en client-side e items identificados por un numero y no por un string.
-
Utilizar 'elementData' es una de las principales causas del lag y alto consumo del Gamemode MTA:DayZ, te aconsejaría buscar algún otro método.
-
Te dejo un pequeño tutorial de tablas que te lo explica mas en profundidad: http://lua-users.org/wiki/TablesTutorial
-
asi como lo puso alexs pero modificale 50000 a 300000 para que sean 5 mins en vez de 50s (50*60=300) Una pregunta en el [math.random(1, #msgs)], no tiene nada que ver con la cantidad de [local msgs = {....}] ?, la funcion que cumple es seleccionar 1 de todos los msgs? (gracias Alexs, Gamer y Solidsnake) 'math.random' devuelve un valor entre el primer y el segundo argumento que provees y tabla[index] sirve para seleccionar un valor de la tabla, ejemplo: t = {5, 6, 8, 7} print(t[1]) > 5 print( t[3] ) > 8 También, es útil saber que utilizar '#' devuelve el tamaño de una tabla o el largo de un string: t = { 5, 8, 4, 6, 9, 14, 'ola k ase' } print( #t ) > 7 print( #t[7] ) --El séptimo valor de la tabla es un string que contiene 'ola k ase'. > 9
-
Primero creabas GUI's en cada frame, luego me sobro un 'then', luego olvide ir cambiando la variable 'visible' y por ultimo, había olvidado que pase todos los GUI a una tabla llamada 'guiWidgets'.
-
local visible = false local guiWidgets = { win = guiCreateWindow(208, 119, 339, 406, "", false), Bang = guiCreateButton(209, 206, 120, 36, "Bangarang", false), parar = guiCreateButton(427, 489, 120, 36, "Parar Musica", false), Rock = guiCreateButton(427, 206, 120, 36, "Rock n Roll", false), Cinema = guiCreateButton(209, 290, 120, 36, "Cinema", false), First = guiCreateButton(427, 290, 120, 36, "First of the year", false), Rep = guiCreateButton(209, 378, 120, 36, "Reptile", false), Get = guiCreateButton(427, 378, 120, 36, "Get Up!", false) } guiWindowSetSizable(guiWidgets.win, false) for k, i in pairs( guiWidgets ) do guiSetVisible( i, false ) end function ven() dxDrawRectangle(209, 90, 337, 46, tocolor(255, 0, 0, 255), true) dxDrawText("Panel de Musica", 239, 92, 501, 129, tocolor(255, 255, 255, 255), 1, "bankgothic", "left", "top", false, false, true, false, false) dxDrawText("Skrillex:", 209, 155, 443, 196, tocolor(255, 255, 255, 255), 1, "bankgothic", "left", "top", false, false, true, false, false) end function bangarang() if source == guiWidgets.Bang then sonido = playSound("Musica/Bang.mp3") setSoundVolume(sonido, 0.5) end end addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), bangarang ) function first() if source == guiWidgets.First then sonido = playSound("Musica/First.mp3") setSoundVolume(sonido, 0.5) end end addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), first ) function rock() if source == guiWidgets.Rock then sonido = playSound("Musica/Rock.mp3") setSoundVolume(sonido, 0.5) end end addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), rock ) function ci() if source == guiWidgets.Cinema then sonido = playSound("Musica/Cinema.mp3") setSoundVolume(sonido, 0.5) end end addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), ci ) function one() if source == guiWidgets.Get then sonido = playSound("Musica/Get.mp3") setSoundVolume(sonido, 0.5) end end addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), one ) function by() if source == guiWidgets.Rep then sonido = playSound("Musica/Rep.mp3") setSoundVolume(sonido, 0.5) end end addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), by ) function par() if source == guiWidgets.parar then sonido = stopSound( sonido ) setSoundVolume(sonido, 0.0) end end addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), par ) function abrir() bindKey("F4", "down", function() if not visible then addEventHandler("onClientRender", root, ven ) for k, i in pairs( guiWidgets ) do guiSetVisible( i, true ) end visible = true showCursor( true ) else for k, i in pairs( guiWidgets ) do guiSetVisible( i, false ) end removeEventHandler("onClientRender", root, ven ) showCursor( false ) visible = false end end ) end addEventHandler("onClientResourceStart", root, abrir)
-
local visible = false local guiWidgets = { win = guiCreateWindow(208, 119, 339, 406, "", false), Bang = guiCreateButton(209, 206, 120, 36, "Bangarang", false), parar = guiCreateButton(427, 489, 120, 36, "Parar Musica", false), Rock = guiCreateButton(427, 206, 120, 36, "Rock n Roll", false), Cinema = guiCreateButton(209, 290, 120, 36, "Cinema", false), First = guiCreateButton(427, 290, 120, 36, "First of the year", false), Rep = guiCreateButton(209, 378, 120, 36, "Reptile", false), Get = guiCreateButton(427, 378, 120, 36, "Get Up!", false) } guiWindowSetSizable(guiWidgets.win, false) for k, i in pairs( guiWidgets ) do guiSetVisible( i, false ) end function ven() dxDrawRectangle(209, 90, 337, 46, tocolor(255, 0, 0, 255), true) dxDrawText("Panel de Musica", 239, 92, 501, 129, tocolor(255, 255, 255, 255), 1, "bankgothic", "left", "top", false, false, true, false, false) dxDrawText("Skrillex:", 209, 155, 443, 196, tocolor(255, 255, 255, 255), 1, "bankgothic", "left", "top", false, false, true, false, false) end function bangarang() if source == Bang then sonido = playSound("Musica/Bang.mp3") setSoundVolume(sonido, 0.5) end end addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), bangarang ) function first() if source == First then sonido = playSound("Musica/First.mp3") setSoundVolume(sonido, 0.5) end end addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), first ) function rock() if source == Rock then sonido = playSound("Musica/Rock.mp3") setSoundVolume(sonido, 0.5) end end addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), rock ) function ci() if source == Cinema then sonido = playSound("Musica/Cinema.mp3") setSoundVolume(sonido, 0.5) end end addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), ci ) function one() if source == Get then sonido = playSound("Musica/Get.mp3") setSoundVolume(sonido, 0.5) end end addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), one ) function by() if source == Rep then sonido = playSound("Musica/Rep.mp3") setSoundVolume(sonido, 0.5) end end addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), by ) function par() if source == parar then sonido = stopSound( sonido ) setSoundVolume(sonido, 0.0) end end addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), par ) function abrir() bindKey("F4", "down", function() if not visible then addEventHandler("onClientRender", root, ven ) for k, i in pairs( guiWidgets ) do guiSetVisible( i, true ) end visible = true showCursor( true ) else for k, i in pairs( guiWidgets ) do guiSetVisible( i, false ) end removeEventHandler("onClientRender", root, ven ) showCursor( false ) visible = false end end ) end addEventHandler("onClientResourceStart", root, abrir)
