Jump to content

Karoffe

Members
  • Posts

    89
  • Joined

  • Last visited

Everything posted by Karoffe

  1. I want to draw some text on each image, all images are the same size, problem is even if I could adjust 1 text to be so close to the center of the image, other texts won't look in the center because of their width, height.. so I want a way to get the center of an image depending on the width, height of the text... Images width, height = 200, 200
  2. I didn't expect it to be the first code line, seems that was the reason of not finding it , Thanks
  3. Is there a way to make the output of GUI's relative value exactly as it is in the dimensions tab (right-click on an element>dimensions), because it outputs 0.06 instead of 0.057 and that causes me some trouble when I need something in the exact same position, I've tried searching code_generation.lua for this but found nothing...
  4. I'd prefer to use image sections but, I am not able to discover the math I need to do this Here is a picture I made with paint to be able of better thinking of how the math is done in my situation, but it seems that I fail at math,, http://i.imgur.com/cRMzJke.png What am trying is to get to do an equation with all the black colored numbers to get the value 10 (the red colored one),
  5. Well, I want to use interpolateBetween to make an image come into a box from the side, my problem is I have to make the image outside the box first then move it inside,, so I want the parts of the image to appear only once it entered the box Here's an image explaining if you don't understand http://imgur.com/0UZ7aog The part inside the box should be shown as normal but the other part outside the box should not appear, how can that be done ?
  6. That works !!, Thanks. I am suprised I never knew/saw that %1 before in lua.. Thanks again, you just saved me
  7. Yes that would work for just 1 whole number but it won't work if there is more.. so if the str was "Lucky numbers 2569, 3662, 5 !" the output is going to be like this > "Lucky numbers /n2569, 3662, 5 !" I want the output to be like this > "Lucky numbers /n2569, /n3662, /n5 !" ... That's why I wanted to use string.match so I use (repeat-until) with inserting every extracted part to a table until there is no more numbers in the string and then draw every row in the table in the right position... Yes that would work if the string was like that only, but like I stated above it won't work with numerous "whole" numbers...
  8. Well, I knew that but wanted to use it with string.match so I extract the part I want and add \n before the number What if I don't want to change the value in string.gsub I want the number to stay as it is but adding an \n before the number, how can that be done?
  9. Well, I want to string.gsub a whole number insead of a character in a number Example: local anyString = "This whole number: 123456 , and this just a character in a number: 5" so is there a way to string.gsub 123456 instead of 1 alone and 2 alone, etc....
  10. Karoffe

    Split

    I know how to use the split function, but I really need to understand how can it be done manually, so lets imagine that this function doesn't even exist how can I create my own one which can work like split function ? Well, I am not asking for the code, am asking for the "way" of doing it.
  11. Ehm, I guess this could be considered as a bug, When I make a Dx rectangle relative in a resolution 1440, 900 and the size of the rect is 1440, 900 and test it in higher resolution it gets automatically re-sized to 1440, 900 that happens in the preview resolution option..
  12. Karoffe

    Coroutines

    Ok, so the function "simpleCoroutine" can only be called 2 times ? When I use that function for the 3rd time it says cannot resume a dead coroutine, how to fix this ?
  13. Karoffe

    Coroutines

    I want an explanation of what a coroutine is And what does it do, An example of it working and explaining what does this example do.. Please don't give me any links I've read all about it and still can't use it I know I was kinda rude when askin these things but I am really strained about this Thanks in advance
  14. Nevermind, done it.. never thought it was really that simple
  15. Hello, I just wanna know if there is a way for drawing a polygon, and the way of 'doing' it. I don't anyone to give me a code, just tell the way it is done and I will create it myself, Thanks,
  16. Karoffe

    What if

    Thanks TAPL and Gallardo @TAPL Yes it would be easier, but that was just an example, this isn't my actual code I will have to use the variable since there is more code to be executed in the original script.. Thanks guys
  17. Karoffe

    What if

    What if I want to use break inside a loop that got another loop, which loop will be broken ? And what if I want to break both loops ? here is an example code function theLoop() for k, ped in ipairs(getElementsByType("ped")) do for i=1, 16 do if getElementData(ped, "orderNumber") == i then if getElementHealth(ped) < 20 then outputChatBox("Found a ped with lower than 20 hp") break end end end end end For example in that code which loop will be broken the numeric one or the table loop ? Also if only one breaks, where should I place the other break to break the other loop (only if we found a ped with lower than 20hp)..
  18. How to make the line between the "function" and "end" ?? its really needed ..
  19. Karoffe

    Call remote

    That also returns error
  20. Karoffe

    Call remote

    I have 2 questions First one can I connect to a URL which should return a xml file(or a string and I create the XML file myself) ? something like this function testFunction(result) outputChatBox(result) end setTimer(function() local test = callRemote ( "https://yts.re/api/upcoming.xml", testFunction) if not test then outputChatBox("failed") else outputChatBox("succeed") end end, 2000, 1) the URL which I want to connect is this https://yts.re/api/upcoming.xml ^ That's just an example.. If I used callRemote on this URL what should return instead of "ERROR" ? And how to make it return an XML file or a string and I create the XML file myself ? 2nd Question Is there a way in LUA to connect to API of websites (without the callRemote) ? I am going to use this outside MTA so I need to find a way.
  21. Karoffe

    MetaTables

    What's the use of this table ? and what's the difference between it and a normal table ? How can I use it ?
  22. Karoffe

    Ped damage

    When I create a ped and make him aims at me and shoots me When the ped shoots at me I don't lost any HP. http://i.imgur.com/dTzKCM4.jpg
  23. Karoffe

    scratch ?

    I've seen in many topics people asking the project was done by scratch or not... I've always wondered what's scratch i searched it in google and found this scratch.mit.edu << idk if that's the scratch they are talking about or not and what makes it better when the project was done by scratch ?
  24. Karoffe

    solved

    Can you give me an example of how could that work ?,
×
×
  • Create New...