hi, need convert C# to lua
or from Lua to call a function in C#
Code:using UnityEngine; using Rust;namespace Oxide.Plugins { class Interface : RustPlugin { private void gui_test(BasePlayer player, string json) { CommunityEntity.ServerInstance.ClientRPCEx(new Network.SendInfo() { connection = player.net.connection }, null, "AddUI", json); } } }
C# function convert to Lua or access to function
Discussion in 'Rust Development' started by TheRyuzaki, Jun 7, 2015.
-
The forum is not dead, you are just not a patience person when waiting for help. As for your questions you just need to call it like you would in lua with a few differences. I would advise if you are creating anything GUI related to use C# and not one of the other supported languages.
-
Forgive my impatience, I had hoped to resolve the issue today
I have tried this option, but he swears that the arguments are not correct.
Code:CommunityEntity.ServerInstance.ClientRPCEx(player.connect, nil, "AddUI", json);
[DOUBLEPOST=1433734370,1433698791][/DOUBLEPOST]I want to believe that the forum is not dead = ( I really want to believe. -
Wulf Community Admin
-
Because the arguments are not correct! You need the Network.SendInfo() object as the first arg.
You can use: sendinfo = new( Network.SendInfo._type , nil )
sendinfo.connection = player.net.connection
CommunityEntity.ServerInstance.ClientRPCEx(sendinfo, nil, "AddUI", json) -
Once again I apologize for my impatience. Just I am hoping to do this quickly but alas, I did not know how to announce a class in Lua. Now I'll know)) In general, I would like to become oxide developer and for that I have a good knowledge of C #. But I do not quite understand how it works himself oxide, and can be simply understood. Here we assume you have a class Mysql as I understand it does everything in the parent stream, and in any case expect a response from the database. I have a method that podruzomivaet different options.
Here is an example in PHP:
Code:$Mysql->query('INSERT INTO `accounts` (`username`,`steamid`,`password`,`lastdate`) VALUES (?s,?i,?s,NOW())', $login,$stamid,$pass); $Res = $Mysql->getRow('SELECT `accounts`.*,`accounts_access`.`access_level` FROM `accounts` LEFT JOIN `accounts_access` ON (`accounts`.`steamid`=`accounts_access`.`steamid`) WHERE `steamid`=?i',$steamid); $Res = $Mysql->getAll('SELECT `accounts`.*,`accounts_access`.`access_level` FROM `accounts` LEFT JOIN `accounts_access` ON (`accounts`.`steamid`=`accounts_access`.`steamid`)'); $OnlineUsers = $Mysql->getOne('SELECT COUNT(*) FROM `accounts` WHERE `lastdate` > NOW() - INTERVAL 1 MINUTE');
If I put all the libraries from the official library MYSQL, Can I write a plug-in C # that would interact with it?
[DOUBLEPOST=1433738688][/DOUBLEPOST]https://dev.mysql.com/downloads/connector/net/6.9.htmlLast edited by a moderator: Jun 8, 2015 -
You should be using the MySQL extension for database calls. There are a few examples on the forums. I'm on mobile so I can't search for them.
-
Help! Example PLEASE! Easy Example!
C#:
namespace Oxide.Plugins
public class DevPluge : RustPlugin
public void Log(string message)
need use DevPluge.Log("Hallo world"); Tongue lua