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

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


    Small lua starter tutorial

    Share
    avatar
    Comp_uter15776
    Admin

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

    Small lua starter tutorial

    Post by Comp_uter15776 on 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



    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.


    _________________
    Owner of Comp_uter Gaming
    Owner of #cog @ irc.bw-gaming.com on IRC
    Nicknames: Harry, Comp_uter15776, Admin
    Armoured Personnel C


    Some statistics! Very Happy

    Comp_uter Gaming fully functional: 10%
    Renegade server fully functional: 55%
    SA-MP server fully functional 30%

      Current date/time is Sun May 27, 2018 7:31 pm