-
Posts
1,461 -
Joined
-
Last visited
-
Days Won
34
Everything posted by DiSaMe
-
Your meta.xml has two elements, that's wrong.
-
When the player or ped shoots the vehicle, use this function: processLineOfSight It lets you know the part of the vehicle which is hit first by the line of sight.
-
You can detect the shots using onClientPlayerWeaponFire and onClientPedWeaponFire and cheking the hitElement argument.
-
You can try dxDrawRectangle on the whole screen with changing transparency.
-
If you want to set visual damage, use these functions: setVehicleDoorState setVehiclePanelState
-
If you mean that vehicles cannot move outside sync range, then that's because only client has physics. You can simulate the movement of vehicle by repeatedly checking if vehicle has no syncer and putting it closer to the destination point. That's how I did it in my NPC high-level control resource. Such movement is less realistic but precision isn't necessary when no players are around.
-
The vehicle doesn't exist on the server. It was created by the client and only exists on the client. You can't pass elements or other userdata if they do not exist on the other side.
-
Use getElementByID to get the element from the map and then use setElementFrozen: local barrier = getElementByID("object (DYN_ROADBARRIER_4) (4)") setElementFrozen(barrier, true)
-
That's the way I tested my Drawtag script before releasing it. I have also tried to look how pedestrian traffic works with two players, but two instances of GTA SA with multiple car and ped models loaded hardly fit into 512 MB of RAM
-
That's probably because the model isn't loaded right after the creation of element. Maybe it will return correct value in onClientElementStreamIn. If it doesn't, then you could check its value every frame (onClientPreRender/onClientRender) and when it returns a non-zero value, set the position and freeze the vehicle.
-
Then maybe create it in such position that it would be on the ground?
-
Is that vehicle supposed to move at all? If it needs to always be in the same place, then you can use setElementFrozen to lock it in the place, but if you want it to drive without being affected by anything, then I don't have an idea how to achieve it.
-
Are the coordinates visible on the screen at the moment of ped creation?
-
Try calling setElementCollidableWith in onClientElementStreamIn.
-
https://wiki.multitheftauto.com/wiki/FindRotation
-
Yeah, this is what I mean.
-
Some animations (like eating) do not affect legs, making it possible to run and eat at the same time, but the animation of the legs cannot be changed while eating animation is running. So if you start performing the animation while running, you will continue to run, but you will only be able to stop and turn after the animation has finished. Maybe it is somehow possible to mess with the animations in some way that it would result in ability to freely move while performing the animation, I don't know.
-
Event triggering and element data are the only ways to send general purpose data. Since they are asynchronous, they require triggering back to get the result. I guess your problem with asynchronous calls is the need to split the triggering and result handling into two functions. It can be solved using coroutines, a way to pause the execution of the function and resume later. You still need to trigger back, but you can continue the execution in the same function which triggered the event.
-
You're trying to get the position of source, which is the root element of the resource.
-
guiSetPosition getTickCount onClientRender
-
You can't do this with tables. Table is a data type, not a way for the server and client to communicate. There are only two ways to transfer abstract data between client and server: element data and event triggering. Element data is simpler, but it can be either synced for everybody or nobody. Event triggering allows you to only send data to some players, so you can make the script which sends the data about the ped to the players who are near enough, reducing the bandwidth usage. I'd recommend you to use element data for simplicity and when the script works properly, you can switch to event triggering if you want to optimize the bandwidth usage.
-
I don't know if it's useful to try to mess with the sync. At least for now, I'd recommend you to leave it for the server to handle and only do something if it turns out to be necessary. As for controlling, use the server to assign the tasks and client to perform them. Element data is an easy way to sync the information. For example, you can set the data under key "target" to some player on the server, get this data in the client-side script and use it to make the ped attack the player. You may want to try NPC high-level control resource which does the client job for you, all you need to do is set the walking destination point or attack target on the server. It's still in beta though, there aren't many things you could do with it and I don't have any plans to update it soon.
-
Why don't you try to fix it yourself, like checking what are the values of the variables?