Guest User

Untitled

a guest
Jul 27th, 2015
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.81 KB | None | 0 0
  1. /// oHighScore Display : Create Event
  2.  
  3. r_str = "null";
  4.  
  5. var getscore = 5;
  6.  
  7. tagid = "[censored]";
  8.  
  9. gmsb_post = http_post_string("http://gmscoreboard.com/handle_score.php?tagid="+string(tagid)+"&getscore="+string(getscore),"");
  10.  
  11.  
  12. /// oHighscoreDisplay : HTTP Event
  13.  
  14. r_str = "null";
  15. if ds_map_find_value(async_load, "id") == gmsb_post
  16. {
  17. if ds_map_find_value(async_load, "status") == 0
  18. {
  19. r_str = ds_map_find_value(async_load, "result");
  20. }
  21. }
  22.  
  23. //first decode the json string,
  24. //then you can get each variable by name just like gmsb_status below.
  25. gmsb_map = json_decode(r_str);
  26. gmsb_player1 = ds_map_find_value(gmsb_map , "p1");
  27. gmsb_score1 = ds_map_find_value(gmsb_map , "s1");
  28. gmsb_player2 = ds_map_find_value(gmsb_map , "p2");
  29. gmsb_score2 = ds_map_find_value(gmsb_map , "s2");
  30. gmsb_player3 = ds_map_find_value(gmsb_map , "p3");
  31. gmsb_score3 = ds_map_find_value(gmsb_map , "s3");
  32. gmsb_player4 = ds_map_find_value(gmsb_map , "p4");
  33. gmsb_score4 = ds_map_find_value(gmsb_map , "s4");
  34. gmsb_player5 = ds_map_find_value(gmsb_map , "p5");
  35. gmsb_score5 = ds_map_find_value(gmsb_map , "s5");
  36.  
  37.  
  38. /// oHighscoreDisplay : Draw Event
  39.  
  40. if r_str != "null"{
  41. draw_set_font(fnt_hud);
  42. draw_set_halign(fa_center);
  43. draw_text_colour(room_width / 2, 32, "Regular Mode Top 5", c_black, c_black, c_black, c_black, 1);
  44. draw_text_colour((room_width / 2) + 2, 30, "Regular Mode Top 5", c_white, c_white, c_white, c_white, 1);
  45. draw_text_colour(room_width / 2, 256, "Infinite Mode Top 5", c_black, c_black, c_black, c_black, 1);
  46. draw_text_colour((room_width / 2) + 2, 254, "Infinite Mode Top 5", c_white, c_white, c_white, c_white, 1);
  47. draw_set_halign(fa_left);
  48. draw_text_colour(320,64,"\#1. " + string(gmsb_player1) + string(": ") + string(gmsb_score1), c_black, c_black, c_black, c_black, 1);
  49. draw_text_colour(322,62,"\#1. " + string(gmsb_player1) + string(": ") + string(gmsb_score1), c_white, c_white, c_white, c_white, 1);
  50. draw_text_colour(320,96,"\#2. " + string(gmsb_player2) + string(": ") + string(gmsb_score2), c_black, c_black, c_black, c_black, 1);
  51. draw_text_colour(322,94,"\#2. " + string(gmsb_player2) + string(": ") + string(gmsb_score2), c_white, c_white, c_white, c_white, 1);
  52. draw_text_colour(320,96 + 32,"\#3. " + string(gmsb_player3) + string(": ") + string(gmsb_score3), c_black, c_black, c_black, c_black, 1);
  53. draw_text_colour(322,94 + 32,"\#3. " + string(gmsb_player3) + string(": ") + string(gmsb_score3), c_white, c_white, c_white, c_white, 1);
  54. draw_text_colour(320,96 + 32 + 32,"\#4. " + string(gmsb_player4) + string(": ") + string(gmsb_score4), c_black, c_black, c_black, c_black, 1);
  55. draw_text_colour(322,94 + 32 + 32,"\#4. " + string(gmsb_player4) + string(": ") + string(gmsb_score4), c_white, c_white, c_white, c_white, 1);
  56. draw_text_colour(320,96 + 32 + 32 + 32,"\#5. " + string(gmsb_player5) + string(": ") + string(gmsb_score5), c_black, c_black, c_black, c_black, 1);
  57. draw_text_colour(322,94 + 32 + 32 + 32,"\#5. " + string(gmsb_player5) + string(": ") + string(gmsb_score5), c_white, c_white, c_white, c_white, 1);
  58. }
  59.  
  60.  
  61.  
  62. /// oInfiniteHighScoreDisplay : Create Event
  63.  
  64. ir_str = "null";
  65.  
  66. var getscore = 5;
  67.  
  68. itagid = "[censored, but different from the first]";
  69.  
  70. igmsb_post = http_post_string("http://gmscoreboard.com/handle_score.php?tagid="+string(itagid)+"&getscore="+string(getscore),"");
  71.  
  72.  
  73. /// oInfiniteHighScoreDisplay : HTTP Event
  74.  
  75. ir_str = "null";
  76. if ds_map_find_value(async_load, "id") == igmsb_post
  77. {
  78. if ds_map_find_value(async_load, "status") == 0
  79. {
  80. ir_str = ds_map_find_value(async_load, "result");
  81. }
  82. }
  83.  
  84. igmsb_map = json_decode(ir_str);
  85. igmsb_player1 = ds_map_find_value(igmsb_map , "p1");
  86. igmsb_score1 = ds_map_find_value(igmsb_map , "s1");
  87. igmsb_player2 = ds_map_find_value(igmsb_map , "p2");
  88. igmsb_score2 = ds_map_find_value(igmsb_map , "s2");
  89. igmsb_player3 = ds_map_find_value(igmsb_map , "p3");
  90. igmsb_score3 = ds_map_find_value(igmsb_map , "s3");
  91. igmsb_player4 = ds_map_find_value(igmsb_map , "p4");
  92. igmsb_score4 = ds_map_find_value(igmsb_map , "s4");
  93. igmsb_player5 = ds_map_find_value(igmsb_map , "p5");
  94. igmsb_score5 = ds_map_find_value(igmsb_map , "s5");
  95.  
  96.  
  97. /// oInfiniteHighscoreDisplay : Draw Event
  98.  
  99. if ir_str != "null"{
  100. draw_set_font(fnt_hud);
  101. draw_set_halign(fa_left);
  102. draw_text_colour(320,288,"\#1. " + string(igmsb_player1) + string(": ") + string(igmsb_score1), c_black, c_black, c_black, c_black, 1);
  103. draw_text_colour(322,286,"\#1. " + string(igmsb_player1) + string(": ") + string(igmsb_score1), c_white, c_white, c_white, c_white, 1);
  104. draw_text_colour(320,320,"\#2. " + string(igmsb_player2) + string(": ") + string(igmsb_score2), c_black, c_black, c_black, c_black, 1);
  105. draw_text_colour(322,318,"\#2. " + string(igmsb_player2) + string(": ") + string(igmsb_score2), c_white, c_white, c_white, c_white, 1);
  106. draw_text_colour(320,320 + 32,"\#3. " + string(igmsb_player3) + string(": ") + string(igmsb_score3), c_black, c_black, c_black, c_black, 1);
  107. draw_text_colour(322,318 + 32,"\#3. " + string(igmsb_player3) + string(": ") + string(igmsb_score3), c_white, c_white, c_white, c_white, 1);
  108. draw_text_colour(320,320 + 32 + 32,"\#4. " + string(igmsb_player4) + string(": ") + string(igmsb_score4), c_black, c_black, c_black, c_black, 1);
  109. draw_text_colour(322,318 + 32 + 32,"\#4. " + string(igmsb_player4) + string(": ") + string(igmsb_score4), c_white, c_white, c_white, c_white, 1);
  110. draw_text_colour(320,320 + 32 + 32 + 32,"\#5. " + string(igmsb_player5) + string(": ") + string(igmsb_score5), c_black, c_black, c_black, c_black, 1);
  111. draw_text_colour(322,318 + 32 + 32 + 32,"\#5. " + string(igmsb_player5) + string(": ") + string(igmsb_score5), c_white, c_white, c_white, c_white, 1);
  112. }
Advertisement
Add Comment
Please, Sign In to add comment