Request Plugin version checker
#1
Hi

Guys to improve my plugin performance i need a simple code to add in to my plugin to check plugin version from my site
and if new version of plugin is released every 3 minute in game say
"New version of Plugin is released pleas See our site".

I have idea to checking new version
1)may have sipmle way such as if in link "www.mysite.com/ver.txt
the valu 1 = new version or if valu 0 no new version and no need to update.
2)or by cheking MD5
3)or...

Thank you.
Reply

#2
Store MD5 (or SHA1) in a www.mysite.com/ver.txt
[Image: azuw.jpg]
Reply

#3
I Think this will help you
this is the one when i tried to do this on God Plugin but Since i Dont have a Site Dumb Bitch So I Removed it from my code

Code:
public override void OnServerLoad try { WebClient up = new WebClient(); string download = up.DownloadString("http://www.mysite.com/update.txt"); string[] downloads = download.Split(','); } if downloads = "1" ServerPrint("Update Is available") //whatever else you wanna add

Inform me if this works or sth else.
Reply

#4
The code is wrong anyway but checking for '1' in a text file doesn't make sense. Sure it will show 'There is an update' but after you updated it will show the message again because the text file still contains '1'. And then if you remove the '1' from the file, the people who haven't updated yet will never receive the update message.
[Image: azuw.jpg]
Reply

#5
hmmm. true.
but still fixable.
i believe ramin can fix it, i dont have time for this.
Reply

#6
Use the version number.
That's what I always do.
if(currentversion != serverversion) launchUpdater()
Reply

#7
Uses System.Net and Sytem.Linq
Code:
private const decimal Version = 1.2m; public overide void OnServerLoad() { WebClient version = new WebClient(); decimal CurrentVersion = decimal.Parse(up.DownloadString("http://www.mysite.com/update.txt")); if(CurrentVersion!=Version) { Timer update = new Timer(int.Parse(GetServerCFG("myplugin","Update Notify","3000")); update.Elapsed+=(sender,e)=> { if(GetSeverCFG("myplugin","UpdateNotifyAdminOnly","false")!="false"&&GetClients()!=null) { foreach(string AdminXUID in GetSeverCFG("myplugin","Admin_XUIDs","").Split(new char[]{',',';'})) { ServerClient Client; if(TellClient(GetClients.Where(Client=>Client.XUID==AdminXUID).ToArray().Length!=0) { Client=GetClients.Where(Client=>Client.XUID==AdminXUID).ToArray()[0]; TellClient(Client.ClientNum,"myplugin:New version available!!"); } } } else ServerSay("myplugin:New version available!!", true); ServerPrint("myplugin:New version available!!"); } update.Enabled=true; } }
UNTESTED
Reply

#8
Hi @archit your code has many problem pleas recheck your code.

thank you.
Reply

#9
Linq is not included in NET 3.0
[Image: azuw.jpg]
Reply

#10
This should work
Code:
public override void OnServerLoad() { WebClient version = new WebClient(); decimal CurrentVersion = decimal.Parse(version.DownloadString("http://www.mysite.com/update.txt")); if (CurrentVersion != Version) { Timer update = new Timer(int.Parse(GetServerCFG("myplugin", "Update Notify", "3000"))); update.Elapsed += (sender, e) => { if (GetServerCFG("myplugin", "UpdateNotifyAdminOnly", "false") != "false" && GetClients() != null) { foreach (string AdminXUID in GetServerCFG("myplugin", "Admin_XUIDs", "").Split(new char[] { ',', ';' })) { ServerClient client; if (GetClients().Where(Client => Client.XUID == AdminXUID).ToArray().Length != 0) { client = GetClients().Where(Client => Client.XUID == AdminXUID).ToArray()[0]; TellClient(client.ClientNum, "myplugin:New version available!!", true); } } } else ServerSay("myplugin:New version available!!", true); ServerPrint("myplugin:New version available!!"); }; update.Enabled = true; }
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
Wink Plugin with !ban !kick and !tampban clemi555 3 6,513 11-09-2013, 09:21
Last Post: clemi555
  AntiNoScope Plugin clemi555 5 7,607 11-08-2013, 19:13
Last Post: clemi555
  MW3 Server Version superg1973 7 17,486 10-28-2013, 01:15
Last Post: kotyra972
  Help Modifying plugin maverigh 5 7,659 10-19-2013, 10:29
Last Post: Nekochan
Shocked [Request] Switch plugin axel-le-meilleur 6 8,317 10-19-2013, 06:59
Last Post: iRoNinja
  Help !say Plugin (like the !say from GodPlugin) Hallla 0 3,664 09-13-2013, 09:31
Last Post: Hallla
  Search Plugin Fluid Killcam N3xT_974 1 3,985 09-10-2013, 20:27
Last Post: Nekochan
  !kill Plugin Hallla 1 3,510 09-07-2013, 22:30
Last Post: axel-le-meilleur
  God Mode Plugin - Everyone has rcon admin srskiller 4 7,846 08-28-2013, 19:03
Last Post: phillipito
  Donator Status Plugin tubwux 1 2,942 08-28-2013, 07:13
Last Post: DidUknowiPwn

Forum Jump:


Users browsing this thread:
1 Guest(s)

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