-
Posts
1,449 -
Joined
-
Last visited
-
Days Won
32
Everything posted by DiSaMe
-
I don't know how PNG stores data. But uncompressed TXD textures store raster data in a similar way BMP files do. My script creates textures with DXT3 compression which stores data in 4x4 pixel blocks. Each block takes 16 bytes.
-
I learned about TXD files from here: http://www.gtamodding.com/index.php?tit ... tream_file. RW Analyzer by steve-m helped me a lot too.
-
There are two resources: drawtag and drawntag. Drawntag has TXD and a script which imports TXD and replaces a game texture with it. Drawtag has a client-side script for drawing. When you close drawing window, it sends image data to server. Server reads data, generates new TXD in drawntag and restarts that resource. So the texture changes. And drawtag also has a script which makes spray paint create tag object.
-
Less than 2 weeks ago RW binary stream files format seemed difficult to understand for me. Now it doesn't I have already requested the feature I wrote about in the video, but that was long time ago, when I hadn't even thought how important that feature is
-
addEventHandler("onClientRender",getRootElement(), function() if getTickCount()%2000 < 1000 then --draw it here end end )
-
The script is client-side, so object movement isn't synced. You need to make the script server-side. Alternatively, you can try attaching the event to all players (getRootElement() and checking element type in the function) and leaving the script client-side, but this way is less reliable.
-
Try changing local rx = x+(math.tan(math.deg(rz))) to local rx = x+math.tan(math.rad(rz))
-
Maybe you lose health with a value of 30 because Cheat engine doesn't set oxygen level that quick, so it lowers to 0?
-
When resource starts, to bind the key for all players, you must loop through them. function thisResourceStart () local players = getElementsByType ( "player" ) for _,this_player in ipairs(players) do bindKey ( this_player, "1", "down", stopEngine, "Lights on/off" ) end end To bind the key for players who join when resource has already started, put bindKey into function triggered by onPlayerJoin event. function playerJoined() bindKey ( source, "1", "down", stopEngine, "Lights on/off" ) end addEventHandler("onPlayerJoin",root,playerJoined) Function stopEngine seems to be fine, but we can shorten its code. function stopEngine ( player, key, state ) if getPedOccupiedVehicleSeat ( player ) == 0 then local vehicle = getPedOccupiedVehicle ( player ) setVehicleEngineState ( vehicle, not getVehicleEngineState ( vehicle ) ) end end By the way, I don't see what does that function argument "Lights on/off" mean
-
I think we need client-side file functions (fileOpen, fileWrite, etc.). If they were implemented, scripters could script this way of downloading files in their servers if they wanted.
-
First, you have to write numbers without [ and ] in these tables. To check if a table has the value, you can cycle through them. This code will check if current local player's weapon is included in table noreloadweapons: local is_weapon_in_table = false local player_weapon = getPedWeapon(getLocalPlayer()) for _,weapon_id in ipairs(noreloadweapons) do if player_weapon == weapon_id then is_weapon_in_table = true break end end if is_weapon_in_table then --the code executed if weapon is in the table end BUT there's much simpler way to do that if you store data in the table in other way noreloadweapons = {} noreloadweapons[16] = true noreloadweapons[17] = true noreloadweapons[18] = true noreloadweapons[19] = true noreloadweapons[25] = true --and continue this to 36 if noreloadweapons[getPedWeapon(getLocalPlayer())] then --the code executed if weapon is in the table end And if you don't want to show DX drawings with certain weapons, just don't draw them. They disappear 1 frame after they have been drawn, this is why you have to draw them in onClientRender.
-
You need to add command handler outside the function.
-
The code which gets health and armor of player should be put into the same function where drawing code is. And DX drawings don't detect resolutions, but you can use guiGetScreenSize().
-
I agree with you about the first suggestion. The same argument for removePedFromVehicle would be nice too. If getting into/out of a vehicle becomes possible for peds, I see nothing else about them what should be implemented. I think client-side function is enough as scripting makes it possible to trigger the function from the server. For example, you can make something like this: server: setElementData(ped,"lookat",{x,y,z}) client: setPedLookAt(ped,unpack(getElementData(ped,"lookat"))) This is the point: if the function for peds is unavailable in server side, you can make the server set task and client to execute it. That's the way I make peds walk to certain position as setPedControlState is a client-side only function.
-
Is that needed? Do object elements have syncers at all? As far as I know, setting dimension of server-side object in a client-side script only changes the dimension locally.
-
Server: object = createObject(...) setElementID(object,"alldim") Client: object = getElementByID("alldim") addEventHandler("onClientRender",getRootElement(), function() setElementDimension(object,getElementDimension(getLocalPlayer())) end ) If you want to make this work with multiple objects, you can create an abstract element and make it a parent of objects.
-
You can round decimals in this way: rounded_value = math.floor(unrounded_value*100)/100
-
Actually, onClientPlayerJoin isn't triggered by local player because client-side scripts start after player has already joined the server. Use onClientResourceStart attached to getResourceRootElement(getThisResource()) instead.
-
I don't know exactly how it is, but I think setWeatherBlended works 60 times slower because weather changes depend on time.
-
Did you test onClientPlayerJoin with remote player? It doesn't work with local player as the script is downloaded when the player has already joined.
-
From script.lua file it looks like the extensions for known file types are hidden, but meta.xml has a visible extension, so maybe it's actually meta.xml.xml, what means that you have to rename the file so that you see meta, not meta.xml.
-
Actually it is possible. You can use velocity functions to script that.
-
Actually it is possible. You can use velocity functions to script that.
-
That function would be useful because you can't calculate rotation in all three axes from two points.
-
You can use dxDrawLine3D, but you have to script physics yourself.