Absolut submitted a new resource:
ImageLibrary - A Plugin to Manage External Images - For Devs
Read more about this resource...
ImageLibrary
Moved
Total Downloads: 18,288 - First Release: Oct 29, 2016 - Last Update: Jun 11, 2018
- 5/5, 36 likes
-
I added the new items and fixed the ulong to int error... waiting to test.. damn server!
-
Absolut updated ImageLibrary with a new update entry:
1.1.0
-
Big Like!!!
-
-
Absolut updated ImageLibrary with a new update entry:
1.2.0
-
Can you add new Components images to the Library?
-
OnServerInitialize add some AddImage lines as such:
Code:AddImage("http://cdn.mysitemyway.com/etc-mysitemyway/icons/legacy-previews/icons/simple-black-square-icons-arrows/126517-simple-black-square-icon-arrows-double-arrowhead-left.png", "FIRST"); AddImage("https://image.freepik.com/free-icon/back-left-arrow-in-square-button_318-76403.png", "BACK"); AddImage("https://image.freepik.com/free-icon/right-arrow-square-button-outline_318-76302.png", "NEXT"); AddImage("http://cdn.mysitemyway.com/etc-mysitemyway/icons/legacy-previews/icons/matte-white-square-icons-arrows/124577-matte-white-square-icon-arrows-double-arrowhead-right.png", "LAST"); AddImage("http://oxidemod.org/data/resource_icons/1/1751.jpg?1456924271", "SR");
Code:AddImage("http://vignette3.wikia.nocookie.net/play-rust/images/6/66/Glue_icon.png/revision/latest/scale-to-width-down/50?cb=20161109045933", "glue"); AddImage("http://vignette2.wikia.nocookie.net/play-rust/images/7/72/Gears_icon.png/revision/latest/scale-to-width-down/50?cb=20161109045908", "gears");
-
Absolut updated ImageLibrary with a new update entry:
1.2.1
-
Code:
#region GUI Dictionary<ulong, string> guiInfo = new Dictionary<ulong, string>(); void NoClipGui(BasePlayer player) { // Destroy existing UI string gui; if (guiInfo.TryGetValue(player.userID, out gui)) CuiHelper.DestroyUi(player, gui); var elements = new CuiElementContainer(); guiInfo[player.userID] = CuiHelper.GetGuid(); elements.Add(new CuiElement { Name = guiInfo[player.userID], Components = { new CuiRawImageComponent { Color = "1 1 1 0.8", Url = "http://img.hb.aicdn.com/ac719cab1bb438f5131a300f434c1ac7f3828b9054b8-1fkoU8_fw658" }, new CuiRectTransformComponent { AnchorMin = "0.06 0.017", AnchorMax = "0.105 0.08" } } }); // Create the UI elements CuiHelper.AddUi(player, elements); } #endregion
Last edited by a moderator: Nov 17, 2016 -
Code:#region GUI //MAKE SURE THIS IS AT THE VERY TOP... using Oxide.Core.Plugins; //ADD this [PluginReference] Plugin ImageLibrary; void OnServerInitialized() { try { ImageLibrary.Call("isLoaded", null); } catch (Exception) { PrintWarning("No Image Library.. load ImageLibrary to use this Plugin", Name); Interface.Oxide.UnloadPlugin(Name); return; } AddImage("IMAGE URL HERE", "IMAGE_NAME_HERE", "SKIN OR ID IF APPLICABLE"); //Add AS MANY OF THESE AS YOU WANT... The IMAGE NAME SHOULD BE IN A GetImage(Somewhere in the mod...) } //ADD THESE public string GetImage(string shortname, ulong skin = 0) => (string)ImageLibrary.Call("GetImage", shortname, skin); public bool AddImage(string url, string shortname, ulong skin = 0) => (bool)ImageLibrary?.Call("AddImage", url, shortname, skin); Dictionary<ulong, string> guiInfo = new Dictionary<ulong, string>(); void NoClipGui(BasePlayer player) { // Destroy existing UI string gui; if (guiInfo.TryGetValue(player.userID, out gui)) CuiHelper.DestroyUi(player, gui); var elements = new CuiElementContainer(); guiInfo[player.userID] = CuiHelper.GetGuid(); elements.Add(new CuiElement { Name = guiInfo[player.userID], Components = { new CuiRawImageComponent { Color = "1 1 1 0.8", Url = "http://img.hb.aicdn.com/ac719cab1bb438f5131a300f434c1ac7f3828b9054b8-1fkoU8_fw658" },/*CHANGE THIS... TO...This =>>> */new CuiRawImageComponent {Png = GetImage("IMAGE_NAME_HERE", "SKIN OR ID IF APPLICABLE") }, new CuiRectTransformComponent { AnchorMin = "0.06 0.017", AnchorMax = "0.105 0.08" } } }); // Create the UI elements CuiHelper.AddUi(player, elements); } #endregion
-
WOW!It's work! Thank for your guide
I have a question.
How to Refresh Cheche?
When i use this one [ConsoleCommand("RefreshAllImages")]
IMG don't show any more.
And i got this...
Code:16:36 [Error] Failed to call hook 'AddImage' on plugin 'ImageLibrary v1.2.1' (NullReferenceException: Object reference not set to an instance of an object) 16:36 [Debug] at Oxide.Plugins.ImageLibrary.HasImage (System.String shortname, UInt64 skin) [0x00000] in <filename unknown>:0 at Oxide.Plugins.ImageLibrary.AddImage (System.String url, System.String name, UInt64 skin) [0x00000] in <filename unknown>:0 at Oxide.Plugins.ImageLibrary.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Core.Plugins.Plugin.CallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
-
And when i restart Server.
I got this...
Code:[11/18/2016 22:26:34] [Oxide] 22:26 [Debug] at Oxide.Plugins.Vanish.AddImage (System.String url, System.String shortname, UInt64 skin) [0x00000] in <filename unknown>:0 at Oxide.Plugins.Vanish.OnServerInitialized () [0x00000] in <filename unknown>:0 at Oxide.Plugins.Vanish.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Core.Plugins.Plugin.CallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
-
As for your error see if the data file got corrupted somehow; I've seen it a few times... if it is null or you aren't sure simply make sure ImageLibrary is unloaded and delete the ImageLibrary data file. Reload IL and your plugin and you should be good to go.
99% of problems with plugins revolve around data files (at least it seems that way!) -
Why i got white IMG...
[DOUBLEPOST=1479487640][/DOUBLEPOST]Yes. That error because I delete Other plugin DefaultMessages....
I fix it..
And the Other plugin now is okay.
But they IMG all white....
[DOUBLEPOST=1479487728][/DOUBLEPOST]I delete ImageLibrary_Data.json And reload IL.
But there are still problems
[DOUBLEPOST=1479489006][/DOUBLEPOST]I did my best, but still did not work...Attached Files:
-
-
And when i reload plugin...
Attached Files:
-
-
Why it can't get IMG...
Attached Files:
-
-
Just remove this to GUI method
Code:AddImage("IMAGE URL HERE", "IMAGE_NAME_HERE", "SKIN OR ID IF APPLICABLE"); //Add AS MANY OF THESE AS YOU WANT... The IMAGE NAME SHOULD BE IN A GetImage(Somewhere in the mod...) }
-
Can U add OnImageDownloaded(string shortname) hook to 3rd plugins?
-
Some time..
Attached Files:
-