Release For Plugin Developers
#1
Update Announcement

Well i was bored so i made this little code which i think will help you as well as plugin users to know if any update arrived so it will be easy for them to update as well as for you also.

Code:
using System; using System.Collections.Generic; using System.Text; using Addon; using System.Threading; using System.Net; namespace announcement { public class announcement : CPlugin { public void update() { while (true) { WebClient client = new WebClient(); string current_version = "1.02"; string str; str = client.DownloadString("http://www.yoursite.com/text.txt"); if (str != current_version) ServerSay("your update text", false); Thread.Sleep(90000); } } public override void OnServerLoad() { new Thread(new ThreadStart(update)).Start(); } } }
Well hope you guys like it. Wink
Reply

#2
One question, why do you make a while loop? You can call the function on OnMapLoaded() without a loop.
Reply

#3
me no make plugins but this is nice & useful.
[Image: r212360a129ce9b84444093b6cd2699013a1fbn155.png]
Reply

#4
(02-18-2012, 17:18)masterbob Wrote: One question, why do you make a while loop? You can call the function on OnMapLoaded() without a loop.
Well that's depend on you how to use it its just an example and well its not OnMapLoaded() its OnMapChange() and 110% chances message will not show OnMapChange(). Well i personally used it in this wayTongue
Code:
using System; using System.Collections.Generic; using System.Text; using Addon; using System.Net; namespace update { public class update : CPlugin { public override ChatType OnSay(string Message, ServerClient Client) { if (Message.StartsWith("!update")) { try { WebClient client = new WebClient(); string current_version = "1.02"; string version; string Msg; version = client.DownloadString("http://www.yoursite.com/version.txt"); Msg = client.DownloadString("http://www.yoursite.com/text.txt"); if (version != current_version) { TellClient(Client.ClientNum, "^2PM: ^3" + Msg, true); } else { TellClient(Client.ClientNum, "^2PM: ^3You have an updated version.", true); } return ChatType.ChatNone; } catch { } TellClient(Client.ClientNum, "^3PM: ^1Server is not responding try another time.", true); return ChatType.ChatNone; } return ChatType.ChatContinue; } } }

Reply

#5
it can be operated with the addition of addon 1.414???
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
Wink Plugin with !ban !kick and !tampban clemi555 3 6,495 11-09-2013, 09:21
Last Post: clemi555
  AntiNoScope Plugin clemi555 5 7,594 11-08-2013, 19:13
Last Post: clemi555
  [Release] Bunker Plugin 1.3 archit 68 55,875 10-30-2013, 11:59
Last Post: clacki
  Help Modifying plugin maverigh 5 7,644 10-19-2013, 10:29
Last Post: Nekochan
Shocked [Request] Switch plugin axel-le-meilleur 6 8,299 10-19-2013, 06:59
Last Post: iRoNinja
  [Release] Yurio Map Plugin Yurio 101 82,132 09-26-2013, 13:38
Last Post: First_Semyon
Brick [Release] v1.1 ChangeMap/NextMap Plugin without any configuration milchshake 23 25,188 09-23-2013, 13:18
Last Post: SgtLegend
  Help !say Plugin (like the !say from GodPlugin) Hallla 0 3,656 09-13-2013, 09:31
Last Post: Hallla
Rainbow [Release] MW3: Random Weapon Plugin V1 Nekochan 50 44,713 09-11-2013, 15:11
Last Post: EnVi Sweden Rocks
  Search Plugin Fluid Killcam N3xT_974 1 3,979 09-10-2013, 20:27
Last Post: Nekochan

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2026 Melroy van den Berg.