Jump to content
Experience the Altis Life
keyboard_arrow_right
ALTIS LIFE 1
...
ALTIS LIFE 2
...
DAYZ UK
...
TEAMSPEAK
...
...

We are currently undergoing maintenance

The forums are available for use, yet please do not expect full functionality.

About This Group

Group for developers in the community who use the RPUK API or just want to talk about technical stuff.

  1. What's new in this group
  2. Owen Stanton

    Steam API

    Great use of PHP I love it! Never really got into JSON, maybe its time I did
  3. SI Dan B

    Steam API

    I’ll have a look at it tonight @Miiiikkel. I’ll contact you if I get stuck!
  4. Miiiikkel

    Steam API

    Nice! If your ready to go further, you should definitely have a look at Composer and install it, that way you can download helpful packages that can interact with third party API's way easier, be prepared to enter the world of OOP though. You ping me a message if you need any help, happy coding!
  5. SI Dan B

    Steam API

    Pretty simple, this retrieves the set steamID's persona status and the current game that they are playing. Feel free to use it. retrieve.php <?php // Define headers header('Content-Type: application/json'); header('Access-Control-Allow-Origin:*'); if(!isset($_GET['steamid'])){ $array = array('error'=>1,'msg'=>'SteamID not set.'); echo json_encode($array); die(); } else { $steamid=$_GET['steamid']; } $steamkey = "ENTER STEAM API KEY"; $url = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=$steamkey&steamids=$steamid"; $json = file_get_contents($url); $json = json_decode($json); $personaname = $json->response->players[0]->personaname; $avatar = $json->response->players[0]->avatarfull; $profileurl = $json->response->players[0]->profileurl; $playing = $json->response->players[0]->gameextrainfo; $personastate = $json->response->players[0]->personastate; if($personastate == 0){$status = "Offline";} if($personastate == 1){$status = "Online";} if($personastate == 2){$status = "Busy";} if($personastate == 3){$status = "Away";} if($personastate == 4){$status = "Snooze";} if($personastate == 5){$status = "Looking to Trade";} if($personastate == 6){$status = "Looking to Play";} $array_main = array('name'=>$personaname,'avatar'=>$avatar,'url'=>$profileurl,'playing'=>$playing,'status'=>$status); echo json_encode($array_main); app.js function retrieveFromFile(steamid,idOfUrl,idOfStatus,idOfPlaying){ var xmlhttp = new XMLHttpRequest(); var url = "https://danbarrett.eu/retrieve.php?steamid="+steamid; xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { var array_info = JSON.parse(xmlhttp.responseText); changeInfo(array_info); } } xmlhttp.open("GET", url, true); xmlhttp.send(); function changeInfo(arr) { if(arr.playing==null){var playing = '';}else{var playing = 'playing '+arr.playing;} document.getElementById(idOfPlaying).innerHTML = playing; if(arr.status == 'Online'){var status_colour = '#5cb85c';} if(arr.status == 'Offline'){var status_colour = '#d9534f';} if(arr.status == 'Away'){var status_colour = '#5bc0de';} if(arr.status == 'Busy'){var status_colour = '#cc3c35';} document.getElementById(idOfStatus).style = 'color:'+status_colour; document.getElementById(idOfStatus).innerHTML = arr.status; document.getElementById(idOfUrl).href = arr.url; } } Insert this into your index.php file <span id="status"></span> <span id="playing"></span> <script> retrieveFromFile('ENTER STEAM ID HERE','steam-link','status','playing'); </script>
  6. Made this for a project I'm working on, thought others might have use for it too - all the information is accurate as of 07/02/2018. Also, if anyone is wondering why I don't replace the numbers with the name property, it's because I knew this list was going to be long and it's much easier to refer to specific elements when I have the number right in front of me instead of having to guess which one I need, filtering through the children. var values = { virtual: { 0: { name: "Legal", 0: { name: "Processed Oil", buy: 0, sell: 3200 }, 1: { name: "Apple", buy: 0, sell: 50 }, 2: { name: "Iron Ingot", buy: 0, sell: 3200 }, 3: { name: "Copper Ingot", buy: 0, sell: 1800 }, 4: { name: "Refined Salt", buy: 0, sell: 1650 }, 5: { name: "Glass", buy: 0, sell: 1450 }, 6: { name: "Peach", buy: 0, sell: 55 }, 7: { name: "Uncut Diamond", buy: 0, sell: 750 }, 8: { name: "Cut Diamond", buy: 0, sell: 2000 }, 9: { name: "Cement Bag", buy: 0, sell: 1950 }, 10: { name: "Aluminium Ingot", buy: 0, sell: 1700 }, 11: { name: "Computer Components", buy: 0, sell: 11000 }, 12: { name: "Computer Case", buy: 0, sell: 6000 }, 13: { name: "Computer Screen", buy: 0, sell: 8000 }, 14: { name: "Pearlbook Pro", buy: 0, sell: 98000 } }, 1: { name: "Illegal", 0: { name: "Processed Heroin", buy: 0, sell: 1800 }, 1: { name: "Spice", buy: 0, sell: 9500 }, 2: { name: "Marijuana", buy: 0, sell: 3000 }, 3: { name: "Processed Cocaine", buy: 0, sell: 5100 }, 4: { name: "Gold Bar", buy: 0, sell: 100000 }, 5: { name: "Frog Leg", buy: 0, sell: 1000 }, 6: { name: "Hermit LSD", buy: 0, sell: 2500 }, 7: { name: "Ephedrine Barrel", buy: 2000, sell: 1000 }, 8: { name: "Crystal Meth Box", buy: 0, sell: 12000 }, 9: { name: "Pearl", buy: 0, sell: 18000 }, 10: { name: "Modern Art", buy: 0, sell: 250000 }, 11: { name: "Stable Uranium", buy: 0, sell: 21000 }, 12: { name: "Blood Diamond", buy: 0, sell: 15000 } }, 2: { name: "Market", 0: { name: "RPG Tips Tea", buy: 10, sell: 5 }, 1: { name: "Rabbit Meat", buy: 75, sell: 65 }, 2: { name: "Salema Meat", buy: 55, sell: 45 }, 3: { name: "Ornate Meat", buy: 50, sell: 40 }, 4: { name: "Mackeral Meat", buy: 200, sell: 175 }, 5: { name: "Tuna Meat", buy: 900, sell: 700 }, 6: { name: "Cat Shark Meat", buy:350, sell: 300 }, 7: { name: "Turtle Meat", buy: 4000, sell: 4000 }, 8: { name: "Coffee", buy: 10, sell: 5 }, 9: { name: "Turtle Soup", buy: 3000, sell: 1000 }, 10: { name: "Crumpets", buy: 120, sell: 60 }, 11: { name: "Full Fuel Can", buy: 850, sell: 500 }, 12: { name: "Pickaxe", buy: 1200, sell: 750 }, 13: { name: "Baked Beans", buy: 75, sell: 25 }, 14: { name: "Lockpick", buy: 150, sell: 75 }, 15: { name: "Red Bulldog", buy: 1500, sell: 200 }, 16: { name: "Blasting Charge", buy: 80000, sell: 17500 }, 17: { name: "Bolt Cutter", buy: 7500, sell: 500 }, 18: { name: "Bomb Defuse Kit", buy: 2500, sell: 0 }, 19: { name: "Zipties", buy: 15000, sell: 1000 }, 20: { name: "Excevator", buy: 1750, sell: 1600 }, 21: { name: "Gyro", buy: 30, sell: 25 }, 22: { name: "BlueBurger", buy: 45, sell: 40 }, 23: { name: "Chips", buy: 40, sell: 0 }, 24: { name: "Fries", buy: 70, sell: 65 }, 25: { name: "Ice Cream", buy: 55, sell: 50 }, 26: { name: "Rat Kebab", buy: 35, sell: 30 }, 27: { name: "Beer", buy: 4000, sell: 3500 }, 28: { name: "Cardoso's Whisky", buy: 3000, sell: 2500 }, 29: { name: "Ciaran's Secret Shandy", buy: 2000, sell: 1500 }, 30: { name: "Cider Bottle", buy: 2000, sell: 200 }, 31: { name: "Marmite", buy: 250, sell: 0 }, 32: { name: "Industrial Code Breaker", buy: 40000, sell: 0 }, 33: { name: "Defibrillator", buy: 20000, sell: 10000 }, 34: { name: "Stretcher", buy: 3000, sell: 0 }, 35: { name: "Bloodbag", buy: 4500, sell: 0 }, 36: { name: "Radiation Pills", buy: 500, sell: 0 }, 37: { name: "Loot Crate", buy: 100000, sell: 0 }, 38: { name: "Winter Crate", buy: 200000, sell: 0 } } }, gear: { 0: { name: "General Store", 0: { name: "First Aid Kit", buy: 250, sell: 0 }, 1: { name: "NV Goggles (Brown)", buy: 2000, sell: 0 }, 2: { name: "NV Goggles (Green)", buy: 3000, sell: 0 }, 3: { name: "NV Goggles (Black)", buy: 4000, sell: 0 }, 4: { name: "Rangefinder", buy: 6000, sell: 0 }, 5: { name: "Smoke Grenade (White)", buy: 500, sell: 0 }, 6: { name: "Smoke Grenade (Blue)", buy: 0, sell: 0 }, 7: { name: "IR Grenade [NATO]", buy: 500, sell: 0 }, 8: { name: "Medikit", buy: 0, sell: 0 }, 9: { name: "Binoculars", buy: 150, sell: 0 }, 10: { name: "GPS", buy: 100, sell: 0 }, 11: { name: "Compass", buy: 50, sell: 0 }, 12: { name: "Watch", buy: 10, sell: 0 }, 13: { name: "Map", buy: 1, sell: 0 }, 14: { name: "Toolkit", buy: 250, sell: 0 } }, 1: { name: "Pistols", 0: { name: "Rook-40 9mm", buy: 25000, sell: 0 }, 1: { name: "ACP-C2 .45 ACP", buy: 28000, sell: 0 }, 2: { name: "Zubr .45 ACP", buy: 30000, sell: 0 }, 3: { name: "4-five .45 ACP", buy: 35000, sell: 0 }, 4: { name: "Starter Pistol", buy: 10000, sell: 0 }, 5: { name: "9mm 16rnd Mag", buy: 250, sell: 0 }, 6: { name: "9mm 30Rnd Mag", buy: 500, sell: 0 }, 7: { name: ".45 ACP 11Rnd Mag", buy: 900, sell: 0 }, 8: { name: ".45 ACP 9Rnd Mag", buy: 700, sell: 0 }, 9: { name: ".45 ACP 6Rnd Cylinder", buy: 500, sell: 0 }, 10: { name: "6Rnd Signal Cylinder (Red)", buy: 10000, sell: 0 }, 11: { name: "Rangemaster Belt", buy: 5000, sell: 0 } }, 2: { name: "Rebel Weapons (All)", 0: { name: "SDAR 5.56mm", buy: 40000, sell: 0 }, 1: { name: "TRG-20 5.56mm", buy: 70000, sell: 0 }, 2: { name: "TRG-21 5.56mm", buy: 75000, sell: 0 }, 3: { name: "MK20 5.56mm", buy: 90000, sell: 0 }, 4: { name: "MX 6.5mm (All)", buy: 150000, sell: 0 }, 5: { name: "MXC 6.5mm (All)", buy: 145000, sell: 0 }, 6: { name: "MX SW 6.5mm (All)", buy: 160000, sell: 0 }, 7: { name: "MXM 6.5mm (All)", buy: 170000, sell: 0 }, 8: { name: "Katiba Carbine 6.5mm", buy: 145000, sell: 0 }, 9: { name: "Katiba 6.5mm", buy: 150000, sell: 0 }, 10: { name: "Rahim 7.62mm", buy: 200000, sell: 0 }, 11: { name: "Mk14 7.62mm (All)", buy: 215000, sell: 0 }, 12: { name: "Mk18 ABR 7.62mm", buy: 230000, sell: 0 }, 13: { name: "AKS-74U 5.45mm", buy: 70000, sell: 0 }, 14: { name: "AKM 7.62mm", buy: 170000, sell: 0 }, 15: { name: "AK-12 7.62mm", buy: 290000, sell: 0 }, 16: { name: "Protector 9mm", buy: 50000, sell: 0 }, 17: { name: "Vermin SMG .45 ACP", buy: 60000, sell: 0 }, 18: { name: "PDW200 9mm", buy: 40000, sell: 0 }, 19: { name: "Sting 9mm", buy: 100000, sell: 0 }, 20: { name: "CMR-76 6.5mm (All)", buy: 185000, sell: 0 }, 21: { name: "CAR-95-1 5.8mm (All)", buy: 165000, sell: 0 }, 22: { name: "CAR-95 5.8mm (All)", buy: 150000, sell: 0 }, 23: { name: "6.5mm 20Rnd Mag", buy: 5000, sell: 0 }, 24: { name: "LIM-85 5.56mm", buy: 800000, sell: 0 }, 25: { name: "Mk-1 EMR 7.62mm (All)", buy: 370000, sell: 0 }, 26: { name: "Type 115 6.5mm", buy: 190000, sell: 0 } } }, vehicle: { 0: { name: "Car", 0: { name: "Go Kart (Rent)", buy: 10000, sell: 0 }, 1: { name: "Quadbike", buy: 5000, sell: 0 }, 2: { name: "Hatchback", buy: 7000, sell: 0 }, 3: { name: "Offroad", buy: 14000, sell: 0 }, 4: { name: "SUV", buy: 40000, sell: 0 }, 5: { name: "MB 4WD (Jeep)", buy: 225000, sell: 0 }, 6: { name: "MB 4WD (Rollcage)", buy: 250000, sell: 0 }, 7: { name: "Hatchback Sport", buy: 200000, sell: 0 }, 8: { name: "Qilin LSV", buy: 300000, sell: 0 } }, 1: { name: "Truck", 0: { name: "Truck (Half Lunchbox)", buy: 30000, sell: 0 }, 1: { name: "Truck Box (Lunchbox)", buy: 45000, sell: 0 }, 2: { name: "Fuel Truck", buy: 40000, sell: 0 }, 3: { name: "Zamak Transport", buy: 100000, sell: 0 }, 4: { name: " Van (cargo)", buy: 70000, sell: 0 }, 5: { name: "Van Transport", buy: 90000, sell: 0 }, 6: { name: "Zamak Transport", buy: 100000, sell: 0 }, 7: { name: "Zamak Covered", buy: 120000, sell: 0 }, 8: { name: "Zamak Repair", buy: 160000, sell: 0 }, 9: { name: "Zamak Fuel", buy: 200000, sell: 0 }, 10: { name: "Tempest Transport", buy: 200000, sell: 0 }, 11: { name: "Tempest Covered", buy: 225000, sell: 0 }, 12: { name: "Tempest Repair", buy: 270000, sell: 0 }, 13: { name: "Tempest Fuel", buy: 300000, sell: 0 }, 14: { name: "Tempest Container", buy: 350000, sell: 0 }, 15: { name: "HEMTT Transport", buy: 400000, sell: 0 }, 16: { name: "HEMTT Covered", buy: 450000, sell: 0 }, 17: { name: "HEMTT Box", buy: 550000, sell: 0 }, 18: { name: "HEMTT Canvas (Ammo)", buy: 700000, sell: 0 }, 19: { name: "HEMTT Fuel", buy: 750000, sell: 0 }, 20: { name: "HEMTT Mover", buy: 300000, sell: 0 }, 21: { name: "Tempest Device", buy: 450000, sell: 0 } }, 2: { name: "Helicopter", 0: { name: "MH-9 Hummingbird", buy: 450000, sell: 0 }, 1: { name: "M-900", buy: 450000, sell: 0 }, 2: { name: "PO-30 Orca", buy: 1000000, sell: 0 }, 3: { name: "Hellcat", buy: 4000000, sell: 0 }, 4: { name: "CH-49 Mohawk", buy: 6000000, sell: 0 }, 5: { name: "CH-67 Huron", buy: 30000000, sell: 0 }, 6: { name: "V-44 X Blackfish (Infantry)", buy: 50000000, sell: 0 }, 7: { name: "V-44 X Blackfish (Vehicle)", buy: 75000000, sell: 0 } }, 3: { name: "Plane/Jet", 0: { name: "Caesar BTT", buy: 750000, sell: 0 }, 1: { name: "Caesar BTT (Racing)", buy: 950000, sell: 0 }, 2: { name: "A-143 Buzzard (AA)", buy: 15000000, sell: 0 }, 3: { name: "To-199 Neophron (CAS)", buy: 20000000, sell: 0 }, 4: { name: "To-201 Shikra (Stealth)", buy: 40000000, sell: 0 }, 5: { name: "F/A-181", buy: 40000000, sell: 0 } }, 4: { name: "Boat", 0: { name: "Water Scooter (Jetski)", buy: 3000, sell: 0 }, 1: { name: "Rescue Boat", buy: 5000, sell: 0 }, 2: { name: "Speedboat", buy: 40000, sell: 0 }, 3: { name: "RHIB", buy: 100000, sell: 0 }, 4: { name: "Submarine", buy: 1500000, sell: 0 } } } };
  7.  
×