Skip to content

Instantly share code, notes, and snippets.

@darmie
Last active September 19, 2016 15:40
Show Gist options
  • Save darmie/704aa276b5e9a5c3b922c846fecc4085 to your computer and use it in GitHub Desktop.
Save darmie/704aa276b5e9a5c3b922c846fecc4085 to your computer and use it in GitHub Desktop.
Create a new Game Maker object for sending usage status to iConcept
var map = ds_map_create();
ds_map_add(map, "Content-Type", "application/json");
var date = string(current_day);
var data = '{"IMEI": 0, "Package":"com.saltgaming.hero_of_the_north", "date":'+ date+ '}'
global.check_usage = http_request("http://46.38.168.148:3452/emts/game/requsage","POST", map, json_encode(data));
if ds_map_find_value(async_load, "id") == global.check_usage
{
var status = ds_map_find_value(async_load, "status");
if status == 0
{
if(ds_map_exists(async_load, "result")){
self.jmap = json_decode(async_load[? "result"]);
}
if(ds_map_exists(self.jmap, "responsestring")){
self.response = self.jmap[? "responsestring"];
show_debug_message("REQUEST USAGE:: " + string(self.response));
}
exit;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment