-
Posts
6,058 -
Joined
-
Last visited
-
Days Won
208
Everything posted by IIYAMA
-
Basic example: (but doesn't work very well with multiple players, since serverside is 1 environment and clientside an environment per player) triggerServerEvent ( "setAmmo", resourceRoot, Ammo) addEvent("setAmmo", true) addEventHandler("setAmmo", resourceRoot, function (Ammo_) Ammo = Ammo_ end, false)
-
Not likely, since that only will work when there is an admin online which you can use as executor. https://wiki.multitheftauto.com/wiki/Element/Console It is better to solve that at the source: local console = getElementChildren ( root, "console")[1] addCommandHandler ( "somecommand", function ( playerSource, commandName ) if console == playerSource or --[[ ACL check]] then end end) Option A local console = getElementChildren ( root, "console")[1] if console == playerSource then end Option B if getElementType(playerSource) == "console" then end
-
I have uploaded an uncompiled version. Because compiled scripts are not healthy for developers. ?
- 14 replies
-
- 1
-
I have uploaded it to the community so that it is now better accessible for everybody. ? https://community.multitheftauto.com/index.php?p=resources&s=details&id=18170
- 28 replies
-
- 1
-
- trains
- not compiled
-
(and 2 more)
Tagged with:
-
That is not it. hmmm Maybe: testLineAgainstWater https://wiki.multitheftauto.com/wiki/TestLineAgainstWater
-
Either the anti cheat (DayZ) or a custom damage script (DayZ). Try to search for getPedOxygenLevel inside of all the scripts from DayZ. Or search for isElementInWater instead. And try to disable it there. With notepad++ you can search in directories instead of file by file. (But make sure to filter on .Lua files only, else you will also be searching inside of binary files like images and mods, which takes long...)
-
Not sure to be honest. 4 should be fine. If you run out of VRAM, it could be possible for the rendertarget to fail. Not sure what kind of hardware you use. iprint(dxGetStatus ().VideoMemoryFreeForMTA) https://wiki.multitheftauto.com/wiki/DxGetStatus Also checking for an texture memory leak isn't a bad idea. iprint(#getElementsByType("texture")) -- should be showing the total textures from all resources
-
As Bonsai said about creating it once. You currently have created a memory leak, which might play a role in this strange behaviour. A render target is an element, which is attached to the element tree, not just a value you can overwrite. In your case you might want to destroy it first, every time you display new top times (since your height is variable). if isElement(toptimesRT) then destroyElement(toptimesRT) end toptimesRT = dxCreateRenderTarget(sizeX,sizeY,true)
-
It is not possible when the vehicle is damageproof, unless you use events that are fired before the damage, like onClientPlayerWeaponFire and onClientVehicleCollision.
-
That condition you use inside of your loop is not very useful. All items have item text, even if they are empty. And your gridlist doesn't update, because you are not updating it with the right function. https://wiki.multitheftauto.com/wiki/GuiGridListSetItemText If you want to update just the label, that loop is not required. Make sure you save each sub table on to an item. Then you can get the selected item and get the data from it. https://wiki.multitheftauto.com/wiki/GuiGridListSetItemData https://wiki.multitheftauto.com/wiki/GuiGridListGetItemData
-
trigger Help with TriggerServerEvent Client/Server Not Working
IIYAMA replied to senior penguin's topic in Scripting
This looks like it is a leaked resource. If it is not, send me a pm with the link to the source for verification. Source verified: https://github.com/ESX-Org/esx_vehicleshop- 1 reply
-
- triggerserverevent
- help
- (and 5 more)
-
It is not as if players can download every file from the server. If they could, they would be able to steal all your stuff. You need to serve the file first with a webserver. Read: https://wiki.multitheftauto.com/wiki/Resource_Web_Access <html src="sound.mp3" raw="true" />
-
After you have set-up your meta table + overwrite exports. https://www.tutorialspoint.com/Lua/lua_metatables.htm --[[ ... ]] __index = function(mytable, key) local resource = getResourceFromName(key) if not resource then return false end return function (...) return call(resource, ...) end end --[[ ... ]] It is not 100% the same, but you got the idea.
-
You can also use call instead of exports. Which uses a static resource pointer that doesn't change when a resource restarts. Less fancy, I know. But you can use it to make a wrapper when you overwrite exports with a meta table.
-
getRealTime: https://wiki.multitheftauto.com/wiki/GetRealTime It returns by default the current date. timestamp can help you with calculate offset. Easy to use and no formatting required. local timestamp = getRealTime().timestamp -- seconds local days = 10 local futureTimestamp = timestamp + (60 * 60 * 24 * days) if timestamp >= futureTimestamp then end To get other date formats. Member Meaning Range second seconds after the minute 0-61* minute minutes after the hour 0-59 hour hours since midnight 0-23 monthday day of the month 1-31 month months since January 0-11 year years since 1900 weekday days since Sunday 0-6 yearday days since January 1 0-365 isdst Daylight Saving Time flag timestamp seconds since 1970 (Ignoring set timezone) local time = getRealTime() local hours = time.hour local minutes = time.minute These are the bricks you can use and the rest is up to your math skills.
-
Doesn't the event onClientKey detects hold? hmmm Well if it doesn't: local nextCharacterRemoveTime = 0 local characterRemoveInterval = 200 function checkCharacterRemove () if getKeyState ( "backspace" ) then -- https://wiki.multitheftauto.com/wiki/GetKeyState local timeNow = getTickCount() if timeNow > nextCharacterRemoveTime then nextCharacterRemoveTime = timeNow + characterRemoveInterval -- strip the string! end end end function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then for i, v in ipairs( aAttachedFunctions ) do if v == func then return true end end end end return false end local function backspacePress ( button, press ) if button == 'backspace' then if press then if not isEventHandlerAdded("onClientRender", root, checkCharacterRemove ) then addEventHandler("onClientRender", root, checkCharacterRemove) end elseif isEventHandlerAdded("onClientRender", root, checkCharacterRemove ) then removeEventHandler("onClientRender", root, checkCharacterRemove) end end end
-
local theString = "blabla1\blabla2" local words = split ( theString, 92) -- returns a table with all items split by \, which is ASCII code 92 iprint(unpack(words)) https://wiki.multitheftauto.com/wiki/Split https://wiki.multitheftauto.com/wiki/ASCII
-
You can use moveObject and fill in the strEasingType argument. If you want more customization, you need to spend more time on stuff like this: https://wiki.multitheftauto.com/wiki/Animate
-
That doesn't sounds right. Multi-line strings do generate "\n", for each new line, not just "\". What do you want to achieve?
-
Insert as in adding more words? local text = [[text]] text = text .. " is something ..." Your are using a multiline format, but it doesn't change the fact that it is still a string. The only difference about it, is that it automatic adds newlines. (and maybe some other stuff that I do not know about) local text1 = "text\ntext" print(text1) local text2 = [[text text]] print(text2)
-
just 100 accounts will not hurt very much. But at a given moment you probably see the performance de-increase because the search time increases. Some people say that accountData is slower in compare to SQL, but I never tested that. There is one thing to keep in mind and that is that account data doesn't allow you to use async methods. (Callback functions) Because of this limitations, you can't separate your MTA server process from the internal database. This means that for every (invisible) `database query` you fire, your scripts are frozen. When your database gets slower, your scripts will be directly affected by that. Anyway, I have no knowlegde about, if accountdata is using a memory buffer when a user has been login to speed up the requests. I hope it does, it could be a nice feature. yes, You can also use SQL, which doesn't require lot of work to make it work if you haven't set-up MySQL already.
-
Align the loading process with your FPS. Every time you load a mod, the next frame will have to wait until the mod has been loaded. So technically onClientRender is telling you when a new mod can be loaded, but not when the mod has been loaded, except when the loading process takes longer than your next frame is ready to be drawn. See this topic for my recommendations: + The draw-distance resource you have liked, is making use of a similar mechanism which you could also play around with. It doesn't use onClientRender, but instead it uses getTickCount to process tasks within a given time. https://gitlab.com/IIYAMA12/draw-distance/-/blob/master/scripts/main_c.Lua @JeViCo
-
I saw this one a while back: https://community.multitheftauto.com/index.php?p=resources&s=details&id=7665 Not sure if that does what you want. And you can also play around with: https://wiki.multitheftauto.com/wiki/CreateLight
-
I know, that is why I gave you that solution since the railroad continuous on an invisible track, because the GTA developers never decided to enable that track in the first place. It is just there, unfinished. The reason why @DNL291 is assuming that it is derailed, is because you are showing an image of an situation that is not related to the topic. You should have shown an image where a train is driving over the water.
-
table_example = { [1] = {'example1'}, -- How move this table.move ↑↓ ?? [2] = {'example2'}, } table_example[2] = table.remove(table_example, 1) print(table_example[1][1]) print(table_example[2][1])