-
Posts
6,097 -
Joined
-
Last visited
-
Days Won
218
Everything posted by IIYAMA
-
Only one wheel is returned with getVehicleComponents
IIYAMA replied to Dzsozi (h03)'s topic in Scripting
You use the same key word for all the components as for only one component, and you do not index the components table. -
If you are a beginner. (which I do not know if you are) Then use downloadFile. https://wiki.multitheftauto.com/wiki/DownloadFile (there is an example in it, which shows you how to download a test.xml file)
-
Always a solution: Reduce elementdata updates. Every time you call setElementData(without disabling synchronization), it will send data. (even if the value is the same) I often see people do this: (clientside) addEventHandler("onClientRender", root, function () local data = "random data" setElementData(localPlayer, "key", data) end) He, Frame 1: please update (16 ms later) Frame 2: please update (16 ms later) Frame 3: please update (16 ms later) Etc. Not even a second has past and you almost requested 62 UPDATES! (not sure if there is elementdata reduction clientside, but I don't think so) Which is IDIOTIC! (for the ones who do this, please go in your microwave) Which should/could be done like this: addEventHandler("onClientRender", root, function () local data = "random data" if data ~= getElementData(localPlayer, "key") then setElementData(localPlayer, "key", data) end end) Or this: (serverside) -- element could be a team for key, data in ipairs(example) do setElementData(element, "score", getElementData(element, "score") + 1) end Updating the score to 20? = Tell all clients/players 20x > "I have grown 1 more!" Which is stupid. Should/could be done like this. local score = getElementData(element, "score") or 0 for key, data in ipairs(example) do score = score + 1 end setElementData(element, "score", score)
-
Because you have to adjust the max value for that. You could try something like this: local maxAmmoTable = {} -- function -- ... local weapon = getPedWeapon(localPlayer) local maxAmmo = maxAmmoTable[weapon] or 1 if AllAmmo > maxAmmo then maxAmmoTable[weapon] = AllAmmo end -- ... -- end -- reset addEventHandler("onClientPlayerWasted", localPlayer, function () maxAmmoTable = {} end)
-
-- clear those once you stop the timer it. local lastCheckTime local newStartTime -- -- function () -- ... if isVehicleOnGround(vehicle) then if getVehicleSpeed(vehicle) >= 10 then local currentTime if lastCheckTime then currentTime = lastCheckTime if not newStartTime then newStartTime = getTickCount() else currentTime = currentTime + (getTickCount() - newStartTime) end else currentTime = getTickCount() end if currentTime - lastTimeAdded[vehicle] >= 5000 then if someVariable < #someTable then someVariable = someVariable+1 lastTimeAdded[vehicle] = getTickCount() else someVariable = #someTable end end else lastCheckTime = getTickCount() end end -- ... -- end function
-
Try this. local maxAmmo = 1000 dxDrawRectangle (1701/x*jx, 65/y*jy, (math.min(AllAmmo, maxAmmo) / maxAmmo * 100)/x*jx, 8/y*jy, tocolor(227, 160, 93, 255)) -- this is useless unless you know what you are doing: local FullAmmoBar = The bar length is based on the value 100? Else you have to change the value 100 to the correct value.
-
show updated code.
-
local lastCheckTime -- function () -- ... if isVehicleOnGround(vehicle) then if getVehicleSpeed(vehicle) >= 10 then currentTime = lastCheckTime or getTickCount()-- if lastCheckTime is nil, then use the current tickCount if currentTime - lastTimeAdded[vehicle] >= 5000 then if someVariable < #someTable then someVariable = someVariable+1 lastTimeAdded[vehicle] = getTickCount() else someVariable = #someTable end end else lastCheckTime = getTickCount() end end -- ... -- end function
-
It is duplicated because of double loops. Just use one. --for i,item in ipairs(itemList) do for ki = iCurrentCell, iVisibleRows+iCurrentCell-1 do local visibleI = ki - iCurrentCell dxDrawRectangle(x*050+x*350, y*090+y*640/iRows*iCurrentCell, 5, y*640/iRows*iVisibleRows) local index = ki + 1 -- ki starts at 0, in lua we start with 1. local item = itemList[index] if item then dxDrawRectangle(x*060, y*100+visibleI*31, x*200, y*30, tocolor(0, 0, 0, 200), false) -- NOT AN ELEMENT: itemBackground = dxDrawText(item[1],x*070, y*107+visibleI*31, x*250, y*30,tocolor(255,255,255, 255)) --Problem is here :C dxDrawRectangle(x*265, y*100+visibleI*31, x*60, y*30, tocolor(0, 0, 0, 200), false) -- NOT AN ELEMENT: useBackground = dxDrawText("Text",x*282, y*107+visibleI*31, x*250, y*30,tocolor(255,255,255, 255)) -- NOT AN ELEMENT: useText = dxDrawRectangle(x*330, y*100+visibleI*31, x*60, y*30, tocolor(0, 0, 0, 200), false) -- NOT AN ELEMENT: dropBackground = dxDrawText("Text",x*347, y*107+visibleI*31, x*250, y*30,tocolor(255,255,255, 255)) -- NOT AN ELEMENT: dropText = if isCursorOverRectangle(x*060, y*100+visibleI*31, x*200, y*30) or isCursorOverRectangle(x*265, y*100+visibleI*31, x*60, y*30) or isCursorOverRectangle(x*330, y*100+visibleI*31, x*60, y*30) then dxDrawRectangle(x*060, y*100+visibleI*31, x*200, y*30, tocolor(0, 77, 126,20)) dxDrawRectangle(x*265, y*100+visibleI*31, x*60, y*30, tocolor(0, 77, 126,20)) dxDrawRectangle(x*330, y*100+visibleI*31, x*60, y*30, tocolor(0, 77, 126,20)) end end end --end
-
local maxAmmo = 300 math.min(AllAmmo, maxAmmo)/x*jx
-
As I said in my previous post. You just asked the exact same question as in your first post.
-
Please read the > Note < again. It clearly says two lights for everything(except objects). And you can't attach them with the attachElements function, only with setElementPosition.
-
There is a light element, but will probably only give partly the results you want. Please read the notes: Note: The direction of the light only has any effect if the light type is spot light. One light will only apply illumination effects to peds, players, wheels and number plates (like a emergency vehicle siren light does). Two or more lights will apply illumination effects to everything (excluding objects) that is in range of, at least, two of them. https://wiki.multitheftauto.com/wiki/CreateLight <light posX="" posY="" posZ="" type="" radius="" color="" dirX="" dirY="" dirZ="" shadows="" />
-
Line 4 moveObject(sbarra, 4000, -1526.4400439453, 481.39999389648, 6.905, 0, -90, 0, 'InOutQuad') Line 10 moveObject(sbarra, -1526.4400439453, 481.39999389648, 6.905, 0, 90, 0, 'InOutQuad') You forgot to fill in the time.
-
You can run them normally. There is no other option. Compiled scripts require a decompiler (and a MTA decrypter) to read the file. LUA scripting been implemented at a level which is limited by a the security system which does not allow to access this. Please give up on trying to load MTA compiled scripts with LUA. (absolutely not going to working)
-
load/loadstring can indeed not load compiled scripts. Only pure uncompiled lua strings.
-
Not recommended, will also disable a lot of other effects.
-
Show me your code.
-
teaDecode will decode everything. Just it is looks like it is messed up if you changed it before decoding. The easiest way is to compare fileR with the original file. Or compare the file size.
-
No example required. You have to start making your code visible in order to understand it. Just fill up your entire code with debug lines. Run the code View in which order the lines show up. View the values of the variables. And you got your answer.
