Jump to content

Search the Community

Showing results for tags 'lua'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • [Read-Only] Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Gang


Location


Occupation


Interests

  1. How can I add the red smoke from the stuntplane to the Hydra jet? I tried, but it wasn't successful.
  2. Hey there, guys I recently messed with Grok a little bit, when it comes to MTA:SA scripts - and oh boy, he can make scripts. If you gonna tell Grok a detailed description of what you want, he will give it to you, but 90% of the times it will be broken, so you need to actively send him debug problems and stuff. Here are the list of the scripts that I edited succesfully / or made using grok: Soundboard script (creates a F3 GUI menu and you can play different meme sounds when clicking on the sound buttons) Force 30 fps script on a RACE map (creates a script, that enables 30 fps only on the map you plug the script into, after the map is switched - FPS change back to normal that you have set in your server settings) - and to make it work, edit the map name (map name from meta.xml) to your own local: targetMapName = "[30FPS] Driveable Yosemite" -- The map to force 30 FPS on Reduce bumps - Reduces bumps on race maps, by changing velocity of the vehicle in real time (there are some small problems with it too, i think you need to configure the script for different vehicles, tweak the values so it fits, example: Bandito is too fast on the bumpy terrain, when going down slope) Edited race ghost resource - so it now has a "carhide" function, that hides ghost (if players are distracted by it, they can simply turn it off via F3 if i remember correctly) Race-Driftking - made its very own drift table to my race map. I struggled with this alot and gave him many LUA examples and he finally made it work. It even has flags, and saves the stats on the map (idk if they save if you leave the server tho) Download them here: https://limewire.com/d/pXuGF#q0p5r0BMwg However... Grok is not perfect. Here are the attempts that I tried to make, but it didn't succeed (maybe you'll have knowledge what to fix in those) Paintjob script: Does not show the paintjob. The 1st version of the script works fine, but I wanted the paintjob to also change the color and he said it is possible, and now this version has bunch of problems in debug. This script was meant to give you an ui activated with /paintjob command, and you coul choose a paintjob, and a color and apply it. It would also save if you would quit the server and come back, and it will come back if you are logged in and logged out (i struggled 1.5 hours with this, he finally made it work after 1.5 hours) Very own clanwar script - I managed to get around some problems, that if map would redo the round would go from 1 to 2. The problems here, is he struggles to fix the point system from the previous script, and also sometimes GUI does not open. Grok forgets earlier attachements so maybe that's the reason that he sometimes :O up those scripts, but if anyone would be helpful I'd like this one fixed - can explain after what I wanted in there Map Panel script - I don't have it here, but it had a functional map panel, and it correctly listed the maps only from RACE gamemode. I also made him include the cash reward after race completion, and he also did it perfectly, however problems were with buying the maps - when you bought the map, money went away but map didn't play when script appearantly said "that the correct map was set" after buying it. Login Panel - he can do the login panel UI perfectly, but sometimes struggle with saving the accounts (or creating databases), he prefers to save account info in .xml file. Also if you would login or register from the login panel, it wouldn't let you log in (even if you typed the correct credentials it just didn't work and nothing happened) Some other screenshots I made when I tested Grok (this is all Grok's work): (i fixed this pesky text bug after like 3 times asking him to resize the table or move the text lol) (color didn't go as planned, but alpha was working fine, but eventually scrapped it) I'm inclined to say, that Grok is very helpful, and you should use it. You can also download some of the scripts that Grok did in the hyperlinks. What do you think guys? He made me come back to this game, only to mess with some scripting
  3. Panel = {} local screenWidth, screenHeight local renderTarget local headerColor = tocolor(0, 0, 0, 227) local headerColor2 = tocolor(0, 0, 0, 240) local itemColor = tocolor(42, 40, 41) local highlightedColor = tocolor(255, 255, 255) colorButtonsList = { { name = "purple" }, { name = "blue" }, { name = "red" }, { name = "orange" }, { name = "green" }, { name = "black" }, { name = "pink" }, { name = "blue2"}, { name = "grey"}, { name = "yellow"}, } local panelWidth = 797 local panelHeight local headerHeight = 60 local itemHeight = 25 local itemsCount = 8 local headerFont local itemFont local columns = { { name = "Matou:", size = 0.1, data = "kills"}, { name = "Morreu:", size = 0.1, data = "deaths"}, { name = "Desativado:", size = 0.1, data = " "}, { name = "Nick:", size = 0.4, data = "name"}, { name = "Equipe:", size = 0.1, data = "team"}, { name = "Fps:", size = 0.1, data = "FPS"}, { name = "Ping:", size = 0.1, data = "ping"}, } setTimer( function() if getPlayerTeam(localPlayer) then setElementData(localPlayer, "team", getTeamName(getPlayerTeam(localPlayer))) end end, 1000, 0) local playersList = {} local playersOnlineCount = 0 local playersOnlineString = "Jogadores online" local scrollOffset = 0 function dxDrawRoundedRectangle(x, y, rx, ry, cor, raio) rx = rx - raio * 2 ry = ry - raio * 2 x = x + raio y = y + raio if (rx >= 0) e (ry >= 0) then dxDrawRectangle(x, y, rx, ry, cor) dxDrawRectangle(x, y - raio, rx, raio, cor) dxDrawRectangle(x, y + ry, rx, raio, cor) dxDrawRectangle(x - raio, y, raio, ry, cor) dxDrawRectangle(x + rx, y, raio, ry, cor) terminar fim local function draw() if renderTarget then dxSetRenderTarget(renderTarget) end local w, h = 500, 50 local y = screenHeight / 2 - panelHeight / 2 local panelX = screenWidth / 2 - panelWidth / 2 dxDrawRoundedRectangle(panelX, y, panelWidth, headerHeight * 2 + itemsCount * itemHeight, headerColor,1) dxDrawRoundedRectangle(panelX, y, panelWidth, headerHeight * 4.07 - itemsCount * itemHeight, headerColor2,1) local x = panelX para i, coluna em ipairs(colunas) do local width = panelWidth * column.size dxDrawText(exports.dpLang:getString(column.name), x, y, x + width, y + headerHeight, tocolor(255, 255, 255), 1, headerFont, "center", "center") x = x + width end y = y + headerHeight local itemY = y for i = scrollOffset + 1, math.min(itemsCount + scrollOffset, #playersList) do local item = playersList local color = itemColor if item.isGroup then color = item.color end if item.isLocalPlayer then color = highlightedColor end x = panelX if item.isGroup then dxDrawText(item.text, x, y, x + panelWidth, y + headerHeight * 0.8, tocolor(255, 255, 255), 1, itemFont, "center", "center", true) else for j, column in ipairs(columns) do local text = item[column.data] local width = panelWidth * column.size dxDrawText(tostring(text), x, y, x + width, y + headerHeight * 0.8, tocolor(255, 255, 255), 1, itemFont, "center", "center", true) x = x + width end end y = y + itemHeight end x = panelX y = itemY + itemsCount * itemHeight dxDrawText(playersOnlineString .. ": " .. tostring(playersOnlineCount), x, y, x + panelWidth, y + headerHeight, tocolor(255, 255, 255), 1, headerFont, "center", "center") if renderTarget then dxSetRenderTarget() end end local function mouseDown() if #playersList <= itemsCount then return end scrollOffset = scrollOffset + 1 if scrollOffset > #playersList - itemsCount then scrollOffset = #playersList - itemsCount + 1 end end local function mouseUp() if #playersList <= itemsCount then return end scrollOffset = scrollOffset - 1 if scrollOffset < 0 then scrollOffset = 0 end end function Panel.start() renderTarget = exports.dpUI:getRenderTarget() screenWidth, screenHeight = exports.dpUI:getScreenSize() addEventHandler("onClientRender", root, draw) headerFont = exports.dpAssets:createFont("Roboto-Regular.ttf", 12) itemFont = exports.dpAssets:createFont("Roboto-Regular.ttf", 12) for i, colorButton in ipairs(colorButtonsList) do local lol = exports.dpUI:getThemeName( colorButton.name) if tostring(colorButtonsList.name) == tostring(lol) then logoNumber = i end end panelHeight = 10 + headerHeight * 2 + itemsCount * itemHeight highlightedColor = tocolor(exports.dpUI:getThemeColor()) lista de jogadores = {} local function addPlayerToList(player, isLocalPlayer) if type(player) == "table" then table.insert(playersList, player) return end local nameString if player:getData("nome de usuário") then nameString = exports.dpUtils:removeHexFromString(player:getData("nome de usuário")) else nameString = getPlayerName(player).." (carregando...)" end table.insert(playersList, { isLocalPlayer = isLocalPlayer, id = player:getData("serverId") or 0, name = player.name:gsub("#%x%x%x%x%x%x%x",""), ping = tostring(player:getPing() or '?'), FPS = player:getData('FPS') or '-', team = tostring(player:getData("team") or "Player"), kills = tostring(player:getData("kills") or 0), mortes = tostring(player:getData("mortes") ou 0), }) end local players = getElementsByType("player") table.sort(players, function (player1, player2) local id1 = player1:getData("serverId") ou 999 local id2 = player2:getData("serverId") ou 999 return id1 < id2 end) playersOnlineCount = #players local function getPlayersWithData(dataName) local t = {} for i = #players, 1, -1 do if players:getData(dataName) then table.insert(t, table.remove(players, i)) end end return t end addPlayerToList(localPlayer, true) if #players > 0 then addPlayerToList({ text = exports.dpLang:getString("tab_panel_group_players"), color = headerColor, isGroup = true} ) for i, player in ipairs(players) do if player ~= localPlayer then addPlayerToList(player) end end end bindKey("mouse_wheel_up", "para baixo", mouseUp) bindKey("mouse_wheel_down", "para baixo", mouseDown) localPlayer:setData("activeUI", "tabPanel") playersOnlineString = exports.dpLang:getString("tab_panel_players_online") se não playersOnlineString então playersOnlineString = "Jogadores online" end end function Panel.stop() removeEventHandler("onClientRender", root, draw) destroyElement(headerFont) destroyElement(itemFont) unbindKey("mouse_wheel_up", "para baixo", mouseUp) unbindKey("mouse_wheel_down", "para baixo", mouseDown) localPlayer:setData("activeUI", false) end local iFPS = 0 local FPS = 0 setTimer(function() localPlayer:setData('FPS', FPS, true) end,5000,0) addEventHandler('onClientRender',root,function() iFPS = iFPS+1 fim) setTimer(function() FPS = iFPS iFPS = 0 final,1000,0)
  4. o mod tava funcionando normalmente ate que uma hr ficou com letras e símbolos aleatórios no painel ja tentei troca , ou substituir e fica no mesmo
  5. estou com problema no mta não consigo atira com nem uma arma ja tentei reinstalar o gta não foi, da pra mirar mais não atirar
  6. I want to know is there a way to replace this txd file (gtasa/models/generic/vehicle.txd) via mta script for players in server. If we do this replacement to our game it will improve vehicle lights on a modded police car. example: before txd replace (vehicle.txd) https://i.postimg.cc/NFmZNQpc/mta-screen-2025-02-08-01-19-33.png and after replace https://i.postimg.cc/bYnXYR8B/mta-screen-2025-02-08-01-17-24.png and this is the png files that i added to vehicle.txd https://postimg.cc/gallery/19YGG41 How can i do this via a script like adding a mod to a vehicle dff or txd. If someone knows how to replace this txd please help me thank you...
  7. I need a lot of help from you. Hackers come to my server with Lua injectors and run AddEventHandlers which are not in the server then my server gets network trouble. I can't imagine what to do with it. Please give me a solution for it. please
  8. ---Why does the FPS drop when this anticheat resource is put on the server? What is the reason for that? please help function generatePass(character) local NewPass = "" for i = 1, character do local PassWordNew = string.char( math.random(97, 122) ) NewPass = NewPass..PassWordNew end setElementData(getResourceRootElement(getThisResource()),"0x0x1223#@The1523dwdS252Xoop15asd282Pass@#!", NewPass) end generatePass(30) setTimer(function() generatePass(30) end, 1000, 0) function getXoopPassword() generatePass(30) return getElementData(getResourceRootElement(getThisResource()),"0x0x1223#@The1523dwdS252Xoop15asd282Pass@#!") end
  9. O vídeo que você assistiu sobre persistência na programação, especialmente em Lua ou em qualquer linguagem, aborda um conceito fundamental para o desenvolvimento de habilidades em programação. A persistência é a capacidade de continuar tentando, mesmo diante de desafios e frustrações. No vídeo, provavelmente foram apresentados exemplos práticos que mostram como enfrentar erros e dificuldades de forma construtiva. A programação, por natureza, envolve resolução de problemas, e a persistência é essencial para superá-los. Ao lidar com bugs ou conceitos complexos, é importante manter a calma, buscar soluções e aprender com os erros. Além disso, o vídeo pode ter enfatizado a importância de praticar regularmente, estabelecer metas de aprendizado e não ter medo de pedir ajuda, não fazer modificações medíocres como forma de treinamento. Lembre-se que tem o fórum para você pedir ajuda, sempre terá alguém que terá prazer em ajudar você.
  10. I have designed a Snake game in my Multi Theft Auto project using the Lua programming language, implementing all functionalities and dynamics. Additionally, I have designed the controls to be very functional, allowing gameplay with either a keyboard or Xbox/PlayStation controllers. Here’s a link for you to watch.
  11. Hello dear forum members, I am deeply interested in a persistent question regarding my shader for the effect of raindrops flowing down the sides of the car, as well as the effect of raindrops (spots) on the surface of the car (roof, bumper). I’ve been struggling with these issues for a long time and still can’t figure out how to solve my two problems. I hope someone can help me and explain to a beginner in HLSL how to properly implement the shader. The first problem is that I don’t understand how to make the raindrops flow down the different sides of the car. Essentially, I have a single texture applied to the car, and I can't figure out how to split it into multiple segments and adapt it to flow around the sides of the car. (I also need to account for the unique features of each car model so that the flow looks realistic on each vehicle.) The second problem is the effect of tiny raindrops on the roof, hood, and bumper of the car (the generation of small droplets that gradually appear and disappear). The issue is that I’m trying to apply both effects in one shader, but the problem is that either only one of them works under certain settings, or nothing works at all. I can't get both effects to work harmoniously together. I’ll also provide an example of the Lua script and the textures used for the shader. I really hope for your help. I've been spending too much time on this, and I can't seem to find a solution. float4x4 gWorld : WORLD; float4x4 gView : VIEW; float4x4 gProjection : PROJECTION; float gTime : TIME; // Rain parameters float gDropSpeed = 0.03; // Speed of droplet flow float2 noiseScale = float2(0.2, 0.8); // Noise texture scale float3 lightDirection = float3(1.0, 1.0, -1.0); // Light direction float gDropSpread = 0.3; // Droplet spread float gDropDepth = 0.3; // Droplet depth texture gTexture; // Main car texture texture texRain; // Raindrop texture texture texNormalRain; // Raindrop normals texture texNoise; // Noise texture // Variables for controlling the effect float gAlpha = 0.01; // Alpha channel for the car float rainAlpha = 1.8; // Alpha channel for raindrops sampler2D gTextureSampler = sampler_state { Texture = ( gTexture ); MinFilter = Linear; MagFilter = Linear; AddressU = Wrap; AddressV = Wrap; }; sampler2D texRainSampler = sampler_state { Texture = ( texRain ); MinFilter = Linear; MagFilter = Linear; AddressU = Wrap; AddressV = Wrap; }; sampler2D texNormalRainSampler = sampler_state { Texture = ( texNormalRain ); MinFilter = Linear; MagFilter = Linear; AddressU = Wrap; AddressV = Wrap; }; sampler2D texNoiseSampler = sampler_state { Texture = ( texNoise ); MinFilter = Linear; MagFilter = Linear; AddressU = Wrap; AddressV = Wrap; }; struct VertexShaderInput { float4 Position : POSITION; // Using standard POSITION semantics for the vertex shader float2 TextureCoordinate : TEXCOORD0; // Passing texture coordinates }; struct PixelShaderInput { float4 Position : POSITION; // Passing position as float4 for proper operation float3 WorldPos : TEXCOORD1; // Passing world coordinates for calculations float2 TextureCoordinate : TEXCOORD0; // Passing texture coordinates }; PixelShaderInput VertexShaderFunction(VertexShaderInput input) { PixelShaderInput output; // Position in world coordinates float4 worldPos = mul(input.Position, gWorld); // Storing position for further projection output.Position = mul(mul(input.Position, gWorld), gView); output.Position = mul(output.Position, gProjection); // Applying projection // Storing world coordinates (for droplet flow) output.WorldPos = worldPos.xyz; // Passing texture coordinates output.TextureCoordinate = input.TextureCoordinate; return output; } float4 PixelShaderFunction(PixelShaderInput output) : COLOR0 { float2 textureCoordinate = output.TextureCoordinate; // Main car texture float4 baseColor = tex2D(gTextureSampler, textureCoordinate); baseColor.rgb = max(baseColor.rgb, 0.1); // Brightening dark areas // Getting noise for random movement float noise = tex2D(texNoiseSampler, textureCoordinate * noiseScale).r; // World coordinates to determine droplet direction float3 worldPos = output.WorldPos; // Using world coordinates // Determining droplet direction based on normals and world position float3 normal = normalize(output.WorldPos); // Normal to the surface // Checking direction by normals to determine which side of the car we're on if (abs(normal.x) > abs(normal.y) && abs(normal.x) > abs(normal.z)) { // Side surfaces textureCoordinate.y += gDropSpeed * gTime; // Flowing down the sides } else if (normal.y > 0.5) { // Top surface (roof) textureCoordinate.y -= gDropSpeed * gTime; // Droplets flow down } else { // Other sides (front and back) textureCoordinate.x -= gDropSpeed * gTime; // Optionally add droplet flow forward/backward } // Reducing random offset for more precise flow float2 offset = gDropSpread * (noise * 4.0 - 0.5) * float2(1.0, 2.5); // Using float2 for offset textureCoordinate -= offset; // Applying deviation in both axes // Raindrop texture float4 rainColor = tex2D(texRainSampler, textureCoordinate); // Adjusting droplets to the car color rainColor.rgb = baseColor.rgb * 0.8 + float3(0.1, 0.1, 0.1); // Adding body tint to droplets rainColor.a = rainAlpha; // Alpha channel of droplets // Normals for droplets float4 tempRainNormal = tex2D(texNormalRainSampler, textureCoordinate); // Explicitly using float4 float3 rainNormal = normalize(tempRainNormal.rgb * 2.5 - 0.75); // Normalizing normals // Lighting on droplets float diffuse = saturate(dot(normalize(rainNormal), normalize(lightDirection))); // Correct lighting // Combining colors float4 finalColor = lerp(baseColor, rainColor, rainAlpha * diffuse); finalColor.a = lerp(gAlpha, rainAlpha, diffuse * 0.9); // Adding droplet depth finalColor.rgb += gDropDepth * 0.9; // Depth effect of droplets float3 v = float3(0.0, 0.0, 0.0); float Tr2 = gTime * 11000.0; float2 n = tex2D(texNoiseSampler, textureCoordinate * 0.5).rg; for (float r = 4.0; r > 0.0; r--) // Reducing the number of iterations { float2 x = 2100.0 * r * 0.015; float2 p = 6.28 * textureCoordinate * x + (n - 0.5) * 2.0; float4 d = tex2D(texNoiseSampler, round(textureCoordinate * x - 0.25) / x); float t = (sin(p.x) + sin(p.y)) * max(0.0, 1.0 - frac(Tr2 * (d.b + 0.1) + d.g) * 2.0); if (d.r < (2.0 - r) * 0.08 && t > 0.5) { v += normalize(float3(-cos(p.x), lerp(1.2, 2.0, t - 0.5), 0.0)); } } finalColor.rgb += v * rainAlpha; return finalColor; } technique Replace { pass P0 { DepthBias = -0.0001; AlphaBlendEnable = TRUE; SrcBlend = SRCALPHA; DestBlend = INVSRCALPHA; VertexShader = compile vs_1_1 VertexShaderFunction(); PixelShader = compile ps_3_0 PixelShaderFunction(); } } LUA CODE: local shader = dxCreateShader("fx/shader.fx", 2, 300, true, "vehicle"); local zapylyayushiesyaDetali = { "remap_body", }; local rainTexture = dxCreateTexture("assets/RainCar.png") local normalRainTexture = dxCreateTexture("assets/RainNormal.png") local noiseTexture = dxCreateTexture("assets/enbnoise.png") dxSetShaderValue(shader, "texRain", rainTexture) dxSetShaderValue(shader, "texNormalRain", normalRainTexture) dxSetShaderValue(shader, "texNoise", noiseTexture) -- Применение шейдера к машине local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle then --engineApplyShaderToWorldTexture(shader, "vehiclegrunge256", vehicle) for _, name in ipairs(zapylyayushiesyaDetali) do engineRemoveShaderFromWorldTexture(shader, name, localPlayer.vehicle) engineApplyShaderToWorldTexture(shader, name, localPlayer.vehicle) end end renderTarget = dxCreateRenderTarget(512, 512, true) addEventHandler("onClientRender", root, function() iprint(shader) if shader then if renderTarget then dxSetRenderTarget(renderTarget, true) dxDrawImage(0, 0, 512, 512, shader) dxSetRenderTarget() dxDrawImage(50, 50, 256, 256, renderTarget) end end end)
  12. Lua Language Server - Definition files The Lua language server is a powerful tool that enhances the development experience for Lua programming. It provides a comprehensive set of code editing features, including suggestions, auto-completion, and error checking. With the Lua language server, developers can effortlessly navigate through their resource files, access documentation easily, and ensure code correctness by giving warnings. Why should you care? The language server will inform you about all sorts of problems: type mismatches, missing function arguments, missing variables, etc. You have access to a lot of MTA syntax/autocomplete out of the box. The syntax information will remain while writing. You do not have to restart your resource so often in order to validate if everything is working. Type validation Having value type validation in your code editor is one of the main key features of the Lua Language Server. When working with variables, parameters, and arguments in Lua, you are not restricted to specific value types. This flexibility can make mistakes more likely to happen. However, being able to validate those mistakes instantly saves you a lot of time and frustration. Type annotations for your own functions Adding type annotations to your own functions can help improve validation and catch logic mistakes. It is particularly useful when calling functions from different parts of your code, as the annotations provide clarity on the expected input (arguments) and output (return values). Additionally, comments that are placed above or adjacent to a variable or function are visible when hovering over them in another file or line. This can provide helpful information and context when working with the code. How that looks like: How can I quickly add annotations in less than a second? Open the spoiler: AddEventHandler auto-complete Most MTA addEventHandler functions have full eventName autocompletion. And the attached anonymous function is fully autocompleted and typed as well. Navigation features of Lua Language Server It can be time consuming to find out where a (global) function or variable is located. Being able to jump right to it, saves you a lot of time. Other information which you can find in the readme Installation for the Lua Language Server How to use the definition files? Known issues Make sure to always have an empty new line at the end of your files, as recommended in this issue. Currently, the Lua server language definition files do not have a clear separation between serverside functions/events and clientside functions/events. However, it is possible to enforce this separation for specific functions if needed. outputChatBox--[[@as outputChatBox_server]]("Serverside", player) In certain cases, certain functions in the Lua server language definition files may return multiple types, even if you have selected a different syntax. To handle this situation, you can use the `cast` or `as` notation to explicitly specify the desired type or adjust the returned type. See `Casting and as` syntax below. Casting and as In certain situations, you may have a strong understanding of the type(s) that a variable or expression will have. This is where the keywords "cast" and "as" come into play. These keywords enable you to explicitly specify the intended type, ensuring proper type handling. local varName = exampleFunc() ---@cast varName string local varName = exampleFunc() ---@cast varName string | number local varName = exampleFunc() --[[@as string]] local varName = exampleFunc() --[[@as string | number]] Download The definition files can be downloaded here.
  13. function Hud_() local colete = math.floor (getPedArmor (getLocalPlayer())); dxDrawImageSection(653, 354, 51, 51, 0, 0, 51, 51, 'assets/Circle.png', 360/100 * colete, 0, 0, tocolor(21, 4, 252, 255), false) end; addEventHandler('onClientRender', root, Hud_)
  14. can somebody help me fix this issue its says the issue is in the 1256 line but i cant solve that [FACTION]\btc_dashboard\exServer.lua:1256: Bad argument @ 'dbExec' [Expected db-connection at argument 1, got nil] addEvent("savePayTime",true) addEventHandler("savePayTime",getRootElement(),function(player) dbExec(connection,"UPDATE characters SET fizuTime = ? WHERE id = ?",getElementData(player,"fizuTime"),getElementData(player,"acc:id")) end)
  15. Hello Forum! I need yor help I am just starting to learn programming in Lua, there are not many guides, so I turn to you. I wrote my own passport emulation, but I don't understand how I can put the entered data into the database. Below I will attach my code. Also, I would be happy if you could help me and tell me how I can add the display of this "passport" when entering a marker using addEventHendler. Thank you in advance! My code local dgs = exports.dgs local sw,sh = guiGetScreenSize() -- разрешение экрана игрока local px,py = sw/1920,sh/1080 -- адаптация экрана local window = dgs:dgsCreateWindow(((sw-800)/2)*px,((sh-600)/2)*py,800*px,600*py,"Паспорт",false) local buttonExecute = dgs:dgsCreateButton(325*px,530*py,150*px,40*py,"Подтвердить",false,window,nil,nil,nil,nil,nil,nil,tocolor(255,0,0),tocolor(100,0,0),tocolor(255,0,0)) local labelFirstName = dgs:dgsCreateLabel(200*px,200*py,400*px,30*py," Имя: ",false,window) local editFirstName = dgs:dgsCreateEdit(200*px,220*py,400*px,30*py,"",false,window,tocolor(255,255,255),nil,nil,nil) dgs:dgsSetProperty(labelFirstName,"alignment",{"center"}, {"center"}) dgs:dgsSetProperty(editFirstName,"alignment",{"center"}, {"center"}) local labelLastName = dgs:dgsCreateLabel(200*px,270*py,400*px,30*py," Фамилия: ",false,window) local editLastName = dgs:dgsCreateEdit(200*px,290*py,400*px,30*py,"",false,window,tocolor(255,255,255),nil,nil,nil) dgs:dgsSetProperty(labelLastName,"alignment",{"center"}, {"center"}) dgs:dgsSetProperty(editLastName,"alignment",{"center"}, {"center"}) local labelAge = dgs:dgsCreateLabel(200*px,340*py,400*px,30*py," Возраст: ",false,window,tocolor(255,255,255),nil,nil,nil) local editAge = dgs:dgsCreateEdit(200*px,360*py,400*px,30*py,"",false,window) dgs:dgsSetProperty(labelAge,"alignment",{"center"}, {"center"}) dgs:dgsSetProperty(editAge,"alignment",{"center"}, {"center"}) local labelCountry = dgs:dgsCreateLabel(200*px,410*py,400*px,30*py," Страна: ",false,window,tocolor(255,255,255),nil,nil,nil,tocolor(100,100,100,100)) local editCountry = dgs:dgsCreateEdit(200*px,430*py,400*px,30*py,"",false,window) dgs:dgsSetProperty(labelCountry,"alignment",{"center"}, {"center"}) dgs:dgsSetProperty(editCountry,"alignment",{"center"}, {"center"}) dgs:dgsWindowSetMovable(window,false) dgs:dgsWindowSetSizable(window,false) dgs:dgsWindowSetCloseButtonEnabled(window,false) dgs:dgsSetVisible(window,true) dgs:dgsSetVisible(window,true) showCursor(true) function openPanel() dgs:dgsSetVisible(window,true) showCursor(true) end function colsePanel() dgs:dgsSetVisible(window,false) showCursor(false) end local currentChose = "register" addEventHandler("onDgsMouseClick",root,function(btn,state) if btn == "left" and state == "down" then if source == buttonExecute then local firstName = dgs:dgsGetText(editFirstName) local lastName = dgs:dgsGetText(editLastName) local age = dgs:dgsGetText(editAge) local country = dgs:dgsGetText(editCountry) if not string.find(firstName,"%S") then outputChatBox("Name") return end if not string.find(lastName,"%S") then outputChatBox("LastName") return end if not string.find(age,"%d") then outputChatBox("Age") return end if not string.find(country,"%S") then outputChatBox("Country") return end triggerServerEvent("playerPassportEnter",localPlayer,firstName,lastName,age,country) end end end) If you do help me, please write this with explanations, thank you in advance! I LOVE YOU FORUM
  16. se busca scripters para este servidor que sepa programar en lua de forma voluntaria si quiere puede unirse al proyecto estamos con la gamemode de chicago roleplay / pop life / life stealh roleplay son de la misma base las 3 se maneja algo similar por lo que tengo entendido el que este interesado entre al servidor de discord, verifiquense y abran un ticket para hablarme de forma privada adamas buscamos nuevos usuarios que sean activos para poder poner en pie el servidor, gracias. Discord: https://discord.gg/Ecjn6AyUQN
  17. se busca scripters para este servidor que sepa programar en lua de forma voluntaria si quiere puede unirse al proyecto estamos con la gamemode de chicago roleplay / pop life / life stealh roleplay son de la misma base las 3 se maneja algo similar por lo que tengo entendido el que este interesado entre al servidor de discord, verifiquense y abran un ticket para hablarme de forma privada adamas buscamos nuevos usuarios que sean activos para poder poner en pie el servidor, gracias. Discord: https://discord.gg/Ecjn6AyUQN
  18. Hello everyone, i was wondering if there's a way to make some models exceptions on this code, that is supposed to delete all GTA default models but i need the ints to not be deleted so i want to know how can i make exceptions for some interior models.. addEventHandler("onResourceStart", resourceRoot, function() for i=550, 20000 do removeWorldModel(i, 10000, 0, 0, 0) setOcclusionsEnabled(false) end end)
  19. Hello guys, does anyone have an idea how to send Lua values to JavaScript to display them in the game, or for example, to show a list of players or run a JavaScript function?
  20. I made a hud but it has a bug. For those who register and login, setElementData is not set. How to fix it ? If the resource is restarted, the element data will be set and saved in the account data Server Side addEventHandler("onPlayerQuit", root, function(type) if type == "Quit" then local health = getElementHealth(source) local armor = getPedArmor(source) local water = getElementData(source, "water") local food = getElementData(source, "food") local account = getPlayerAccount(source) setAccountData(account, "health", health) setAccountData(account, "armor", armor) setAccountData(account, "water", water) setAccountData(account, "food", food) end end) addEventHandler("onPlayerLogin", root, function(pa, ca) local account = getPlayerAccount(source) if not isGuestAccount(account) then local health = getAccountData(account, "health") local armor = getAccountData(account, "armor") local water = getAccountData(account, "water") local food = getAccountData(account, "food") setElementHealth(source, health) setPlayerArmor(source, armor) setElementData(source, "water", water) setElementData(source, "food", food) end end) function drinkWater(player, price, size) if getPlayerMoney(player) < System.prices.food_price then outputChatBox("water cannot be given because you have no money", player, 255, 0, 0) else if getElementData(player, "water") >= 95 then outputChatBox("You can't get more food because your stomach is full!", player, 255, 0, 0) else setElementData(player, "water", getElementData(player, "water") + 20) takePlayerMoney(player, System.prices.water_price) triggerClientEvent(player, "drinking", player) end end end function eatFood(player, price, size) if getPlayerMoney(player) < System.prices.water_price then outputChatBox("Food cannot be given because you have no money", player, 255, 0, 0) else if getElementData(player, "food") >= 95 then outputChatBox("You can't get more food because your stomach is full!", player, 255, 0, 0) else setElementData(player, "food", getElementData(player, "food") + 20) takePlayerMoney(player, System.prices.food_price) triggerClientEvent(player, "eating", player) end end end addEventHandler("onPlayerWasted", root, function() setElementData(source, "water", 50) setElementData(source, "food", 50) end) addEvent("fireStop", true) addEventHandler("fireStop", root, function(player) toggleControl(player, "fire", false) end) addEvent("fireStart", true) addEventHandler("fireStart", root, function(player) toggleControl(player, "fire", true) end) addEvent("runStop", true) addEventHandler("runStop", root, function(player) toggleControl(player, "sprint", false) end) addEvent("runStart", true) addEventHandler("runStart", root, function(player) toggleControl(player, "sprint", true) end) Client Side local screenW, screenH = guiGetScreenSize() setElementData(localPlayer, "water", 100) setElementData(localPlayer, "food", 100) showPlayerHudComponent("health", false) showPlayerHudComponent("armour", false) showPlayerHudComponent("money", false) showPlayerHudComponent("ammo", false) showPlayerHudComponent("weapon", false) showPlayerHudComponent("clock", false) function render() health = getElementHealth(localPlayer) armor = getPedArmor(localPlayer) water = getElementData(localPlayer, "water") food = getElementData(localPlayer, "food") money = getPlayerMoney(localPlayer) time = getRealTime() hour = time.hour minute = time.minute second = time.second weaponID = getPlayerWeapon(localPlayer) weaponName = getWeaponNameFromID(weaponID) ammo = getPedAmmoInClip(localPlayer) allammo = getPedTotalAmmo(localPlayer) -- health dxDrawCircle((screenW - 225), (screenH / 5000 + 30), 25, -270,(health * 3.6 - 270), tocolor(0, 255, 0), 30) -- health line dxDrawCircle((screenW - 225), (screenH / 5000 + 30), 18, 0, 360, tocolor(26, 26, 26)) -- black circle dxDrawImage((screenW - 225) - (27 / 2), (screenH / 300 + 15), 27, 27, "assets/icons/heart.png") -- health icon -- armor dxDrawCircle((screenW - 160), (screenH / 5000 + 30), 25, -270,(armor * 3.6 - 270), tocolor(194, 194, 194), 30) -- armor line dxDrawCircle((screenW - 160), (screenH / 5000 + 30), 18, 0, 360, tocolor(26, 26, 26)) -- black circle dxDrawImage((screenW - 160) - (27 / 2), (screenH / 300 + 16), 27, 27, "assets/icons/armor.png") -- armor icon -- water dxDrawCircle((screenW - 95), (screenH / 5000 + 30), 25, -270,(water * 3.6 - 270), tocolor(10, 252, 236), 30) -- water line dxDrawCircle((screenW - 95), (screenH / 5000 + 30), 18, 0, 360, tocolor(26, 26, 26)) -- black circle dxDrawImage((screenW - 95) - (20 / 2), (screenH / 300 + 12), 20, 30, "assets/icons/water.png") -- water icon -- food dxDrawCircle((screenW - 30), (screenH / 5000 + 30), 25, -270,(food * 3.6 - 270), tocolor(209, 102, 8), 30) -- food line dxDrawCircle((screenW - 30), (screenH / 5000 + 30), 18, 0, 360, tocolor(26, 26, 26)) -- black circle dxDrawImage((screenW - 28) - (27 / 2), (screenH / 300 + 13), 27, 27, "assets/icons/food.png") -- food icon --background dxDrawRectangle((screenW - 235), (screenH / 5000 + 62), 260, 50, tocolor(23, 23, 23, 230)) dxDrawCircle((screenW - 235), (screenH / 5000 + 87), 25, -90, -270, tocolor(23, 23, 23, 230)) -- money dxDrawText("MONEY: $"..money, (screenW - 203), (screenH / 5000 + 70), 20, 20 , tocolor(0, 186, 43), 0.5, "bankgothic") -- real time dxDrawText(string.format("TIME: %02d:%02d:%02d", hour,minute,second), (screenW - 200), (screenH / 5000 + 90), 20, 20 , tocolor(166, 166, 166), 0.5, "bankgothic") -- weapons if weaponID ~= 0 then dxDrawRectangle((screenW - 235), (screenH / 5000 + 120), 260, 25, tocolor(23, 23, 23, 230)) dxDrawCircle((screenW - 235), (screenH / 5000 + 132.5), 12, -90, -270, tocolor(23, 23, 23, 230)) dxDrawText(weaponName.." | "..ammo.." | "..allammo, (screenW - 203), (screenH / 5000 + 125), 20, 20 , tocolor(237, 186, 0), 0.5, "bankgothic") end if (food <= 2) then triggerServerEvent("fireStop", resourceRoot, localPlayer) else triggerServerEvent("fireStart", resourceRoot, localPlayer) end if (water <= 2) then triggerServerEvent("runStop", resourceRoot, localPlayer) else triggerServerEvent("runStart", resourceRoot, localPlayer) end end addEventHandler("onClientRender", root, render) setTimer(function(player) if (getElementData(localPlayer, "water") <= 2) then return else setElementData(localPlayer, "water", getElementData(localPlayer, "water") - 1) end end, System.decrease.water, 0) setTimer(function(player) if (getElementData(localPlayer, "food") <= 2) then return else setElementData(localPlayer, "food", getElementData(localPlayer, "food") - 1) end end, System.decrease.food, 0)
  21. what is problem this code ? gate = createObject(980, 364.82147, 186.89452, 1019.98438) setElementInterior(gate, 3) bombMarker = createMarker(364.70267, 186.29311, 1019.98438 -0.5, "cylinder", 1, 255, 0, 0) setElementInterior(bombMarker, 3) addEventHandler("onMarkerHit", bombMarker, function(player) outputChatBox("ugh!") end)
  22. Why is outPutChatBox saying false instead of 1 ? What I need is to get the outPutChatBox as 1 marker = createMarker(2093.75464, -1948.29468, 13.54688, "cylinder", 1) addEventHandler("onClientMarkerHit", marker, function(player) setElementData(player, "item", 1) outputChatBox("hitted") end) addEventHandler("onClientRender", root, function(player) count = tostring(getElementData(player, "item")) outputChatBox(count) end)
  23. Why doesn't the vehicle destroy when the player disconnects ? marker = createMarker(2169.62500, -1983.23706, 13.55469, "cylinder", 1) vehicles = {} addEventHandler("onMarkerHit", marker, function(player) vehicles[player] = createVehicle(408, 2169.62500 + 3, -1983.23706, 13.55469) end) addEventHandler("onPlayerQuit", root, function(type) if (type == "Quit") then destroyElement(vehicles[player]) end end)
  24. This is a dirt job script I'm currently working on... There's a bug here, why isn't the marker destroyed when the player exits the vehicle? client side -- client side local screenW, screenH = guiGetScreenSize() local w, h = 400, 330 local jobMarker = createMarker(-1895.57104, -1660.41797, 22.11562, "cylinder", 1.0, 0, 255, 0) local window setMoonSize(1000) function getJob(player, matchingDeminsion) if player == localPlayer and matchingDeminsion then if not isPedInVehicle(player) then if isPedOnGround(player) then if not (window) then window = guiCreateWindow((screenW / 2) - (w / 2), (screenH / 2) - (h / 2), w, h, "garbage job", false) memo = guiCreateMemo(0, 30, w, 200, "this is garbage job!", false, window) guiMemoIsReadOnly(memo) accept = guiCreateButton(0, 290, 100, 40, "Accept", false, window) leave = guiCreateButton(130, 290, 100, 40, "Leave Job", false, window) close = guiCreateButton(250, 290, 100, 40, "Close", false, window) showCursor(true) else guiSetVisible(window, false) window = nil showCursor(false) end end end end end addEventHandler("onClientMarkerHit", jobMarker, getJob) function clicks() if (source == accept) then guiSetVisible(window, false) window = nil showCursor(false) triggerServerEvent("acceptJob", resourceRoot, localPlayer) elseif (source == leave) then guiSetVisible(window, false) window = nil showCursor(false) triggerServerEvent("leaveJob", resourceRoot, localPlayer) elseif (source == close) then guiSetVisible(window, false) window = nil showCursor(false) end end addEventHandler("onClientGUIClick", root, clicks) Server side -- server side addEventHandler("onResourceStart", root, function() team = createTeam("garbage", 0, 255, 0) end) addEvent("acceptJob", true) addEvent("leaveJob", true) function checkAccept(player) -- [accept job function] if (getElementData(player, "Jobs") == "garbage") then outputChatBox("you have alrady garbage job sorry!", player, 255, 0, 0) else setElementData(player, "Jobs", "garbage") setElementData(player, "trashlocation", 0) outputChatBox("job accept successfully!", player, 0, 255, 0) startJob(player) if (team) then setPlayerTeam(player, team) end end end addEventHandler("acceptJob", root, checkAccept) vehicles = { [408] = true } garbages = { [1] = {-1881.14380, -1707.47888, 21.75000}, [2] = {-1885.83081, -1723.84656, 21.75641}, [3] = {-1896.03723, -1731.46301, 21.75000}, [4] = {-1908.80933, -1733.61536, 21.75000}, [5] = {-1930.82690, -1767.77832, 26.18353}, [6] = {-1938.78809, -1781.46545, 29.32999}, [7] = {-1936.23059, -1760.15820, 24.36698}, [8] = {-1935.32361, -1742.58679, 22.91065}, [9] = {-1935.62610, -1719.10291, 21.75000}, [10] = {-1921.58350, -1706.34143, 21.90317}, [11] = {-1902.96033, -1704.98352, 21.75000} } function pickUpLocation(player, id) local x, y, z = garbages[id][1],garbages[id][2],garbages[id][3] local marker = createMarker(x, y, z, "cylinder", 3.0) -- <<<<<< Marker is here addEventHandler("onMarkerHit", marker, function(player) if getElementModel(getPedOccupiedVehicle(player)) == 408 then destroyElement(marker) marker = nil outputChatBox("hitted") setElementData(player, "trashlocation", getElementData(player, "trashlocation")+1) newLocation = getElementData(player, "trashlocation") pickUpLocation(player, newLocation) end end) end addEventHandler("onPlayerVehicleEnter", root, function(vehicle, seat, jacked) --[on player vehicle enter] if (vehicles[getElementModel(vehicle)]) and (getElementData(source, "Jobs") ~= "garbage") then removePedFromVehicle(source) x, y, z = getElementPosition(source) setElementPosition(source, x+1, y, z) outputChatBox("You don't have a garbage job", player, 255, 0, 0) end end) addEventHandler("onPlayerVehicleExit", root, function(vehicle, seat, jeacked) --[on player vehicle exit] if (getElementData(source, "Jobs") == "garbage") then if (getElementModel(vehicle) == 408) then outputChatBox("exited") setElementData(source, "Jobs", nil) destroyElement(marker) -- <<<<<<< problem is ehere end end end) trashVehicles = {} trashVehiclesBlips = {} function startJob(player) trashVehicle = createVehicle(408, -1879.74951, -1672.44751, 21.75000, 0, 0, 180) trashVehicleBlip = createBlipAttachedTo(trashVehicle, 51) trashVehicles[player] = trashVehicle trashVehiclesBlips[player] = trashVehicleBlip function checkVehicle(player) local vehicle = getPedOccupiedVehicle(source) local vehicleId = getElementModel(vehicle) outputChatBox(vehicleId) if (vehicleId == 408) then pickUpLocation(player, 1) setElementData(player, "trashlocation", 1) end end addEventHandler("onPlayerVehicleEnter", root, checkVehicle) end function leave(player)-- [leave job function] setElementData(player, "Jobs", nil) setPlayerTeam(player, nil) outputChatBox("leave successfully garbage job!", player, 255, 255, 0) end addEventHandler("leaveJob", root, leave)
×
×
  • Create New...