Jump to content

ShayF2

Members
  • Content Count

    230
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by ShayF2

  1. ShayF2

    MTA Offline Wiki

    should i continue on this?
  2. local _output = outputChatBox function outputChatBox(text, ...) if string.find(text, 'color:#') then string.gsub(text, 'color:', '') end return _output(text, unpack(arg)) end
  3. You have to use relative positioning on everything you draw.
  4. 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.
  5. ShayF2

    Who am I?

    @IIYAMA you got it boss.
  6. ShayF2

    Who am I?

    Who am I? Anyone can respond. Be honest, I wont argue.
  7. 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
  8. -- 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
  9. line 93 is just killTimer, replace this with if isTimer(timerVehicle) then killTimer(timerVehicle) end
  10. 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.
  11. If you're running this clientside then oyuncu doesn't exist. Try running it serverside.
  12. 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
  13. 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
  14. ShayF2

    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, w
  15. 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, é
  16. @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.
  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. @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. @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.
  21. @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
  22. @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.
  23. @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
  24. 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}
×
×
  • Create New...