adamix Posted December 17, 2013 Share Posted December 17, 2013 (edited) MTAMono is a module that does bridge between Lua and .Net worlds! It uses Mono framework(http://mono-project.com), .Net-based wrapper, C module and small lua script! It is in a beta stage, but many server features already working good. Example of a small script: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Timers; using MTAAPI; namespace MTAAPI_Sample { public class Events : IIEvents { public static void onConsole(Element source, string text) { string[] args = text.Split('|'); Console.WriteLine("OnConsole: " + text); } public static void onPlayerJoin(Element player) { Player p = player.GetAsPlayer(); Simple.SpawnPlayer(p); Chat.OutputChatBox("Player " + p.GetName() + " joined!", Element.Root, 255, 0, 0, false); } public static bool onPlayerChat(Element player, string message, int messageType) { Console.WriteLine("CHAT: " + player.GetAsPlayer().GetName() + " : msg: " + message); Chat.OutputChatBox(player.GetAsPlayer().GetName() + ": " + message, Element.Root, 0, 255, 0); return false; } } public class Binds : IIBinds { public static void keyBind(Element player, string key, string keyState) { Console.WriteLine("keyBIND! + " + key + " " + player.GetAsPlayer().GetName()); } }; public class Simple : IPlugin { public string GetPluginName() { return "Simple"; } public void Startup() { Console.WriteLine("Simple startup"); MTAAPI.Events.HandleEvent("onPlayerJoin"); MTAAPI.Events.HandleEvent("onConsole"); MTAAPI.Events.HandleEvent("onPlayerChat"); } public static void SpawnPlayer(Player p) { p.Spawn(10.0f, 10.0f, 15.0f); Camera.Fade(p, true); Camera.SetCameraTarget(p, p); Vehicle v = new Vehicle(411, 15.0f, 15.0f, 10.0f); p.WarpIntoVehicle(v); v.SetDamageProof(true); Blip b = new Blip(v); p.GiveMoney(5000); p.SetDoingGangDriveby(true); } } } You can download it from: Module and wrapper: http://unix-net.ru/MTAMono_win32.zip (Win32 binary) http://unix-net... (Linux 32bit - coming soon!) Mono class libraries: http://office.web-hunter.ru/MTAMono_classlibs.rar Okay, installation Extract MTAMono_win32.zip to your server folder Add MTAMono.dll module to "modules" section of your mtaserver.conf Extract MTAMono_classlibs.zip to mods\deathmatch\modules\ Add mtamono resource to your mtaserver.conf Start the server! You will see the Simple script working. For writing your own scripts theres an "src" folder, just open MTAAPI_Simple.csproj, add mods\deathmatch\modules\MTAMonoNet.dll to references and start coding! Documentation with linux version and source code will come soon. Edited December 17, 2013 by Guest Link to comment
Cruze Posted December 17, 2013 Share Posted December 17, 2013 GREAT WORK BRO, keep doing these! Link to comment
laserlaser Posted December 17, 2013 Share Posted December 17, 2013 I thinked on it very long time ago.But I decided to not go to do. Because It can't include client scripts. But It is great for someone who want to make only server-side scripts.So great job bro. Link to comment
adamix Posted December 18, 2013 Author Share Posted December 18, 2013 Of course it can! With some limitations, but still it can! Im working on these right now, some small results: string guid = ClientRPC.Call(player.GetAsPlayer(), "isMTAWindowActive"); ClientRPC.Answer += (g, a) => { if (g == guid) { if((bool)a.var == false) Chat.OutputChatBox("Your window is inactive!"); } }; Link to comment
Renkon Posted December 18, 2013 Share Posted December 18, 2013 YESSSSSSSSSSSSSS!!! EXPECTED THIS FOR SO LONG. I LOVE YA. Link to comment
adamix Posted December 19, 2013 Author Share Posted December 19, 2013 I posted the source code @ GoogleCode: http://code.google.com/p/mtamono ! Link to comment
laserlaser Posted December 25, 2013 Share Posted December 25, 2013 Of course it can! With some limitations, but still it can!Im working on these right now, some small results: string guid = ClientRPC.Call(player.GetAsPlayer(), "isMTAWindowActive"); ClientRPC.Answer += (g, a) => { if (g == guid) { if((bool)a.var == false) Chat.OutputChatBox("Your window is inactive!"); } }; It's good idea but not very useful I think. Link to comment
xXMADEXx Posted January 5, 2014 Share Posted January 5, 2014 Its cool, but wouldn't it just be easier to use lua? Link to comment
Dj-jom2x Posted January 5, 2014 Share Posted January 5, 2014 (edited) cool Edited October 3, 2014 by Guest Link to comment
Cruze Posted January 7, 2014 Share Posted January 7, 2014 cool im a java developer c ++ and java are 90% simillar this will help a lot ORLLY? SO MUCH FUN!!!!! Dude, .net isn't java Link to comment
Dj-jom2x Posted January 8, 2014 Share Posted January 8, 2014 lol i mean close to java :3 read before you post :3 if you are programmer you know what im talking about ,similarities beetween c# or c ++ to java language.. calm dude Link to comment
qaisjp Posted January 8, 2014 Share Posted January 8, 2014 what are stats like? is it any faster using mono than lua? this is only server side, right? looks cool but sophisticated servers would only use this, and they would only use something fast. good job! just stats/benchmarks are needed A better description would be bringing C#* to MTA (not .net ) Link to comment
Microsoft-Developer Posted August 6, 2014 Share Posted August 6, 2014 nice one.. great job. Link to comment
Dj-jom2x Posted November 2, 2014 Share Posted November 2, 2014 im still waiting for documentation .... Link to comment
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