mirror of
https://github.com/ineedbots/iw4_bot_warfare.git
synced 2025-04-21 21:45:43 +00:00
version checking
This commit is contained in:
parent
50f17c4bb6
commit
080b1bc9ef
@ -8,6 +8,8 @@
|
||||
*/
|
||||
init()
|
||||
{
|
||||
level.bw_VERSION = "2.0.0";
|
||||
|
||||
if(getDvar("bots_main_debug") == "")
|
||||
setDvar("bots_main_debug", 0);
|
||||
|
||||
@ -136,6 +138,29 @@ init()
|
||||
level thread watchScrabler();
|
||||
|
||||
level thread handleBots();
|
||||
|
||||
level thread doVersionCheck();
|
||||
}
|
||||
|
||||
doVersionCheck()
|
||||
{
|
||||
remoteVersion = maps\mp\bots\_bot_http::getRemoteVersion();
|
||||
|
||||
if (!isDefined(remoteVersion))
|
||||
{
|
||||
println("Error getting remote version of Bot Warfare.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (level.bw_VERSION != remoteVersion)
|
||||
{
|
||||
println("There is a new version of Bot Warfare!");
|
||||
println("You are on version " + level.bw_VERSION + " but " + remoteVersion + " is available!");
|
||||
return false;
|
||||
}
|
||||
|
||||
println("You are on the latest version of Bot Warfare!");
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -19,6 +19,18 @@ getRemoteWaypoints(mapname)
|
||||
}
|
||||
}
|
||||
|
||||
getRemoteVersion()
|
||||
{
|
||||
request = httpGet( "https://raw.githubusercontent.com/ineedbots/iw4x_waypoints/master/version.txt" );
|
||||
request waittill( "done", success, data );
|
||||
request destroy();
|
||||
|
||||
if (!success)
|
||||
return undefined;
|
||||
|
||||
return strtok(data, "\n")[0];
|
||||
}
|
||||
|
||||
linesToWaypoints(res)
|
||||
{
|
||||
waypoints = [];
|
||||
|
Loading…
x
Reference in New Issue
Block a user