Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //[csgo]
- function cshrsfunc( $atts ){
- $a = shortcode_atts( array(
- 'id' => 'erorasdf',
- 'id2' => 'erorasdf',
- ), $atts );
- if($a['id2']=="erorasdf")
- {
- $link = get_content("./csgo2id1.".$a['id'].".json",'http://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002/?key=4CE9904833EDA21CCB6BDDB3203505A0&steamid='.$a['id'].'&format=json&appid=730',2);
- $data = json_decode($link, TRUE);
- foreach($data["playerstats"]["stats"] as $stat)
- {
- if($stat["name"]=="total_time_played")
- {
- $timeplayed = $stat["value"];
- $timeplayed = $timeplayed/60;
- $timeplayed = $timeplayed/60;
- $timeplayed = floor($timeplayed);
- return $timeplayed;
- }
- }
- return "error";
- } else {
- $link = get_content("./csgo2id1.".$a['id'].".json",'http://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002/?key=4CE9904833EDA21CCB6BDDB3203505A0&steamid='.$a['id'].'&format=json&appid=730',2);
- $data = json_decode($link, TRUE);
- foreach($data["playerstats"]["stats"] as $stat)
- {
- if($stat["name"]=="total_time_played")
- {
- $timeplayed = $stat["value"];
- $timeplayed = $timeplayed/60;
- $timeplayed = $timeplayed/60;
- $timeplayed = floor($timeplayed);
- }
- }
- $link2 = get_content("./csgo2id2.".$a['id2'].".json",'http://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002/?key=4CE9904833EDA21CCB6BDDB3203505A0&steamid='.$a['id2'].'&format=json&appid=730',2);
- $data2 = json_decode($link2, TRUE);
- foreach($data2["playerstats"]["stats"] as $stat2)
- {
- if($stat2["name"]=="total_time_played")
- {
- $timeplayed2 = $stat2["value"];
- $timeplayed2 = $timeplayed2/60;
- $timeplayed2 = $timeplayed2/60;
- $timeplayed2 = floor($timeplayed2);
- $int = (int)$timeplayed;
- $int2 = (int)$timeplayed2;
- return $int + $int2;
- }
- }
- return "error";
- }
- }
- add_shortcode( 'csgo', 'cshrsfunc' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement