pa3ck
Members-
Posts
1,141 -
Joined
-
Last visited
-
Days Won
7
Everything posted by pa3ck
-
So which one(s) have you done so far, just out of curiosity? (in 2 months time)
-
Rather than having 0 - off and 1 - on, there are 3 states. 0 - you let GTA handle it (when you go to a tunnel or something, it will be turned on), 1 - off, 2 - on, that's where you went wrong.
-
[HELP] I need an explanation in InterpolateBetween Please
pa3ck replied to ZkillCatIV's topic in Scripting
Believe it or not, when I looked at interpolateBetween myself, I felt the same, looked so complicated, I thought it's just not worth learning it. Didn't even touch it for months, then someday I decided to take a closer look and turned out it's so simple to use once you understand it. Glad I could help. -
Okay, what about this: dbQuery( function(qh) local result = dbPoll( qh, 0 ) outputChatBox("Result: " .. #result) end , connection, "SELECT * FROM mybb_users WHERE username = ?", user )
-
Setting the value to nil will remove that data from the table. If you want to use table.remove, you will need to specify the index rather than the value.
-
Use the table index to move the message on the Y axis. Eg: for i, v in ipairs(msg) do dxDrawText(v["message"], 10, (i-1) * 20 ......) end
-
[HELP] I need an explanation in InterpolateBetween Please
pa3ck replied to ZkillCatIV's topic in Scripting
I see you already found a similar topic and that helped you, but in case you didn't understand interpolation fully, I will explain. So basically it's a function, that increments / decrements gradually between start and endpoints. So if you had 2 camera positions and you wanted to have a nice movement between the 2 positions, you would use interpolation. In theory, it returns a number between -1 and 1 over it's progression. When this curve is over, it will always return 1. Now, in MTA, you can call this function with 3 start and 3 end points and one easing type, which defines the actual curve of progression (take a look at the link in order to better understand them). Although, this "interpolateBetween" function does not remember the progression, it doesn't know whether it's finished, half way through or just started off, that is why you will have couple of variables. getTickCount() is an integer that returns the amount of time your system has been running in milliseconds, so it's unique and can be used to mark different events. For example you can save the starting time with getTickCount and in an event like onClientRender you can compare how many seconds have passed. Thing you will need: Start time: getTickCount() whenever you call the interpolation first Elapsed time: current getTickCount() - start time -> returns elapsed time in milliseconds Duration: how long will it take to reach from start to the end in milliseconds -> probably it won't change Progress: the current state of the interpolation, to get this, use the formula: elapsedTime / duration And you will also need 3 start and 3 end points, as I already said (although, if you need only 1 start and 1 end, just use 0's) To wrap it up, this is how you call interpolateBetween ( remember that you will always want to run it inside render ) local start = getTickCount() function render() local now = getTickCount() local endTime = start + 2000 local elapsedTime = now - start local duration = endTime - start local progress = elapsedTime / duration local posX, posY, posZ = interpolateBetween ( startPosX, startPosY, startPosZ, endPosX, endPosY, endPosZ, progress, "Linear") end addEventHandler("onClientRender", root, render) -
5 sec timeout? What for? That's loads, wiki: timeout: How many milliseconds to wait for a result. Use 0 for an instant response (which may return nil). Use -1 to wait until a result is ready. Note: A wait here will freeze the entire server just like the executeSQL* functions
-
Maybe because when they logout they are no longer in any team? (guest account). onPlayerLogout passes through 2 arguments, one of them is the oldAccount, use that instead.
-
There is no if but an else here addEventHandler("onColShapeHit", Zone1, enterArea1) else Remove that else.
-
MTA is just using embedded SQL, there shouldn't be any difference between plain SQL and MTA SQL. The only thing I can think about is that you don't have any matches in the WHERE, maybe wrong id / username? Debug your code with outputChatBoxes to make sure the query actually runs and also output the values you are checking in the WHERE clause. If you are still unable to solve it, send us the layout of your table and the outputChatBox from the WHERE clause values.
-
Well you should probably write your own "shut down handler" which could be a command that saves all data first, then execute the shutdown.
-
As long as your database is normalized you shouldn't have a problem with tens of thousands, in fact, millions of records in each table are still fine as long as your queries and data structure is well put together. Take a look at this select speed and see how you can speed up queries. On the other hand, if you don't need to use MySQL for something or you know you will use the exact same data in the near future, you should take advantage of LUA tables and cache them client/server side. When I wrote my RolePlay gamemode, I only loaded most of the data once, then cached them for later use (eg. interior enter / exit location, character name etc..)
-
Did you actually create another forum account just to like your own posts about "how to fix everything I download from community"? That's nice...
-
As nikitafloy said, he has an undefined variable in the function isGuestAccount(hitPlayer) -- hitPlayer is undefined, use player instead
-
https://wiki.multitheftauto.com/wiki/AddVehicleSirens Last argument, silentFlag
-
No problem, glad I could help.
-
Isn't that because place is a string? Try if tonumber(place) == 1 then
-
Exactly, something like that, so the file will not be in use by the time you delete it. Make sure you do a mapName = false after you deleted it.
-
That should work, yea. But you might want to remove the first pacecount = pacecount +1 otherwise sometimes it will run twice and add 2 instead of 1.
-
I have no idea how race or (whatever resource this is) works, but why not? Toptimes are probably saved somewhere, you should be able to access that data from anywhere, anytime. But if you find it difficult or you can not achieve that, the other thing I would try is to delete the toptime, then when new map loads, check a variable if the previous ghost file should be deleted. eg: local tTimeRemoved = "someMapName/ghost file path" addEventHandler("onMapLoaded", root, function() if tTimeRemoved then fileDelete(tTimeRemoved) tTimeRemoved = false end end) Then again, I don't know if there's an event called onMapLoaded, but there must be something similar event.
-
What if you try to delete another maps toptime? One that's not running?