Error:Code:// plugin TDC_Core private void Give(BasePlayer player, string item, int amount, ItemContainer container, out bool success, out String itemdesc) ... success = true; itemdesc = "123"; return;// in another method, other plugin TDC_Admin [PluginReference("TDC_Core")] Plugin PTDCCore; .... bool success; String itemdesc; PTDCCore.Call("Give", (BasePlayer)TargetPlayer, Item, Amount, (ItemContainer)((BasePlayer)TargetPlayer).inventory.containerMain, out success, out itemdesc);
error CS1615: Argument `#6' does not require `out' modifier. Consider removing `out' modifier
What I'm doing wrong?![]()
Using out with external plugin (C#)
Discussion in 'Rust Development' started by TDC | Insnee, May 21, 2015.
-
Wulf Community Admin
Argument `#6' does not require `out' modifier. Consider removing `out' modifier
-
Yes, but it's not working, if out is not set. I want to receive these 2 variables and use them
[DOUBLEPOST=1432292762,1432228314][/DOUBLEPOST]Tried to use a struct for this. Failed.
Error:
Core PluginCode:[Oxide] 1:03 PM [Error] Failed to call hook 'help' on plugin 'TDCAdmin' (InvalidCastException: Cannot cast from source type to destination type.) [Oxide] 1:03 PM [Debug] at Oxide.Plugins.TDCAdmin.help (.BasePlayer player, System.String command, System.String[] args) [0x00000] in <filename unknown>:0 at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
Admin PluginCode:struct SGiveItem { public bool Success { get; set; } public string ItemDescription { get; set; } } private SGiveItem GiveItem(BasePlayer player, string itemname, int amount, ItemContainer container) { ... return new SGiveItem(){Success=true,ItemDescription=description}; }
Code:struct SGiveItem { public bool Success { get; set; } public string ItemDescription { get; set; } } [ChatCommand("admin")] void help(BasePlayer player, string command, string[] args) { ... SGiveItem GiveItemResponse; GiveItemResponse = (SGiveItem)PTDCCore.Call("GiveItem", (BasePlayer)TargetPlayer, Item, Amount, (ItemContainer)((BasePlayer)TargetPlayer).inventory.containerMain);Last edited by a moderator: May 26, 2015 -
anyone?
-
Wulf Community Admin
