![](https://forum.multitheftauto.com/uploads/set_resources_22/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
Karuzo
Members-
Posts
1,213 -
Joined
-
Last visited
Everything posted by Karuzo
-
Hey Guys, I have a serious problem with mta and idk how to solve this. I have to set my name my binds , settings etc everytime i open MTA. It just doesn't save anything. It doesn't crash either. I just close it normally. I hope you can help me.
-
Both, if i understand you right.
-
I don't really know if there is smth like that but i guess this might help you: https://bugs.multitheftauto.com/changelog_page.php
-
function getAbsoluteFromRelative(rx,ry) local x,y = guiGetScreenSize() return rx*x,ry*y end
-
For some reason your method didn't work,Saml1er. But Bonsais did. Thanks guys.
-
Hey Guys, How can i remove/delete datas in a table if i have named my tables with strings and not with numbers like: dxElements.statisticsgrid.player.veh So my question is can i remove everything which is in that dxElements.statisticsgrid.player table in a for-loop ? like: for i,v in ipairs(dxElements.statisticsgrid.player) do dxElements.statisticsgrid.player.i = nil end ^This will only work if i would use numbers and not strings, so what can i do ?
-
Ah yeah, that i didn't come up with this idea Thanks.
-
Hey Guys, I wanted to ask if there is a possibility to check if a text from an edit box is a number and not a string. But as guiGetText retursn the text as a string idk how to solve this. I think i could do it with a table which is filled with numbers and check if its a number. But is there no other way to do this?
-
Fake: https://community.multitheftauto.com/index.php?p= ... ls&id=9869 Original: http://www.mta-sa.org/index.php?page=Th ... 1&pageNo=1 (Only images were replaced) DONE
-
oops. didn't noticed that For all who need it: function getVehicleRPM(vehicle) if not vehicle then return "0" end local currentGearSpeed if getVehicleEngineState(vehicle) == false then return "0" end local speedx, speedy, speedz = getElementVelocity(vehicle) local actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) local kmh = actualspeed * 180 local gear = getVehicleCurrentGear(vehicle) local handling = getVehicleHandling(vehicle) local acceleration = handling["engineAcceleration"] local maxSpeed = handling["maxVelocity"] local gears = handling["numberOfGears"] local gearSpeed = maxSpeed/gears local currentGearSpeed = 0 if not (gear == 0) then currentGearSpeed = kmh/gear end local gearDiff = gearSpeed - currentGearSpeed if currentGearSpeed > gearSpeed then gearDiff = 1 end local RPM = math.ceil( (maxSpeed/gearDiff)*100)*3 return RPM end
-
Hey guys, I use a useful function to get the actual rpm of a car and it always returns me -1.#ND if I pressed S one time (it's in the reverse gear). Idk why and i don't really know how to fix this. If anybody could help me , that would be great. here's my code: function getVehicleRPM(vehicle) if not vehicle then return "0" end if getVehicleEngineState(vehicle) == false then return "0" end local speedx, speedy, speedz = getElementVelocity(vehicle) local actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) local kmh = actualspeed * 180 local gear = getVehicleCurrentGear(vehicle) local handling = getVehicleHandling(vehicle) local acceleration = handling["engineAcceleration"] local maxSpeed = handling["maxVelocity"] local gears = handling["numberOfGears"] local gearSpeed = maxSpeed/gears local currentGearSpeed = kmh/gear local gearDiff = gearSpeed - currentGearSpeed if currentGearSpeed > gearSpeed then gearDiff = 1 end local RPM = math.ceil( (maxSpeed/gearDiff)*100)*3 return RPM end
-
ah yeah now it works. ty
-
Hey Guys, I have an awkward problem with rendertargets that they are black if i minimize mta and open it back. Idk if this is a bug caused by mta or my code. has anyone experiences with this?
-
Show us the full code.
-
local text = guiGetText(youreditbox) triggerServerEvent("Login",localPlayer,text)
-
Hey Guys, It's me again. Idk what's going on with me but i have problems on the easiest things lol. So this is my problem: I would like to interpolate the picture in and out, in works but out doesn't. It always dissappears right after the click(tho it shouldn't do that.) My Code: local x, y = guiGetScreenSize() local w,h = 400,600 local px, py = x/2-w/2,y/1.5-h/1.5 local data = {} --this is interpolating the rendertarget in. local now = getTickCount() local elapsedTime = now - data.openTick local duration = data.endStarTime - data.openTick local progress = elapsedTime / duration intx,inty = interpolateBetween(px-150,y,0,px,py,0,progress,data.easingType) dxDrawImage(intx, inty, w, h, data.renderTarget, 0, 0, 0, tocolor(255, 255, 255, 255), false) end end function renderout() --and this is interpolating out local now = getTickCount() local elapsedTime = now - data.endTime local duration = data.endTime - data.outTick local progress = elapsedTime / duration intx,inty = interpolateBetween(px,py,0,px-150,py-150,0,progress,data.easingType) if now >= data.endTime then removeEventHandler("onClientRender", root, renderout) removeEventHandler("onClientRender", root, render) outputChatBox("out")--it outputs out but the picture/event handler was already removed. end end bindKey(data.keyToOpen,data.keyState, function() data.open = not data.open showCursor(data.open) if data.open then addEventHandler("onClientRender",root,render) data.openTick = getTickCount() data.endStarTime = data.openTick + 2000 else data.outTick = getTickCount() data.endTime = data.outTick + 2000 addEventHandler("onClientRender",root,renderout) end end )
-
Huh yeah was that easy, idk why i didn't come up to this. Thanks
-
I know that. That's why i'm asking how i can calculate that position.
-
Why not ? lol It's easier to work with.
-
not needed sQlLite it hard for him ... use SQL it izi for him .. or Account data very izi Are you serious? It's exactly the same.
-
Hey Guys, I'm working on my phone script and i got some problems with checking the cursor position. It always draws the rectangle on the wrong cursor position. I want that the rectangle shows up when i'm over the image. But it shows up if i'm near the chat. Dunno why. Screen: My Code: local x, y = guiGetScreenSize() local w,h = 400,600 local px, py = x/2-w/2,y/1.5-h/1.5 data.renderTarget = dxCreateRenderTarget(w, h, true) function render() if data.open then dxSetRenderTarget(data.renderTarget) -- draw render dxDrawImage(0,0, w, h, "m7render.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) -- Background dxDrawText(data.network, 75, 70, x, y, tocolor(254, 254, 254, 255), 1, "default-bold", "left", "top", false, false, false, false, false) -- network dxDrawText(data.batterycharge.." %", 400, 10, x, y, tocolor(254, 254, 254, 255), 1.10, "default-bold", "right", "top", false, false, false, false, false) -- batterycharge dxDrawText(("%s:%s Clock"):format(getRealTime().hour, getRealTime().minute), 200, 10, x, y, tocolor(255, 255, 255, 255), 1.00, "default-bld", "center", "center", false, false, false, false, false) -- realtime -- draw apps for index, value in pairs ( data.apps ) do local name, line, row, icon = unpack(data.apps[index]) if isAppValid(name) and icon then dxDrawImage((30)+line*50,100+(row*50),64,64,icon,0,0,0,tocolor(255,255,255,255),false) outputChatBox(line.." "..row) if isMouseWithinRangeOf((30)+line*50,64,100+(row*50),64) then -- this is the part outputChatBox("lol rec") dxDrawRectangle((30)+line*50,100+(row*50),64,64,tocolor(255,255,255,255),false) end end end dxSetRenderTarget() dxDrawImage(px, py, w, h, data.renderTarget, 0, 0, 0, tocolor(255, 255, 255, 255), false) end end function getFreeAppPosition() for index, value in pairs ( data.apps ) do if index == #data.apps then local name, line, row, icon = unpack(data.apps[index]) if line < 4 then return ( (line or 0) + 1 ), ( (row or 0) ) elseif line == 4 then return ( 1 ), ( (row or 1) + 1 ) else return false end end end end function newApp(name, icon) if #data.apps < data.maxApps+1 then local line, row = getFreeAppPosition() table.insert(data.apps, {name, line, row, icon}) end end newApp("Settings", "settings.png") function isAppValid(name) if name ~= "placeholder" then return true else return false end end function isMouseWithinRangeOf(psx,pssx,psy,pssy) if isCursorShowing() == false then return false end local cx,cy = getCursorPosition() cx,cy = cx*x,cy*y if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then return true,cx,cy else return false end end