-
Posts
65 -
Joined
-
Last visited
Everything posted by TRtam
-
Make sure that you added "sonidos/cerrar.mp3" and "sonidos/abrir.mp3" into meta.xml
-
This is not the section to post your scripting questions, next time post it in https://forum.multitheftauto.com/forum/167-scripting/ About your code, this should work: function openVIPpanel(thePlayer) account = getPlayerAccount(thePlayer) if isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("VIP")) then triggerClientEvent (thePlayer, "openVIPWindow", thePlayer) else outputChatBox("¡No eres usuario V.I.P!.",thePlayer,255,0,0) end end function resourceStart ( ) for k, v in pairs ( getElementsByType ( "player" ) ) do bindKey ( v, "F6", "down", openVIPpanel ); end end addEventHandler ( "onResourceStart", resourceRoot, resourceStart ) function playerJoin ( ) bindKey ( source, "F6", "down", openVIPpanel ); end addEventHandler ( "onPlayerJoin", root, playerJoin )
-
Podrias explicar mejor lo que tratas de hacer?
-
As the wiki says: you cannot store tables as value, but you can use toJSON strings.
-
Primero obtienes la data local data = getElementData(jugador, "EstadoJugador") Segundo editas la armadura data.armadura = 100 Tercero guardas la data setElementData(jugador, "EstadoJugador", data)
-
Esta bien usarlo como herramienta para guardar datos simples, ya que por lo general no suelen cambiarse de pc continuamente o borrar el cache de su MTA. podrias usar SQL para guardar los datos ya que en este caso la database seria del servidor o uno creado por ti que permanecera en el resource, y los clientes no podran borrarlo.
-
Si, todo archivo que creas en la parte client-side se guardara en el cache y lo que creas en la parte server-side se guardara en el resource
-
No aparece en tu resource porque ahi no es donde se guarda, se guarda en el cache
-
This should work: function DoubleClick (button) if button == "left" then Name = guiGridListGetItemText(gridlist,guiGridListGetSelectedItem(gridlist),1) --Get the name (Location[4]) outputChatBox(""..Name) --Testing to see if it gets the name --Something to iterate through table and check if the Name is equals to ^"Name"^, then create a marker after it gets the Locations x,y,z from table local x, y, z for i=1,#Locations do if Name == Locations[i][4] then x, y, z = Locations[i][1], Locations[i][2], Locations[i][3] end end local marker = createMarker( x,y,z-1,"cylinder", 3, 0, 100, 0, 100 ) end end
-
function globalMessage(thePlayer, cmd, ...) local message = table.concat({...}, " ") local name = getPlayerName(thePlayer) local account = getPlayerAccount(thePlayer) if not isGuestAccount(account) and isObjectInACLGroup ("user."..getAccountName(account), aclGetGroup("Admin")) then outputChatBox("#FF0000[Admin][Global]#FFFFFF "..name..": #FFFFFF"..message, root, 255,255,255, true) else outputChatBox("#FF0000[Global]#FFFFFF "..name..": #FFFFFF"..message, root, 255,255,255, true) end end
-
¿Quieres hacer que cuando el player llegue a un nivel determinado cambie la imagen? Si es asi tendras que crear una tabla: su keyname sera el nivel que quieres y el value sera la imagen. Algo asi: local tabla = { [10] = ":hud/images/main.png", [20] = ":hud/images/main2.png", } Luego haces una condicional verificando si el nivel esta en la tabla y dentro del condicional va el dxDrawImage local nivel = getElementData(localPlayer, "nivel") if tabla[nivel] then dxDrawImage(..., tabla[nivel]) end
-
Ya que estas haciendo un stream de la canción (reproduciendo la canción por una pagina, creo que es así como funciona) tenes que usar onClientSoundStream local sound = nil local soundMaxPos = nil addCommandHandler( "yt", function( cmd, link ) if link then if sound == nil then playSound("https://www.youtubeinmp3.com/fetch/?video="..link) else if isElement( sound ) then stopSound( sound ) sound = nil else sound = nil soundMaxPos = nil end playSound("https://www.youtubeinmp3.com/fetch/?video="..link) end else outputChatBox( "Introduce un link para reproducir", 255, 0, 0 ) if isElement( sound ) then stopSound( sound ) sound = nil else sound = nil soundMaxPos = nil end end end ) addEventHandler( "onClientRender", root, function( ) if sound then if math.floor( getSoundPosition( sound ) ) >= soundMaxPos then outputChatBox( "Canción acabada", 0, 150, 0 ) if isElement( sound ) then stopSound( sound ) end sound = nil end end end ) addEventHandler("onClientSoundStream", resourceRoot, function(suc, length) if not suc then return end sound = source soundMaxPos = math.floor(length) outputChatBox( "Reproduciendo la cancion", 0, 150, 0) end )
-
Lo que se me ocurrio ahora seria usar un onClientRender: local sound = playSound("sound.mp3") local soundMaxPosition = math.floor(getSoundLength(sound)) function soundRender() local soundPosition = math.floor(getSoundPosition(sound)) if soundPosition >= soundMaxPosition then outputChatBox("Sound finished!") removeEventHandler("onClientRender", root, soundRender) end end addEventHandler("onClientRender", root, soundRender)
-
Sorry I was wrong. You need to use pairs () to get the keyname and the value for type,value in pairs(commands["value"]) do for _,value in pairs(value) do if type == "report" then addCommandHandler(value, report) elseif type == "checkAdmins" then addCommandHandler(value, checkAdmins) end end end
-
[ENCUESTA] Persona más odiada de la comunidad MTA Hispana.
TRtam replied to Simple0x47's topic in Offtopic
No los conozco así que votare al que este primero en la poll >:v -
for type,data in ipairs(commands["value"]) do if type == "report" then addCommandHandler(data[1], report) elseif type == "checkAdmins" then addCommandHandler(data[1], checkAdmins) end end The first value of the ipairs/pairs will be the keyname and the second will be the value
-
Bueno no sé como explicarlo bien pero espero que entiendas xd, cuando usas un rendertarget lo que esta dentro del este adquiere las posiciones X e Y del dxDrawimage por lo que estarías sumando la posición del dxDrawImage mas la posición que le das a lo que esta dentro del rendertarget
-
I don't know anything of .fx but viewing this https://wiki.multitheftauto.com/wiki/Shader_examples#Texture_name i can create the .fx of what you need. Here is the .fx and the .lua: float4 Color; technique car_window_tint { pass P0 { MaterialAmbient = Color; MaterialDiffuse = Color; MaterialEmissive = Color; MaterialSpecular = Color; } } local theShader = dxCreateShader("tinted.fx", 1,200, true) dxSetShaderValue(theShader, "Color", 255/255,0/255,0/255,50/255) -- Here is the Red,Green,Blue and Alpha. All need to be from 0 to 1 that is why i divide for 255 function tintedWindows() for k,vehicles in ipairs(getElementsByType("vehicle")) do if getElementData(vehicles, "tinted") == true then engineApplyShaderToWorldTexture(theShader, "vehiclegeneric256", vehicles) engineApplyShaderToWorldTexture(theShader, "hotdog92glass128", vehicles) engineApplyShaderToWorldTexture(theShader, "okoshko", vehicles) else engineRemoveShaderFromWorldTexture(theShader, "vehiclegeneric256", vehicles) engineRemoveShaderFromWorldTexture(theShader, "hotdog92glass128", vehicles) engineRemoveShaderFromWorldTexture(theShader, "okoshko", vehicles) end end end Sorry for the basic english. :v
-
I think you can made it with 2 variables; the first for the state and the second for the alpha using math.min/max Here is an example: local show = false local alpha = 0 addEventHandler("onClientRender", getRootElement(), function() if show then alpha = math.min(alpha + 20, 255) else alpha = math.max(alpha - 20, 0) end dxDrawRectangle(200, 200, 200, 200, tocolor(255, 255, 255, alpha)) end ) bindKey("F1", "down", function() show = not show end )