Jump to content

Revolt

Members
  • Posts

    113
  • Joined

  • Last visited

Everything posted by Revolt

  1. local color = {[0] = 0, [1] = 100, [2] = 200} local increment = 5 function changeColor() for k in ipairs(color) do color[k] = color[k] + increment if (color[k] > 255) then color[k] = -255 end end setVehicleColor(theVehicle, math.abs(color[0]), math.abs(color[1]), math.abs(color[2]), math.abs(color[0]), math.abs(color[1]), math.abs(color[2])) end local timer = setTimer(changeColor, 50, 0) Maybe something like this would work for some kind of rainbow? If you really wish for a rainbow color, then you should define the desired colors and interpolate between them infinite times...
  2. Hmm, I'm not sure what do you mean by 'raimbow like the car colors ones'.
  3. https://wiki.multitheftauto.com/wiki/RGBToHex Rainbow color code example: outputChatBox("#FFFF00T#FFD700E#FFA500S#FF8C00T#FF45001", root, 255, 255, 255, true) It will output: TEST1
  4. function model() txd = engineLoadTXD ( "lib_street06.txd" ) engineImportTXD ( txd, 3907 ) dff = engineLoadDFF ( "lib_street06.dff" ) engineReplaceModel ( dff, 3907 ) end addEventHandler ( "onClientResourceStart", resourceRoot, model ) function fegyo() local weapon = createWeapon("ak-47") setWeaponAmmo(weapon, 120) setWeaponClipAmmo(weapon, 32) setWeaponState(weapon, "firing") setElementAlpha(weapon, 0) local newGun = createElement(object, 3907) attachElements(weapon, newGun) end addCommandHandler("fegyver", fegyo) Try this.
  5. If you are referring to physical memory, then you can just right click on them and see how much space they take. However, if you are referring to RAM memory, that is a bit trickier, and depends on numerous other factors such as player count.
  6. If I understood you properly, you wish to make your resources smaller in size, right? If so, you could compile them.
  7. Account = {} Account.__index = Account function Account.create(balance) local acnt = {} -- our new object setmetatable(acnt,Account) -- make Account handle lookup acnt.balance = balance -- initialize our object return acnt end function Account:withdraw(amount) self.balance = self.balance - amount end -- create and use an Account acc = Account.create(1000) acc:withdraw(100) Take this for example (from http://lua-users.org/wiki/SimpleLuaClasses ) The difference is that you can call Account.create(..) without having an instance of the class available, but to call withdraw you must have a class instance to perform withdrawal on.
  8. No, that Lua code you given was completely unrelated to pointers. It is practically impossible to use pointers (aside from user-data elements or tables, which can't be manipulated) in Lua. As of your other code, k is actually the enumerator value, and the v is an actual element. If you print the value of k, you would get a number (for example, 1 if your element is the first in the table, 2 if it's the second...), but if you print the value of v, you would get the actual pointer to the class in memory.
  9. You could either make the GUI smaller, or you could make it relative. wVehicles = guiCreateWindow(X, Y, Width, Height, "Vehicles", true) But then you should divide every element's X and Y with the targeted perfect resolution's width and height, so you can get a value between 0 and 1 (example if your target resolution is 1366x768, and the element's location is 683, 384, then use 0.5, 0.5)
  10. Should work fine, I think.
  11. Actually, pointers are not accessible in Lua (my example was in C). The thing you're doing in Lua is just copying one value (a) and setting the other one (b). And for the other code, you could do outputChatBox(tostring(v)) -- not k, and you could see the actual value.
  12. addEventHandler ( 'onPlayerLogin', getRootElement ( ), function () triggerClientEvent ( source, "onClientPlayerLogin", resourceRoot ) end )
  13. Major price drop. Add me on Skype or PM me, I'll give you a real-time tour of the resources for free. Skype username: friedonibot
  14. Of course you're not dumbsezz. You're Droam|Oussez
  15. Well... Someone might help you fix it if you post more data about the problem you're facing (in proper English).
  16. User-data is a type of variable in Lua. You don't need to know anything about it unless you wish to integrate Lua into your C/C++ application. Basically what it is is a pointer to the real class created in C/C++. As of pointers, they are a type of data that actually does not store what it represents in it self, yet is stores a pointer (a location; address) to that data. For example, let's say you declare this integers (simplified): int a = 62; // imagine this is stored at the 0x00000001 memory address int b = 241; // 0x00000005 int c = 352; // 0x00000009 int* _b = &b; // the value data of _b is actually 0x00000005, but since it is a pointer (declared int*), when used in code (as *_b), it will represent whatever b is representing (it is 241 now) printf("%i", *_b); // the print function, it prints out 241 b = 5; // because _b is a pointer, it points to the value of b, and therefore if you use _b, it will point to the data whose value now is 5 printf("%i", *_b); // prints out 5; notice how we only changed b, yet the value of *_b is still same as the value of b I tried simplifying it, but I'm pretty bad at explaining anything, so rather use cplusplus.com to learn.
  17. No-one will help you fix stolen scripts.
  18. local newFont = guiCreateFont("font_file.ttf", 25) guiSetFont(Name_Group_Label, newFont)
  19. Player, Vehicle, Object... are not actually classes, rather they're light user-data pointers. The difference would be that the MTA team hasn't implemented any class functions into Lua, so we have to use global functions to modify any class attributes. Also table does not require a key enumerator. local t = {"a", "b", "c"} for a, b in ipairs(t) do print(tostring(a) .. ": " .. b) end -- Output would be: -- 1: a -- 2: b -- 3: c
  20. You're probably right. Those guys kept sending me PMs to fix their code (in some kind of odd language), and I foolishly did not realizing that the errors were foolish (any scripter that made those scripts he was sending me could realize the issue himself). Anyway, I'm not helping him anymore.
  21. Be more specific. Which part doesn't work?
  22. If you wish to learn about programming and how computers work in general, I recommend you to read some C++ book. To explain these concepts to you fully, an user would have to spend a lot of time writing, so since there already exist a hefty load of resources for you to learn from, it is a waste of time and, therefore, no-one will do it.
×
×
  • Create New...