verveplay

Update Checking Example

Jan 16th, 2022 (edited)
1,098
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ///SCRSETGLOBALOPTIONS
  2. global.checkForUpdates = true;
  3. global.versionDataUrl = "https://pastebin.com/raw/Z5sWFNap";
  4. global.gameVersion = "1.0";
  5.  
  6. ///GAME START
  7. if (global.checkForUpdates)
  8. {
  9.     global.httpUpdateCheck = http_get(global.versionDataUrl);
  10. }
  11.  
  12. ///HTTP
  13. var Id = async_load[? "id"];
  14. var status = async_load[? "status"];
  15. var result = async_load[? "result"];
  16.  
  17. if (Id == global.httpUpdateCheck)
  18. {                
  19.     if (status == 0)
  20.     {                        
  21.         var map = json_decode(result);
  22.         if (map != -1)
  23.         {
  24.             global.newestVersionNumber = map[? "game-version"];
  25.             global.newestVersionLink = map[? "download-link"];
  26.             global.isUpToDate = (global.gameVersion == global.newestVersionNumber);
  27.         }
  28.     }
  29. }
Add Comment
Please, Sign In to add comment