yoloman Posted February 6, 2015 Share Posted February 6, 2015 I have this Code: if (Player.Character.Armor > 0) { if (Player.Skin.Component.Bags.ModelIndex == 0) { Player.Skin.Component.Bags.ModelIndex = 2; }} else if (Player.Skin.Component.Bags.ModelIndex == 2) { Player.Skin.Component.Bags.ModelIndex = 0;} and want to know If I should compile it from a .txt to a .c or can I just write it in the Notepad and save it as a .c file. And then I want to know how to compile it to an script (.cs, .net, etc.) and which is best of them? Link to comment https://gtaforums.com/topic/765759-question-about-scripting/ Share on other sites More sharing options...
Jitnaught Posted February 6, 2015 Share Posted February 6, 2015 (edited) .c file extensions are for the C programming language, so you should NOT use this for what you are coding in (C#). Also, .c is for source code, it is not compiled code. .cs is also for source code. .cs is what you should be coding in, not a .txt file. If you want, you can put this in the scripts folder and .NET Scripthook will automatically compile it in run time and run it. .net is really just a .dll file. To compile to a .dll file, create a Visual Studio (2010+) project, add a reference to the ScriptHookDotNet.dll file (in the "For Developers" folder in the scripts folder), copy your code to the newly created class in the Visual Studio project, then click Build -> Build Solution. Now go to where you created the project file (default is "C:\Users\<username>\Documents\Visual Studio 2013\Projects\<projectname>\", then go to bin -> Debug (unless you compiled it for Release or another platform like x86 (which you should)) and copy the <projectname>.dll file to your scripts folder and rename it to <projectname>.net or <projectname>.net.dll. I also recommend to code in Visual Studio, and not in a normal text editor like notepad. It makes things a lot easier. Oh and P.S. If you need to know how to do things like "add a reference to the ScriptHookDotNet.dll file", just Google it (not the "ScriptHookDotNet.dll part"). Edited February 6, 2015 by LetsPlayOrDy Link to comment https://gtaforums.com/topic/765759-question-about-scripting/#findComment-1066930315 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now