I want to upload a few stats in an database, how can I take something out of an callback and put it in an variable to simplify this?
Code:
csgo.requestPlayersProfile(account_id, function(ranking) {
console.log(ranking);
});
Result (ranking):
Got handled GC message PlayersProfile
{ my_current_event_teams: [],
my_current_event_stages: [],
account_id: xxxxxxx,
ongoingmatch: null,
global_stats: null,
penalty_seconds: null,
penalty_reason: null,
vac_banned: null,
ranking:
{ account_id: xxxxxxx,
rank_id: 16,
wins: 1081,
rank_change: null },
commendation: { cmd_friendly: 23, cmd_teaching: 24, cmd_leader: 24 },
medals:
{ display_items_defidx:
[ 969, 4551, 1377, 970, 1358, 4354, 1340, 1338, 1331, 1329, 1030, 874 ],
medal_team: null,
medal_combat: null,
medal_weapon: null,
medal_global: null,
medal_arms: null,
featured_display_item_defidx: 969 },
my_current_event: null,
my_current_team: null,
survey_vote: null,
activity: null,
player_level: 19,
player_cur_xp: 327682724,
player_xp_bonus_flags: null }
So as an example I want to put the rank_id: 16
in an var (ex. var rank = 16;
) so I cant just use "UPDATE Users SET Rank='rank'"