Jump to content

AJXB

Members
  • Posts

    370
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by AJXB

  1. Ehm.. I don't believe you can, "maybe", just maybe using some functions like setPedAnimation and by attaching the element to the bodypart, just maybe it's possible.
  2. AJXB

    Problem?

    Oh god, it was set to "Min".. lol :3 thanks mate
  3. Great job, but I installed it on Submile Text 2 and it worked, but when I restart the application (Submile Text) the syntax at the "view" tab is gone.. it works one time only
  4. AJXB

    Problem?

    I'm having this problem.. in one server, not all servers, Any solution?
  5. Advertising does not apply on free stuff, this is a free skin, sue me. No need to be a :~. Sorry..
  6. Advertising does not apply on free stuff, this is a free skin, sue me.
  7. Freedom of speech mate.. Mute me
  8. The difference is with windows shapes, for now.
  9. AJXB

    [TUT] Basic Lua

    I could give you my account, you can fix it if you want, because it can't get more organized, afaik =] You're more than welcome..
  10. AJXB

    [TUT] Basic Lua

    This tutorial needs an open minded person, a clever one, someone uses common sense. What is Lua? Lua is a powerful, fast, lightweight, embeddable scripting language. Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, runs by interpreting bytecode for a register-based virtual machine, and has automatic memory management with incremental garbage collection, making it ideal for configuration, scripting, and rapid prototyping. Where does Lua come from? Lua is designed, implemented, and maintained by a team at PUC-Rio, the Pontifical Catholic University of Rio de Janeiro in Brazil. Lua was born and raised in Tecgraf, the Computer Graphics Technology Group of PUC-Rio, and is now housed at Lablua. Both Tecgraf and Lablua are laboratories of the Department of Computer Science of PUC-Rio. Notes about Coding in MTA:SA: 1. Before you start, you will need a lua editor, you can choose one of the following: Unofficial MTA script editor Notepad++ 2. Letters state is very important, you can't write outputchatbox, it should be outputChatBox . 3. Colors mixed with other colors will form a different color, example: 255 red and 0 green and 0 blue will return plain RED, if we add 100 green, the result will be a color between red and green combined. 4. Each function will need an end, so you must add end at the end of the function's body, example: after outputChatBox and any code you want to use, put end to close the function. Lua regarding coding in Multi Theft Auto:San Andreas framework: Coding using Lua inside MTA:SA frame is different of the original Lua, as MTA:SA has its own custom functions, no other game have them, nor original Lua. Lua coding in MTA:SA must contain 2 essential parts, the Meta.xml file, the server side, or the client side, or BOTH, Each side is represented as a file, we'll call it a script. Something about each part: Meta.xml: This is the identification part of each resource, in other words, it will tell the MTA:SA Server that this resource contains these scripts. Format: <info author="AuthorName" type="Type[script,misc,gamemode,map]" version="Resource's version" name="Resource's name" description="Resource's Description" /> <script src="PathToFirstScript.lua" type="Server or Client (Side)"/> <script src="PathToSecondScript.lua" type="Server or Client (Side)"/> </meta> How to make a Meta.xml file? Just copy the code above, and save it as meta.xml file. Example: A resource that contains 2 sides, Client and Server sides, the Client side script is called "Client.lua", the Server side script is called "Server.lua", it will have this meta.xml code: <meta> <info author="Aboud" type="script" version="1.0" name="Example resource" description="Example resource" /> <script src="Server.lua" type="Server"/> <script src="Client.lua" type="Client"/> </meta> There, we've finished the meta.xml basic part, this file is not hard, it does have many sides though. Server.lua: This is one of the parts that we can't make a format for, its dynamic, it will be formatted as you desire, as the purpose of the resource, All i can say about this, is that is connected to the server, in every way, unlike the other side that we will see later on. Format: N/A How to make a Server.lua file? Copy the code below, and save as Server.lua. Example: I'll make an example about three resources, the first one will Output a message to the chatbox, the second one will kill the player (You), the third one will warp you to a position (LS-LV-SF), anywhere. First example: After we've made the Server.lua, an empty file with the .lua extension. First step we will do is to make a new function, a function is a.. meh, a function something the script will do, when ever i trigger it. Function syntax: function FunctionName (Arguments..,...,...) Its a simple syntax, the arguments thingy, you will learn later on. Next step we will need to do is to use outputChatBox code, this code will output a message to the main chat box. outputChatBox syntax: outputChatBox ("The Text",[thePlayer,Color:R,Color:G,Color:B,ColorCoded]) Let me explain, -"The Text" is the text you want to output to the chat box, for example: "This is a test" -thePlayer is the element you want the text to appear to, example, getRootElement () (ALL elements inside the server - Players) -Color:R: is a number between 0-255 that will define the red color the text will contain, 0 for NONE and 255 for absolute RED, Check note #3. -Color:G: is a number between 0-255 that will define the green color the text will contain, 0 for NONE and 255 for absolute GREEN, Check note #3. -Color:B: is a number between 0-255 that will define the blue color the text will contain, 0 for NONE and 255 for absolute BLUE, Check note #3. -ColorCoded: if you are using color codes in the text, then put true if not, then put false , it can be only these two options, true or false, simple words, simple form, example of color codes, #FFFFFF For white. Now, we know what is meta.xml, server.lua, a function, and outputChatBox . Next step is very important, you MUST add an end at the end of the function, Check note #4. We now have the function, last thing we need is to trigger the function, how? let me show you. Each function you add, must be triggered at some point, else, why add it? there are many codes to trigger a function, some Server sided, others client sided, some even BOTH. we'll use addCommandHandler addCommandHandler: this is a code that will trigger a function when a command is put, example, when i execute the command /kill, it will trigger a function that will kill me, as a player. addCommandHandler syntax: addCommandHandler ("TheCommand",theFunction) Example: let's say i want to trigger a function called (TheFunction), using the command "trigger". the code will be: addCommandHandler ("trigger",TheFunction) Our final code will be: The File is: meta.xml <meta> <info author="Aboud" type="script" version="1.0" name="Example resource" description="Example resource" /> <script src="Server.lua" type="Server"/> </meta> There won't be a Client side, as we are not using it, yet. The File is: Server.lua function TheFunction () outputChatBox ("The Text",getRootElement(),255,0,255,true) end addCommandHandler ("trigger",TheFunction) All done, now you can start the server, start the resource, and do /trigger. The second resource: We will need a new function, but this function will be a little different, we will use an argument. Example: function theFunction (thePlayer) Let's start, we will create a new meta.xml, and a new server.lua, i won't repeat above steps. A new function: function theFunction (thePlayer) now, a new code line, that will kill the element (thePlayer) is: killPed killPed syntax: killPed ( thePlayer, theKiller) Example: killPed (thePlayer,thePlayer) this code will kill the player (You) or anyone who triggers the function, and the killer will be the same player. Now, nothing is really complicated, same above steps, the result will be, same Meta.xml file, and Server.lua: function theFunction (thePlayer) killPed (thePlayer,thePlayer) end addCommandHandler ("trigger",theFunction) Now we save, and go in game, it should work fine. we reach the third resource, and the last of this tutorial, written by Aboud =] The third one will warp you to a position. What is warp? Changing your position into another, example, warp to LV, will set your position to some point in LV you define, the point will be defined by 3 points, numbers, coordinates, X,Y,Z X = The position according to "X" Y = The position according to "Y" Z = The height above the point 0 (Sea level) Let's start, we will use the same method as before, but with a different code, we'll use setElementPosition This code will set the element's position, any element, as long as the script can define it. setElementPosition syntax: setElementPosition (theElement,x,y,z) Example: setElementPosition (theElement,10,10,2) Let's use it inside our Server.lua script, i expect you to do it yourself, it's not that hard. Result will be, Same meta.xml, Server.lua: function theFunction (thePlayer) setElementPosition (thePlayer,10,10,2) end addCommandHandler ("trigger",theFunction) In short, Lua is easy, if you got time + if you are willing to know, REALLY willing, not anyone can learn this. Lua is a huge world, of words you put together to make a working script, you will need time to get it done, this is only the start. This tutorial is for anyone who is willing to learn, for any further questions, you can send me a personal message, here. Regards, Aboud. P.S: This took me 2 hours to write, it takes 20 seconds to write a thank you!
  11. Well, many asked this question, I would like to share this tutorial I just made. I've posted it on my website, I'll add a link to it, because I used HTML to make it, no surveys etc.. I don't believe it's advertisement if it's my free website e.e Steps: 1. Setup Static IP 2. Open ports 3. Setup server 4. Start server THE TUTORIAL P.S: I'm not getting anything out of, so if you can spend 5 seconds to say "Thank you" IF it helped you, It would be really nice If it's against the rules, I can transform it to BBCode and post it here, though it will take much time ._. Kind regards, Aboud.
  12. Hello, this is not my theme, It's made by a friend of mine, Castiel aka CastielRecords Well I published it on my own website, but I'll give a preview here, and the download is on my website He did a great job, this must be published. PS: All credit goes to him. Preview: Sorry if it's low quality, you can download and try ^^, This might be updated by the author, I just made this topic as a motive, or a gift DOWNLOAD Kind regards, Aboud.
  13. When you are changing the server port you need to change the HTTP Port according to it, for example: If you changed the server port to 22004 (means +1 than default [22003]) you need to change the HTTP also +1 so it will be 22006 (as 22005 was default)
  14. I solved it by adding lastTick = getTickCount( ); everytime the value changes, as FabioGNR advised Thank you
  15. What can I do to change that? I mean what could cause it ?
  16. Well, to explain, there are 2 steps, Open, and close, When I open it, all good, close works too, but the animate, the interpolatebetween and the OutElastic aren't working, When I open it for the second time, It only sets the position, Like interpolateBetween doesn't exist.
  17. It is, outside of this code, I put "state = 'CloseIt'"
  18. local px, py = guiGetPosition ( pic,false ) local sx,sy = guiGetScreenSize () function onRender( ) if state == 'OpenIt' then local nx, ny = interpolateBetween ( px, py,0,px,(py/3)+85,0,getProgress( 3000 ),"OutElastic",0.3, 1.0 ) guiSetPosition( pic, nx, ny, false ) elseif state == 'CloseIt' then local nx, ny = interpolateBetween ( px, py,0,px,(py/3)+475,0,getProgress( 3000 ),"OutElastic",0.3, 1.0 ) guiSetPosition( pic, nx, ny, false ) end end addEventHandler( 'onClientRender', root, onRender ); So I've managed to kinda make it move in the way I want, but when I trigger a function that will open the picture and trigger another to close it, it does not animate like it used to, I mean first time I start the resource and trigger openIt, OutElastic works, then I close it, Now the second time I open it, It doesn't animate, what's the issue ?
  19. AJXB

    interpolateBetween

    well I don't really understand what you have changed, you did change this (py/3)+475 to (py)/3+475 and this caused wrong math Anyway, I guess you tried, appreciate it
  20. function onRender( ) local px, py = guiGetPosition ( pic,false ) local sx,sy = guiGetScreenSize () local nx, ny = interpolateBetween ( px, py,0,px,(py/3)+475,0,getProgress( 7500 ),"OutElastic",2,2,2) guiSetPosition( pic, nx, ny, false ) end addEventHandler( 'onClientRender', root, onRender ) I don't know what am I doing wrong, but this image, is only moving, not jumping and such.. if you know what I mean, OutElastic shouldn't be Linear NOTE: pic is created, getProgress function is added 2,2,2 is added because I don't really know what these numbers do e.e
  21. It's a really great idea, yet a great preview, Looking forward for the release, if there will be one. About the restricted websites, an updated list will do, MySQL based list, updated with a general list of websites + websites reported by users, that's my opinion.
  22. Castillo is right, as much great work you did there, good job and keep it up! but many people will use GUIeditor because it has more features in a really easy-to-use way I'm sure you can use your Lua skills to create something unique!
×
×
  • Create New...