ShayF

Members
  • Content Count

    230
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by ShayF

  1. ShayF

    [HELP] How to fix this bug?

    You have to use relative positioning on everything you draw.
  2. ShayF

    [HELP] How to fix this bug?

    Use absolute positioning (your resolution whole numbers) then calculate the relative position with this local devx, devy = 1366, 768 -- your resolution local clientx, clienty = guiGetScreenSize() -- everyone's resolution function absoluteToRelativeDX(x, y, w, h) return x/devx*clientx, y/devy*clienty, w/devx*clientx, h/devy*clienty end Hopefully this helps you.
  3. ShayF

    Who am I?

    Who am I? Anyone can respond. Be honest, I wont argue.
  4. ShayF

    Who am I?

    @IIYAMA you got it boss.
  5. ShayF

    How do add ID for vehs/players

    I think you first need to learn what table index's and table keys are, @MissionComp. Table index's are the positions inside the table, and using such index can allow you to grab things from a specific spot in the table. Index's go up from 0, and they go to like an infinite amount. Say you have a table: local t = {} Now lets put something in the table: table.insert(t, 'Hello World') Okay so we've put a string that says Hello World into the table. Now the table looks like this, without you having to recreate it again: t = {'Hello World'} So now that we have a value in there I can explain how index's work. Since the tables index starts at 0, as soon as you put an item in it, the index count goes up. So now, 'Hello World' has an index of 1 in the table. To call this you do: t[1] Here is an example of using this: outputChatBox(t[1]) t = {position1, position2, position3, etc} t = {index1, index2, index3, etc} I wont cover keys because I don't really need to but I will cover loops. When you use the function getElementsByType, it returns a table, that table contains elements. You can look up a list of elements on MTA's Wiki, I'll post a link below. You use this function to get a table of all the elements of the specified type. Say we get the players in the server for example: local t = getElementsByType('player') Each player is put into a table, and the index simply is the position inside the table where a specific player is. So say you only wanted the 4th player in the server: local t = getElementsByType('player') killPed(t[4]) and then we would kill that player. #table just returns the amount of items in a table So say we wanted to get the amount of players in the server: local t = getElementsByType('player') print(#t) So now onto loops. There are two types of loops, a pairs loop and an integer loop. The difference between a pairs loop and an integer loop is simple. An integer loop simply goes from one number to another, basically counting up, or down if you will. A pairs loop actually runs through a table and returns its data in defined variables. Example of an integer loop: for i=1, 5 do this will go from 1 to 5, in like a count-up. i is your defined variable that you use to get what number it is on. for i=1, 5 do print(i) end so this would print: 1 2 3 4 5 An example of using this would be local t = {'hello', 'world'} for i=1, #t do print(t[i]) end this would print: hello world Example of a pairs loop: for i, v in pairs(getElementsByType('player')) do Inside of the pairs function would go your table, i becomes your index and v becomes your value/item, this returns both and they will always match each-other, so here's an example of using that: local t = {'hello', 'world'} -- and you can use either the index method shown above or use v for i, v in pairs(t) do print(v); print(t[i]); end I wasn't going to go through and fix the code I give you because I honestly expected it to work. So I figured I'd teach you and other people something, in hopes that you can solve the issue yourself. I hope that this response helps you and I wish you a good day. Page to MTA SA Element List: Element
  6. ShayF

    How do add ID for vehs/players

    -- this is for individual objects if u want to count only the ones u create local objects = {} local _obj = createObject Object = createObject function createObject(...) local obj = _obj(...) objects[#objects+1] = obj return obj end -- then you would use index's on objects table like before if objects[1] then print(getElementPosition(objects[1])) end -- this is for if you want to grab all objects local objects = getElementsByType('object') -- then use index's like I said before if objects[1] then print(getElementPosition(objects[1])) end
  7. ShayF

    [HELP] DebugScreen?

    line 93 is just killTimer, replace this with if isTimer(timerVehicle) then killTimer(timerVehicle) end
  8. ShayF

    [TXD ERROR] Unable to load

    Bad TXD ? Vertex's may not be lined up correctly, textures could be missing, textures could be overlapping, idk. I'm not so big into modeling lol.
  9. ShayF

    Avoid debug error message from triggers

    pcall event handler
  10. ShayF

    [HELP] What is the error in the code?

    If you're running this clientside then oyuncu doesn't exist. Try running it serverside.
  11. ShayF

    Expected account

    function TST(player, command, accountName) assert(type(accountName) == 'string', 'Expected string @ TST:accountName, got "'..type(accountName)..'"') local account = getAccount(accountName) assert(account, 'Unable to get account @ TST:account, got "'..type(account)..'"') local player = getAccountPlayer(account) assert(player, 'Unable to get player from account @ TST:account, got "'..type(player)..'"') if player then Try this for debugging
  12. ShayF

    How do add ID for vehs/players

    local players = getElementsByType('player') local vehicles = getElementsByType('vehicle') -- then just use index's, like this if player[1] then -- 1, 2, 3, 4, 5 etc inside of [], this number will be your index or your 'id' outputChatBox(getPlayerName(player[1])) end
  13. ShayF

    pairs vs ipairs

    When you run a loop in pairs, it grabs not only indexed items but also objects. Objects have keys and values. for k, v in pairs(table) do in this case k would be your key, and v would be its value. Keys are always strings. Say it's not an object, instead its an indexed item, k would become the index, and v would be the value for that index. ipairs however, loops through ONLY indexed items and it does them in order. So ipairs will not grab objects. pairs is faster than ipairs since it does not have to sort through the table first. for i=1, #table do this is called an Int loop, where it simply goes from 1 number to another, i=start, end i represents index mostly because people use this loop to grab table index's. it is by far the fastest loop, as it doesn't have to sort through the table, or return an extra argumented variable. #table just returns the amount of items in a table
  14. ShayF

    Sending datas between server and client side

    Sending data between server and client is called Syncing. You can sync easily, however you only want the traffic to go from server to client and not the other way around. If you were to go the other way around then players would be able to exploit certain parts of your data transfer. You can sync using element data (which is faster, I tested myself) or the safer and more reliable way with events. Either one should work just fine. Az adatok küldése a kiszolgáló és az ügyfél között szinkronizálás. Könnyedén szinkronizálható, de csak azt szeretné, ha a forgalom kiszolgálóról ügyfélre megy, és nem fordítva. Ha a másik irányba megy, akkor a játékosok képesek lesznek kihasználni az adatátvitel bizonyos részeit. Szinkronizálhatja az elemadatokat (ami gyorsabb, teszteltem magam) vagy a biztonságosabb és megbízhatóbb módokat az eseményekkel. Bármelyiknek jól kell működnie.
  15. ShayF

    [HELP] Neon Script Help

    @queenshe the issue is that you are creating the objects clientside. Try creating them serverside and sending them over to client properly synced by using element data.
  16. ShayF

    MTA Offline Wiki

    I'm currently looking at a completely offline version of the MTA Wiki. One installer, one executable, ability to switch modes (online and offline), text editor included! You can also set bookmarks to certain functions. I will upload a download link as soon as it is finished. Main Window - Using Index as quick search - Text Editor -
  17. How is this resource optimized benefitial wise? As in does it use up less FPS than MTA's default editor? Does it use up less ram? Are only the needed things loaded into memory? I know to a regular user things like this may not seem so important, but they may to an experienced user.
  18. ShayF

    [LF] Scripter for TV script [PAID]

    @botshara I didn't notice this post until now, I will make this script for you for free, message me on discord. ShayF#0259, I'd be glad to help.
  19. player.position = player.matrix:transformPosition(0, -4, 0) -- this is oop
  20. ShayF

    Convert File Buffer To Table

    I need help figuring out how to convert a script files buffer to a table. Here's what I mean: local buffer = [[local sx, sy = 0, 0 globalVar = 'test string' function testFunction() end local function testFunction2() end]] -- to local buffer = {sx = 0, sy = 0, globalVar = 'test string', function testFunction() end, function testFunction2() end}
  21. ShayF

    Convert File Buffer To Table

    @thisdp I hardly ever test code, even my own, I just make it n I already know what works n what doesn't. I honestly don't understand how you got the second print to be nil, because the string is loaded throughout the file and not unloaded but oh well, good job.
  22. ShayF

    Convert File Buffer To Table

    @thisdp Try your code again this time do this print(type(gTable.testFunction)) print(type(testFunction)) the reason i say this is because you dont unload the code, which means that the original functions and variables are still there even after you add them to the table. Not only do you have to unload the code but you need to reformat the string due to those functions and variables being inside the table so that events, commands, and timers can trigger them from gTable instead of the original code. If the second print test prints function then the solution is false.
  23. ShayF

    Convert File Buffer To Table

    @thisdp your solution is false You load the code, and dont unload it. I'm sorry but this solution will not work. However I do like that you made things global, but that is also false because after adding those functions to the table you need to change the name of those functions, gable.functionName() In the scripts string format before you load it I mean, you don't change their names, you just change the names where the functions are executed, if you know what I mean.
  24. ShayF

    Is Lua really limited?

    Who here has had a limitation with lua? A point where they wanted to do something and they couldn't with lua. Respond your limits, see how far you can really go.
  25. ShayF

    Is Lua really limited?

    @spenkbang local seconds = 0 local timer = setTimer(function() seconds = seconds + 1 end, 1000, 0) function stopCount() killTimer(timer) return seconds end or you can try a loop function local seconds = 0 function startCount() seconds = seconds + 1 return continue() end function continue() seconds = seconds + 1 return startCount() end function stopCount() continue = function() end return seconds end Which can go less than 50 ms, this should be capable of getting close to 1ms