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
Rainbow [Release] Plugin ReservedSlot v1.3 frst_ 1 4,996 11-08-2018, 19:17
Last Post: frst_
Tongue [Release] MW3 Shop plugin Dude 56 51,303 03-25-2018, 05:18
Last Post: [email protected]
  [Release] Permission plugin Pozzuh 202 163,924 05-01-2017, 15:41
Last Post: W4R||The Hyper
  [Release] FIXED SPEED PLUGIN hillbilly 2 5,656 06-02-2016, 20:23
Last Post: clacki
  [Release] Bots Plugin For Users Casper 22 39,851 08-22-2015, 17:45
Last Post: SnapBacks
  [Release] God Plugin v5.0 [Ingame Rcon Tool] OzonE 464 335,832 06-27-2015, 15:38
Last Post: bluedot
  [Release] Anti Hardscope Plugin 8q4s8 26 27,596 06-20-2015, 22:44
Last Post: urj88419
  [Release] ProMod Plugin zxz0O0 875 761,622 03-25-2015, 22:02
Last Post: kris
  [Release] [Discontinued] Speed Plugin Pozzuh 164 121,952 10-06-2014, 12:56
Last Post: Nekochan
  [help]how create a ping plugin clacki 3 5,077 09-13-2014, 01:23
Last Post: clacki

Forum Jump:


Users browsing this thread:
1 Guest(s)

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