-
Posts
3,875 -
Joined
-
Days Won
67
Everything posted by DNL291
-
Try this: local screenW,screenH = guiGetScreenSize() local resW,resH = 1280,720 local sW,sH = (screenW/resW), (screenH/resH) local maxHealth = getPedMaxHealth(localPlayer) local Health = getElementHealth (localPlayer) local maxH = 138 local barY = 559.2 * sH local barHeight = ((maxH * sH) /maxHealth) * Health dxDrawRectangle(40*sW, barY, 11*sW, maxH*sH, tocolor(0, 0, 0, 80)) dxDrawRectangle(40*sW, barY + (maxH-barHeight), 11*sW, barHeight, tocolor(0, 255, 0, 240)) -- function getPedMaxHealth(ped) -- Output an error and stop executing the function if the argument is not valid assert(isElement(ped) and (getElementType(ped) == "ped" or getElementType(ped) == "player"), "Bad argument @ 'getPedMaxHealth' [Expected ped/player at argument 1, got " .. tostring(ped) .. "]") -- Grab his player health stat. local stat = getPedStat(ped, 24) -- Do a linear interpolation to get how many health a ped can have. -- Assumes: 100 health = 569 stat, 200 health = 1000 stat. local maxhealth = 100 + (stat - 569) / 4.31 -- Return the max health. Make sure it can't be below 1 return math.max(1, maxhealth) end
-
dxDrawText("R$: "..convertNumber(money), x*0.835, y*0.150, x*800, y*030, tocolor(255, 255, 255,255), 0.7, "bankgothic", "left", "top", false, false, true, false, false) function convertNumber ( number ) local formatted = number while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if ( k==0 ) then break end end return formatted end P.S: 'money' must be defined.
-
Use this function: https://wiki.multitheftauto.com/wiki/GetPedMaxHealth If you have any problem with it just post here.
-
You're welcome.
-
I haven't tested this, try: local coloredText = {} coloredText.color = { math.random(255), math.random(255), math.random(255) } local chgColorTime = 600 addEventHandler( "onClientResourceStart", resourceRoot, function() coloredText.startTick = getTickCount() addEventHandler("onClientRender", root, renderText) end ) function renderText() local elapsedTime = getTickCount() - coloredText.startTick local tColor = coloredText.color if elapsedTime >= chgColorTime then tColor[1], tColor[2], tColor[3] = math.random(255), math.random(255), math.random(255) coloredText.startTick = getTickCount() end local red, green, blue = unpack(tColor) dxDrawText("Text in DX", x*850, y*190, x*800, y*030, tocolor(red, green, blue, 255), 1.1, "default-bold", "left", "top", false, false, true) end
-
Olá a todos, Só para deixá-los informado, não abrimos o servidor na data mencionada devido a problemas com hospedagem. No entanto, já temos uma temporária. Mas ainda não vamos abrir o servidor ao público, até que sejam terminados alguns recursos. O mais breve possível vou postar aqui algum vídeo sobre script(s) que estou fazendo para o servidor.
-
addCommandHandler( "setpaintjob", function (player, cmdName, id) local veh = getPedOccupiedVehicle(player) if veh and (id >= 0 and id <= 3) then if setVehiclePaintjob(veh, id) then outputChatBox("Você mudou a pintura do seu veículo", player) end end end, false, false ) Se for via comando só usar isso.
-
https://forum.multitheftauto.com/viewtopic.php?f=108&t=40793
-
local tMonths = { [0] = "January", [1] = "February", [2] = "March", [3] = "April", [4] = "May", [5] = "June", [6] = "July", [7] = "August", [8] = "September", [9] = "October", [10] = "November", [11] = "December" } function getMonth() local month = getRealTime()["month"] return tMonths[month] end dxDrawText("#ff8800"..getMonth(),0,110,screenWidth,screenHeight,tocolor(0,0,0,alpha),2,"default-bold","center","top",false,false,true,true)
-
You can use this function: assert
-
If you just used the code to get the previous and the next weapon which I gave you in another thread, then nevermind it. I couldn't see the whole source code because it's compiled and had similar things with a hud I did. No need for more discussions about it, though.
-
Good job! Looks good and original.
-
Try this: addEventHandler('onPlayerChat', getRootElement(), function(msg, type) if type == 2 then cancelEvent() local playerTeam = getPlayerTeam(source) if playerTeam then local r, g, b = getTeamColor(playerTeam) local hexColor = string.format("#%.2X%.2X%.2X", r, g, b) else return end for placeNumber, playerData in ipairs(getPlayersInTeam(playerTeam)) do outputChatBox("#00FF00(CLAN)"..hexColor .. getPlayerName(source)..":#FFFFFF "..msg:gsub("#%x%x%x%x%x%x", ""), playerData, r, g, b, true) end end end )
-
Yes. You can find the sound you want to disable, by using setDevelopmentMode(true) in console (runcode resource must to be running), and then use the command showsound.
-
If you want to replace the GTA original sounds, use these functions: setWorldSoundEnabled playSound/playSound3D stopSound
-
Você poderia ter explicado sobre cada argumento usado na função interpolateBetween (px, py, pz, a, b, c, progreso), acho que iria acrescentar muito mais ao tutorial. Seria bem útil também, deixar comentários pelo código. No entanto, achei uma ótima iniciativa e espero que você possa melhorá-lo para que as pessoas possam aprender sobre isso.
-
Your code has an extra 'end' at line 23.
-
No, the images is still without a parent element since it's being created out of the window, which means that skillWindow is returning nil. Ah, didn't realize it. By the way, i've tested my code and it works fine.
-
Because skillWindow is returning nil in the table you created. Try this: data = {} local back = {} addEventHandler("onClientResourceStart", resourceRoot, function() skillWindow = guiCreateWindow(369, 143, 570, 418, "test", false) data.background = { {10, 54, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 105, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 156, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 207, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 258, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 309, 550, 41, ":test/Adsiz.png", false, skillWindow}, {10, 360, 550, 41, ":test/Adsiz.png", false, skillWindow} } guiWindowSetSizable(skillWindow, false) guiSetAlpha(skillWindow, 0.85) for i, v in ipairs(data.background) do back[i] = guiCreateStaticImage(unpack(v)) end end) Well, from what i see it looks the same code that AbaZaSiRiN00 posted.
-
onResourceStart has no 'player' parameter. Actually, the first parameter is the started resource.
-
Pela data do post, não acredito que o autor ainda esteja a procura de um scripter.
-
Se o código for do lado server, use a função setElementVisibleTo e deixe visível apenas para o jogador do emprego.
-
[SOLUTION] Dns and IP - MTA:SA 1.4.1
DNL291 replied to #RooTs's topic in Site/Forum/Discord/Mantis/Wiki related
Yes, is that what I was thinking. And even someone who doesn't know about it, he can easily learn it by searching on internet. -
Introdução Há alguns meses atrás decidimos criar uma comunidade que, inicialmente, visa o desenvolvimento de 3 gamemodes, sendo eles: um gamemode RPG, um Race e outro DayZ. Mas isto, para ser franco, não vai acontecer se houver apenas 1 programador e mais outra pessoa no grupo. Portanto, com o servidor RPG mais avançado, decidimos colocar nosso foco apenas neste Gamemode até que seja terminado. Para então, podermos pensar no desenvolvimento de um segundo. Sobre o servidor Nosso servidor terá uma grande variedade de recursos originais, visando uma boa jogabilidade e suporte para os jogadores. Também vamos dar grande atenção para correções de bugs e idéias para a melhora do servidor. Além de uma boa Staff que saiba tratar os jogadores. O desenvolvimento do servidor ainda está em progresso, mas a parte básica acredito estar quase completa. Ainda precisamos de membros para nossa equipe. O necessário, no entanto, é para a moderação no servidor. Não temos uma data fixa para o lançamento do servidor. Os recursos que o servidor oferece Apesar de ser um servidor feito do zero, iremos usar alguns scripts públicos enquanto são feitos nossos próprios scripts. Vamos tentar deixar o servidor o mais completo que pudermos, obviamente, requer tempo para isso. Não vou listar os recursos que têm no servidor por enquanto. Aqui estão algumas imagens do servidor Visite nosso fórum: forum.striking-games.org