Comp_uter Gaming

Please Login Or Register, you cannot post or view certain forums as a guest. Why not join the community today?

Comp_uter Gaming

Would you like to react to this message? Create an account in a few clicks or log in to continue.
Comp_uter Gaming

The official site for Comp_uter Gaming, home of the Comp_uter Community! Now linked with C-4 Gaming!


    Small lua starter tutorial

    Comp_uter15776
    Comp_uter15776
    Admin


    Posts : 116
    Join date : 2010-07-16
    Age : 34
    Location : England

    Small lua starter tutorial Empty Small lua starter tutorial

    Post by Comp_uter15776 Sat Apr 30, 2011 8:18 pm

    Download Notepad ++ by searching google.
    When you are all set up and ready to start scriping, or learning look at all this code here -> http://pastebin.com/G1xMQgxB

    And for a visual Aid of how it should look =p
    Small lua starter tutorial Luatut


    The line "if Message == "!rail" then" it is important to have both equal signs or it will not work. You must always close off the quotation of what you want to trigger the statement, e.g. "!rail with no end " would mean everything after that is part of the quot until there is another ".

    T he next line Gets how much money you have, and compares it to how much you need, if you have enough, it will proceed with the action, if not, it proceeds to the "else" part of the if statement. If the condition is met it will submit a message (input console(for that part you can do msg, pamsg, amsg, ppage) ) with what ever you put inside the quotes. Then it goes to the next line which gets your current money, subtracts the cost you set, and goes on to the next line. This line actually goes and gets the weapon, and gives it too you. This next line is what happens if the "if" condition is not met. It sends a message personally to the player that they do not have enough money for the purchase.




    You should notice the green text after the --, that just means it is a note that i wrote for you too see, and you do not need to add it. It has no effect on the code itself, it is strictly a learning tool. Pay attention to what is highlighted in green, i typed it up for you to see the the workings of everything.

    Always remember these http://pastebin.com/G5DNvZ4y. This is your basic lua plugin and has everything needed to begin scripting.

    Paste between the sName line and the return 1 line.

    For a list of all the weapons and vehicles, and along with other things go to the renegade preset list here -> http://www.renegadewiki.com/index.php?title=List_of_Presets You can also access the presets via Level Edit.

    Make sure you understand the code before you do anything. If you have any questions just pm here, post on this topic, or pm me on irc.

      Current date/time is Thu Mar 28, 2024 12:35 pm