-
Posts
1,449 -
Joined
-
Last visited
-
Days Won
32
Everything posted by DiSaMe
-
Use fetchRemote to download the data, then parse the HTML (and optionally CSS/JavaScript) data in Lua, that's how it goes. I don't see a reason why anything else would be needed.
-
That doesn't make any sense at all. Number of players does not influence the execution of timers. What's more, I just started 20000 timers on the server and they increased the CPU usage like by 10%. Even if I give them 50 ms interval, they reduce the server FPS from 145 to 120, with CPU usage being about 60-70%. In addition, implementing timers in Lua using onClientRender/onClientPreRender and getTickCount would probably cause bigger slowdowns. Even if that weren't true, code readability is more important than performance because reliability comes from readability and slowly working code is better than not working code.
-
setElementParent ?
-
So that the servers would be able to DDoS other servers?
-
Did you create the resource after starting the server? If so, then you need to use 'refresh' command.
-
There are no "string types", the script simply converts the numeric and string data into a string which looks like the same values stored in RAM or HDD. Format argument (the first values passed to dataToBytes and bytesToData functions) describes what data you store/retrieve. For example, if you want to store two 2-byte integers v1, v2 and a 4-byte integer v3 (all signed and little-endian), this is how it would look like: local packed = dataToBytes("ssi", v1, v2, v3) "s" means a 2-byte integer and "i" means a 4-byte integer. So it's "s" for v1, another "s" for v2 and "i" for v3. And now the string packed contains a string whose length is 8 characters. First two bytes contain the value of v1, the following two bytes contain v2 and the last four bytes contain v3. If type identifiers in the format string are repeating, you can put a number before the letter instead of repeating it. In this case, you can substitute "ssi" with "2si". Now, when you need to get the values from the string packed, you need to use bytesToData with the same format string and it will return the values which were passed to bytesToData: v1, v2, v3 = bytesToData("ssi", packed) If my explanation wasn't good enough, you could try reading this: http://docs.python.org/3.3/library/struct.html . I made the functions to work like struct.pack and struct.unpack in Python do. By the way, it looks like the example in my website has some mistakes. Also, I noticed that while the floating point data works on standalone Lua interpreter, it gives incorrect results on MTA client (not sure about the server). This is probably because of reduced mathematical precision of calculations on the client. So I hope that's enough info for you
-
getElementPosition getScreenFromWorldPosition dxDrawText
-
setPedAnimation(player, "block", "animation", 0, true, false, true, false)
-
Trigger an event from client to server when resource starts on the client's side (onClientResourceStart). This way the server will know when client-side script has already started.
-
Okay, I guess I'll have to discontinue that conversation. Sorry, but I just find it hard to resist replying when people say things without providing any evidence.
-
This seems to be exactly what I was talking about.
-
setPedAnimation(player, "animation_block", "animation_name", 0, true, false, true, true)
-
Another reason is because the variable John is not defined. If you want to get the element from ID, use this function: getElementByID
-
If you want to make a server without putting any value in it, you will fail anyway, only wasting your time, so it's not even worth trying. Excuse me, but that's not true. No one can be saved by anyone else. We must find the path to salvation ourselves, like Gautama Buddha did.
-
Maybe because you use an undefined variable (forwards) rather than a string ("forwards") in setPedControlState?
-
setPedControlState setPedCameraRotation
-
All global variables are stored in the table _G with their names as keys. So myFunctionName is _G["myFunctionName"]
-
Oops, sorry. But still, you need toggleControl for this. And combine it with some other function for actual key state detection, such as bindKey. So pressing the key will not change the running state directly, but instead, the script should detect when it's pressed too quickly and only change the control state when the delay between presses and releases is long enough.
-
Variable "player" is not defined.
-
No need to mess with timers for this. Creating the ped and setting the rotation and interior is enough. Elements are created in dimension 0, so you don't need to set it either. The script looks fine for me, you better check if it gets executed at all using output functions, such as these: outputChatBox outputServerLog outputDebugString
-
https://wiki.multitheftauto.com/wiki/OnPlayerWasted https://wiki.multitheftauto.com/wiki/OnPedWasted
-
{} [ ] = == if then else end
-
Since we can change licenseplate number now...
DiSaMe replied to DeletedAccount1111's topic in Scripting
You can draw your own license plate over this one dxDrawMaterialLine3D