-
Posts
656 -
Joined
-
Last visited
-
Days Won
2
Everything posted by John Smith
-
change last 3 lines to end end end )
-
Okay, thanks guys! I've managed to fix my problem now
-
Yeah, that is what i already know. The thing that confuses me is that it compares 2 number values. <-- You see, my table sorta looks like this when it's filled in with data toptimes = { {32423,"nickname"}, {12313,"nickname"}, }; So a,b values. Which ones would those be in table example above? I know that it should compare numbers, but i don't know how the process goes (i need to understand how things work in order to learn) Also, i gotta know this because I'm getting an error in which it's trying to compare nil with a number, so to even try solving that issue, i gotta at least understand... well all of this a,b stuff i hope that u understand what i'm saying and that you can help me
-
table.sort(toptimes, function(a, b) return a[1] < b[1] end) could anyone explain please to me what is a,b and how it is defined? i need to understand it because i'm facing an issue where it says that it's trying to compare nil with a number (meaning that a[1] is nil and b[1] is a number) and i don't really understand the definition of a,b so i cannot event attempt to fix it..
-
You're the reason why I don't want to live on this planet anymore.
-
Oh wow. Thanks guys for help, it worked now I didn't thought of this since i though table.sort would return some type of an error table.sort [expected number, got string] Anyway, thanks fellas!
-
That's exactly how my function looks like right now.. I've tried even adding more numbers to the table, and look it's like if the table.sort function can notice only first 2 characters of the number, but if its above 99 (has 3 or more characters, it breaks down) --Output [1] = {1,WonderfulNick52} [2] = {100,WonderfulNick52} [3] = {3,WonderfulNick52} [4] = {53,WonderfulNick52} [5] = {69,WonderfulNick52} [6] = {900,WonderfulNick52} [7] = {99,WonderfulNick52} [8] = {993,WonderfulNick52} I'm stuck, I don't know what to do..
-
I've tried your thing and it did sort...a bit I've replaced the function code in my first post with this table.sort line of yours and used toptimes as the table but there's one order mistake in it --Output [1] = {1,WonderfulNick52} [2] = {100,WonderfulNick52} [3] = {69,WonderfulNick52} [4] = {900,WonderfulNick52} 69 should be on index 2, and 100 on index 3
-
Yes. And that data processing takes really little time (not even noticeable). Besides, this sorting things only happens when there's an update to the toptimes so performance is not really an issue here, but thank you for letting me know of this. And yes. table.sort should work, but doesn't. That's why I made this topic in first place. -- Output [1] = {900,WonderfulNick52} [2] = {100,WonderfulNick52} [3] = {1,WonderfulNick52} [4] = {69,WonderfulNick52} -- this is toptimes table data, TEMP_TABLE contains only the numbers This output remains the same even before and after using table.sort, do you happen to know why?
-
I prefer saving data to tables rather than using database solutions. I'm already using table.sort (You can see it in my first post) table.sort(TEMP_TABLE); aaaand it doesn't work... who knows why?
-
I might have misunderstood you or something, but when i replace my line with yours, it doesn't logically work as a,b is nil Also, why doesn't table.sort(table) work? I've tried runcode examples of tables with it, and it works fine, but not in my script.
-
Hey I'm using this piece of code to sort table's numbers from lowest to highest but doesn't work. function sortRecords() local TOPTIMES_COPY = toptimes; local TEMP_TABLE = {}; for _,v in ipairs(TOPTIMES_COPY) do local _ARG_0_ = unpack(v); table.insert(TEMP_TABLE,_ARG_0_); end; table.sort(TEMP_TABLE); for _,v in ipairs(TOPTIMES_COPY) do for _,value in ipairs(TEMP_TABLE) do local _,_ARG_1_ = unpack(v); v = {value,_ARG_1_}; end; end; toptimes = TOPTIMES_COPY; end; My toptimes table at the moment consists of 2 type of data milisecond time, player name I'm using above code to extract only numbers from the toptimes table so that i can sort miliseconds from lowest to highest number and then afterwards replacing toptimes table with new, sorted and modified toptimes table The problem is that table.sort doesn't sort my table numbers at all. They remain the same. Example: Numbers (in order) 900,100,1,69 don't get sorted to 1,69,100,900 but instead they remain untouched. Anyone knows what's the problem?
-
function dx1() addEventHandler("onClientRender", root, dx_1) setTimer(function() removeEventHandler("onClientRender", root, dx_1) end, 1000, 1) end dx1() function dx2() addEventHandler("onClientRender", root, dx_2) setTimer(function() removeEventHandler("onClientRender", root, dx_2) end, 1000, 1) end setTimer(dx2,1000,1) function dx3() addEventHandler("onClientRender", root, dx_3) setTimer(function() removeEventHandler("onClientRender", root, dx_3) end, 1000, 1) end setTimer(dx3,2000,1)
-
what exactly do you want the script to do?
-
of course that they all appear together when you're adding an event handler to them instantly by calling the dx1() etc functions
-
Oh for fuck sake guys! Just look at damn 3rd argument of the timer e.g end, 2000, 0) 0 means it keeps repeating forever, put it to 1
-
First, imagine that area 51 is covered with gates , all gates except roof gates and there's not a single entrance in freeroam you press F1>Map and you warp to area 51 and you're simply inside i've made a tiny hole on purpose which through players could break in the base but they can also warp into base with F1 like i said and i wouldn't want them to do that with parachute thing which i wrote in my first post here, they could at least enter the area a bit more realisticly, but warping would be simply cheating
-
@Dealman, i already have a collision rectangle around 1 base atm (area 51) and i've made it on purpose that the players could break in the base by just one way, but this warping thing is easy to discover, and not the way that i'd like to see players breaking in..so not sure what to do @GTX freeroam resource by default uses getGroundPosition for spawning, and still players can warp inside the base about processLineOfSight: which coordinates would i process?
-
Keep in mind that they could just fake the image extension type
-
Hey umm, so there's some sort of an issue i'm facing with freeroam warping system It works fine as intended, but it warps any player directly to the ground position (that becomes a problem when players can break in base(s) which are supposed to be closed, un-enterable) I have thought of warping player to air instead and perhaps give them a parachute so that they wouldn't fall to death? What do you guys think? Is there any other (preferably not complicated) solution to this?
-
by creating multiple dx rectangles, you can achieve rounded rectangle effect (see chatbubbles resource on community for example)
-
https://wiki.multitheftauto.com/wiki/Se ... undEnabled but i've never used this function so i don't know which id are those gun shots
-
Windows 10 - Multi Theft Auto: San Andreas 1.5
John Smith replied to FlyingSpoon's topic in MTA Chat
It's because windows 10 gets activated only when u upgrade, because it has a product key in it's upgrade and u installed windows 10 without product key, there's some microsoft page about this so you should look on their site https://www.microsoft.com/en-us/softwar ... /windows10 -
It's a leftover from GTA:SA, it's nobody shooting, just that sound playing like in singleplayer.
-
setElementData shouldn't do any lag, unless you really use it well i don't know onClientRender or something? triggering events can cause lags when used too much times at same time (but it really depends on how big the data is that event is sending)