-
Posts
1,449 -
Joined
-
Last visited
-
Days Won
32
Everything posted by DiSaMe
-
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?
-
Wouldn't it be easier to use dxDrawMaterialLine3D to draw the oil?
-
1. What do you mean by 'synchronization'? 2. What's so wrong about onResourceStart?
-
You seem to call triggerServerEvent with other arguments than I would expect. The first argument is the source and the following ones are passed as parameters to the handler function. So 'localPlayer' on the client becomes 'source' on the server, 'test' becomes 'cop', and 'cop' is ignored. Maybe localPlayer isn't supposed to be passed to triggerServerEvent, so that 'test' would become 'source' and 'cop' would remain 'cop'?
-
It's not hard to make the code flow visible. You can make the script output the lines using outputDebugString or some other output function. Like this: outputDebugString("doSomething()") doSomething() outputDebugString("doSomethingElse(argument)") doSomethingElse(argument) Making the code flow visible without modifying the script itself is harder. That requires reading the file from another script, then finding the separate statements, inserting new lines which output the information and then use loadstring to execute the resulting string as lua code.
-
Well, /debugscript in MTA does the same.
-
setPlayerMoney/givePlayerMoney/takePlayerMoney:
-
Then for sure it doesn't work because you check the points which the player had when resource started. You need to get the points every time before you check them.
-
To transfer the data between client and server, you need to use: setElementData or triggerClientEvent triggerServerEvent But I don't see any reason why you would need to use client-side script at all in this case. Setting money client-side does not change it server-side.
-
i will use this, but thanx, i will have example whenever i create other peds now This won't work. Although waiting a short moment is likely to give the clients enough time to stream in the ped, it's still not guaranteed, and what's more, this only looks correct as long as the client is in streaming range when the ped is created. As I said, you need to apply the animation when the ped gets streamed in.
-
Server: ped1 = createPed( 87, -285.9, 1206, 73.5 ) setElementDimension( ped1, 1 ) setElementID(ped1, "ped1") Client: ped1 = getElementByID("ped1") addEventHandler("onClientElementStreamIn", ped1, function() setPedAnimation( source, "STRIP", "PLY_CASH") end )
-
Some data is not kept by MTA client when the ped is streamed out. It's MTA problem. If server sets animation immediately after creating the ped, he won't be streamed in for any player, therefore no one will see him performing the animation. To workaround this problem, use a client-side script which applies the animation when the ped triggers onClientElementStreamIn.
-
attachTrailerToVehicle