-
Posts
6,058 -
Joined
-
Last visited
-
Days Won
208
Everything posted by IIYAMA
-
Or you learn to script first, so that your topic doesn't become a scripting request. ? I only give examples when you can learn enough from them, which is not the case when your question goes beyond the basics (those that you are missing at the moment).
-
The syntax for the setLowLODElement function: bool setLowLODElement ( element theElement, element lowLODElement ) https://wiki.multitheftauto.com/wiki/SetLowLODElement You need to fill in the elements, not the model number. Afaik you are seeing warnings/errors appear in your debug console because of this. This function is used for swapping between default objects and lowLOD objects, depending if the object is streamed-in or not.
-
serverside, else you are going to need some bunny hops to make it work. There are no clientside support functions for map files.
-
For lowLOD's you need scripting as well afaik. https://wiki.multitheftauto.com/wiki/SetLowLODElement
-
onResourceStart = serverside < reason why your code does not run. onClientResourceStart = clientside Depending on the quantity, if it is just 2 objects, it doesn't really matter. But if it is 1000 objects, .map will be faster. Server Server(side) is code running on the server. There is only 1 serverside. Client Players are clients. This code is running inside of the game. Each player is running a copy of this code.
-
This function collects all elements of a given type and puts them in a table. You do not have to check afterwards which type they are.
-
In that case you could get all players and loop through them. See first example of this page: https://wiki.multitheftauto.com/wiki/GetElementsByType
-
Yes Maybe here as well, but you probably already figured that one out.
-
There is a 1 second delay between validation > if bossmusic is an element. You will have to validate again. The 1 second delay is where that 'sometimes' comes in. if isElement(bossmusic) then -- validation fadeout = setTimer(function() -- delay -- missing revalidation volume = getSoundVolume(bossmusic) setSoundVolume(bossmusic, volume-0.1) end, 1000, 0) --[[ ... ]]
-
You can't magically make data/elements out of nothing. You have to be very specific about what you are trying to do and where your data should come from.
-
1. changing the eventNames onClientResourceStart > onResourceStart onClientColShapeHit > onColShapeHit 2. Getting rid of localPlayer, since that predefined variable does not exist there. addEventHandler("onResourceStart", resourceRoot, function () MyZone = createColCuboid(-2034.9541015625,321.2734375, 200.75479125977, 40, 90.2, 17.9) addEventHandler ("onColShapeHit", myZone, dimensionChecker) end ) function dimensionChecker (theElement, matchingDimension) if matchingDimension and getElementType(theElement) == "player" then setElementData(theElement, "R", true) end end
-
Are you sure that the code is clientside? -- put on top of script iprint(triggerClientEvent and "serverside" or "clientside") -- and check debugconsole
-
addEventHandler("onClientResourceStart", resourceRoot, function () MyZone = createColCuboid(-2034.9541015625,321.2734375, 200.75479125977, 40, 90.2, 17.9) addEventHandler ("onClientColShapeHit", myZone, dimensionChecker) end ) function dimensionChecker (theElement, matchingDimension) if matchingDimension and theElement == localPlayer then setElementData(localPlayer, "R", true) end end onResourceStart > onClientResourceStart (onResourceStart is serverside only) Moved addEventHandler directly after creating the element. The event onCientResourceStart is executed very late and therefore the element didn't exist when you tried to attach the addEventHandler. Checking if the one hitting the colshape is the localPlayer. Use code block for your code:
-
That is because the function is executed by the admin resource and not by an user. Users in general can't execute functions, since functions are not part of the user API. The user API only exist out of commands and events>indirect (and maybe something else ???). If you want those functions to be scoped by the ACL, I am afraid that you will have to modify the admin resource or disable the resource tab for those users. Note: This is information based on my knowledge of how resources work. I am not entirely sure if there is a way for a user to execute a function, since there is no Lua environment created for each player, it is created based on each resource. Maybe it could be possible, outside of the Lua environment.
-
You need this function: https://wiki.multitheftauto.com/wiki/AttachTrailerToVehicle
-
Change root to resourceRoot. (My bad) And add some debug lines to check if everything is executed.
-
Hmm, I didn't know that. In that case the only thing he can do is pre-loading: local terrainTexture = {} addEventHandler("onClientResourceStart", root, function () terrainTexture.low = dxCreateTexture('shader/low/1.png',"dxt5",true) terrainTexture.medium = dxCreateTexture('shader/medium/1.png',"dxt5",true) terrainTexture.high = dxCreateTexture('shader/img/1.png',"dxt5",true) shader = dxCreateShader("shader/fx/shader.fx") end) local grass = {'sw_sandlod','desstones_dirt1','desertgryard256','grasspatch_64hv','desertgryard256lod','grasstype5_4','desgrasandblend','desgrasandblend_lod','grasslod','redcliffroof_la','grasstype4','sw_sandgrasslod','sw_sand','whitesand_256','dirtblendlitlod','des_dirt2gygrasslod','brngrss2stonesb','lodslgrass01','des_grass2dirt1','des_grass2dirt1lod','des_scrub1lod','des_grass2scrublod','rocktbrn128bllod','des_dirt2lod','des_dirt2grasslod','desgrassbrnlod','des_dirt1lod','des_yelrocklod','golf_fairway2','grassgrn256','lodgrass_128hv','pavementhexagon','desgrassbrnsnd','forestfloor256','forestfloor256lod','forestfloor256mudblend','grasslong256','des_dirt2stones','hiwayinsideblend1_256','greyground2sand','grasstype4_staw','grassshort2long256','grassdeep256','grasstype3dirt','grassdeep256','grass_lawn_128hv','tenniscourt1_256','hiwayinsideblend2_256','hiwayblend1_256','desegravelgrassroadla','dirtblendlit','sl_sfngrssdrt01','sl_sfngrass01','golf_greengrass','golf_fairway3','golf_fairway1','golf_heavygrass','golf_hvygras_cpark','grass_dirt_64hv','pavebsandend','grass_dry_64hv','grassdeadbrn256','sjmlahus28','sjmscorclawn3','grasstype510','grasstype510_10','roadblend:O','brngrss2stones','grasstype4-3','grasstype3','grasstype5_desdirt','dirtkb_64hv','desertgryard256grs2','des_dirt2grass','des_dirt1','grass','des_dirt1_glfhvy','des_dirt1_grass','grass_128hv','ffbranch_mountdirt','desmud2forstfloor','forestfloorblend','cw2_mountdirt2forest','con2sand1b','con2sand1a','desgrassbrn_grn','des_dirt2gygrass','ws_traingravelblend','sw_sand','newcrop3','sjmscorclawn','dirtgaz64b','bow_church_grass_gen','grasstype10_4blend','desertstones256forestmix','grifnewtex1x_las','grassdry_128hv','grass4dirtytrans','hedge1','sw_grass01d','sfn_rockhole','sfncn_rockgrass3','sfn_grass1','des_dirtgrassmixbmp','grasstype4_forestblend','grasstype4_10','grasstype10','des_dirtgrassmix_grass4','grass4dirty','dt_road2grasstype4','bow_church_grass_alt','grasstype4blndtodirt','desgreengrass','yardgrass1', 'grassgrnbrn256', 'des_grass2scrub', 'des_scrub1_dirt1b', 'des_scrub1_dirt1a', 'vgs_rockbot1a', 'vgs_rockmid1a', 'des_ripplsand','des_dirtgravel','des_roadedge2','des_panelconc','des_oldrunwayblend','grasstype5','grasstype5_dirt','desgrassbrn','hiway2sand1a','hiwaygravel1_256','hiwaygravel1_lod','des_oldrunway','grass4_des_dirt2','forestfloorbranch256','forestfloor3','des_dirt2grgrass','forestfloor3_forest','forestfloor_sones256','sw_sandgrass','sw_sandgrass4','sw_rockgrassb2','des_dirt2 trackl','des_dirtgrassmixb','des_dirtgrassmixc','desertstones256grass','desmuddesgrsblend','hiwayinsideblend3_256','desgrassbrn_lod','des_scrub1_lod','desgreengrasslod','grasstype7','sandgrndlod','concretedust2_lod','bow_church_grass_lod','des_dirt1_lod','vgsecoast02_lod','vgsecoast05_lod','vgs_rockbot1a_lod','vgn_ground8_lod','vgn_ground10_lod','vgn_ground3_lod','grassdry_lod','5af8d285','brickred'} addEvent('pp',true) addEventHandler('pp', root, function() if setting == 1 then terrain = terrainTexture.low elseif setting == 2 then terrain = terrainTexture.medium elseif setting == 3 then terrain = terrainTexture.high end if terrain then if not shader then shader = dxCreateShader("shader/fx/shader.fx") end dxSetShaderValue(shader, 'Tex0', terrain) for i=1, #grass do engineApplyShaderToWorldTexture(shader, grass[i]) end end end)
-
That is for scaling absolute values to relative values, making sure that the dx-effects are the same size on every screen (without stretching). It will not be helpful in your cause: reducing resolution for performance gain.
-
Isn't updating the shader value enough? Instead of creating a new shader and (re)applying it to all textures.
-
This warning appears when you try to add an event handler, which is already attached to that function. You can either use a variable: local drawingStatus = false if not drawingStatus then addEventHandler("onClientPreRender", getRootElement(), draw) drawingStatus = true end if drawingStatus then removeEventHandler("onClientPreRender", getRootElement(), draw) drawingStatus = false end Or you can use the following utility function isEventHandlerAdded, which you can copy out of the example: https://wiki.multitheftauto.com/wiki/GetEventHandlers
- 1 reply
-
- 1
-
I have added a useful function to the wiki, for positioning dx-effects:
https://wiki.multitheftauto.com/wiki/GetScreenStartPositionFromBox
Enjoy!
-
I have added a useful function to the wiki, for positioning: https://wiki.multitheftauto.com/wiki/GetScreenStartPositionFromBox
-
The setPedStat was not working, the stat id was not filled in. iprint("purifierHealth", purifierHealth) setTimer (setPedStat, 500, 1, source, 24, purifierHealth)
-
There was an: if else end And you changed it to an: if if end end While you probably need an : if -- element data else -- element data if -- validation end end Not sure if that fixes everything, it is still a puzzle.