-
Posts
1,449 -
Joined
-
Last visited
-
Days Won
32
Everything posted by DiSaMe
-
3D lines are drawn at the wrong position when a marker is on the screen. It's a bug.
-
You can't add a weapon in a way that GTA would understand it as a new weapon. But scripting lets you 'edit' the weapons. Let's say you want to change damage inflicted by a certain weapon. To do that, you can attach player damage event to a function that checks which weapon caused damage and set player's health to something else. With Lua you can even add new functionality, such as this:
-
You misunderstood me. By saying "streamer" I didn't mean "MTA built-in streamer", I was talking about my own script which loads and replaces models when you are near object and unloads/restores models when you are far. And to be more precise, I don't think there's something wrong with polycount. The map is Liberty City, converted from GTA3. I created programs to convert files myself , and they're not perfect. A few models crash the game, but when I use my custom model streamer, the game crashes more, so there's something unstable in MTA too, isn't there?
-
A map in my server has many objects with custom models. But loading the whole map gives me some problems. If I load and replace all textures and models when the resource starts client-side, SA loads very slow, so many objects (those of the original map) are invisible and the game freezes when I go to area with custom objects. If I only load and replace models, they're white, but everything else seems to work fine. I also tried to make a streamer which loads and replaces models and textures when the objects are near enough, but it's less stable - some objects lack textures, and it tends to crash client. I have also looked at gta_sa.exe memory usage via task manager. When MTA loads custom DFFs, COLs and TXDs, memory usage increases. But when a few thousands are loaded, it drops to a very low level, around 15000 KB. So I have two questions: how are those files handled, are they loaded into game when engineLoad*** functions are used, or is the game just directed to use custom files instead originals when object with that ID is created? And in which way (streaming or loading when resource starts) would you recommend me to use custom models?
-
0x7FFFFFFF seems to be the longest possible time. One game minute will take 25 real days, that should be enough
-
Or you can use tables: possible_values = {17,18,19,20,23,24,25} random_value = possible_values[math.random(#possible_values)]
-
What's wrong with that? Damage is done client-side. What the server gets is a result from syncer.
-
The only thing you found out on runcode is that setPedControlState is a clientside-only function. Yes, setPedControlState doesn't work on trains. It only works on peds. But engineer is a ped, not a train
-
Try this: Server: function createTrainAndEngineer() engineer=createPed(227,1479,2669,3) setElementID(engineer,"engineer") train=createVehicle(537,1479,2669,3) setTrainDerailable(train, false) warpPedIntoVehicle(engineer,train) end addEventHandler("onResourceStart",getResourceRootElement(),createTrainAndEngineer) Client: function driveTrain() engineer=getElementByID("engineer") setPedControlState(engineer,"accelerate",true) end addEventHandler("onClientResourceStart",getResourceRootElement(),driveTrain) As you can see, the server creates train and engineer when the resource has started, not when it's starting. Engineer element has ID "engineer" which is used by client to get the element.
-
I could decide myself if freeze checks are necessary or not for me, as sync isn't needed when the server is starting. However, I must agree that with coroutines I can do everything I need easily. Nice feature...
-
It means that source or SQLid has no value.
-
It must be sourceTable = {{}} instead of sourceTable = {}{}. However, only sourceTable[1] will be the table, other values will be nil as they aren't set to any value. So you need to set them yourself when the source is created. If the source is player, it can be like this: sourceTable = {} function playerJoined() sourceTable[source] = {} end addEventHandler("onPlayerJoin",getRootElement(),playerJoined) function playerLeft() sourceTable[source] = nil end addEventHandler("onPlayerQuit",getRootElement(),playerLeft)
-
You can open SA map with MEd and find the object.
-
That limit isn't just for objects, but for total number of elements.
-
Abort of long executions prevents MTA from freezing in case of infinite loop. However, I must agree it often makes things worse if big amount of data needs to be processed. I think it'd be better if MTA had a feature to turn it off.
-
Map limit seems to be a bug rather than a limitation. Inability to create water outside map is a GTA limitation (I think), but I'd still like to see MTA overcome it.
-
You need to check if the player who hit the colshape is local player.
-
getCameraMatrix + setElementRotation + some little trigonometry.
-
You can decide yourself: http://bugs.mtasa.com/roadmap_page.php
-
It's not necessary to create the object on every client. It can be server-side object and player ID could be stored as element data. Only setting element position and rotation needs to be client-side.
-
Or you can trigger another client event from server which would contain the 'return' value. But element data is still easier and more efficient way.
-
function addBinaryValueToString(s,value,size) if value == false then value = 0 end if value == true then value = 1 end if type(value) == "number" then value = value%(256^size) for bytenum = 0,size-1 do s = s..string.char(math.floor(value%256)) value = value/256 end elseif type(value) == "string" then value = value..string.rep("\0",size-string.len(value)) s = s..value end return s end s is a string you want to join the new bytes to, value is the value you want to join, it can be a boolean, integer or string, size is number of bytes you want to join. Function returns s string with new bytes joined. First I made a function which writes the value directly to the file, but it turned out to be faster to write more bytes in less times than less bytes in more times. Using this function on long strings is slow too, so it's best to write the data to the file when the string is long enough.
-
That would be the same, because code would be executed on the same frame. Timers are necessary to do things like that, but it would need more scripting.
-
You need to write all sections with their headers before writing texture native struct section. This is TXD file structure. Try looking at TXD files with RW analyzer. Without it, I would hardly have understood RW format.
-
It's not about script made improperly. It's about lots of data having to be processed. It's done when resource starts, so it wouldn't cause problems such as freezing during the game. Anyway, that's just a temporary way to see how things work, and I'm going to make a better script without long loops.