some help with HTTP please.
#1

hey all,

ok so i have a test server, and a main server for my gamemode, the main is 24/7 and the test is only online when im testing things, but now i want to make to make that the stats of the player are getting saved into an online database with HTTP, but now it gives me weird outputs and it doesnt saves anything...

this is what i do at onplayerdisconnect:

pawn Код:
if(!strcmp(PlayersName(playerid), "[HSD]Niels", true))
        {
            new string[128];
            format(string, sizeof(string), "?player/cash=%i", GetPlayerMoney(playerid));
            HTTP(playerid, HTTP_POST, "filebin.webs.com/%5BHSD%5DNiels-1.ini", string, "PlayerStatResponse");
        }
the PlayerStatResponse:

pawn Код:
forward PlayerStatResponse(index, response_code, datas[]);
public PlayerStatResponse(index, response_code, datas[])
{
    // In this callback "index" would normally be called "playerid" ( if you didn't get it already :) )
    new
        buffer[ 128 ];
    if(response_code == 200) //Did the request succeed?
    {
        //Yes!
        format(buffer, sizeof(buffer), "The URL replied: %s", datas);
        print(buffer);
    }
    else
    {
        //No!
        format(buffer, sizeof(buffer), "The request failed! The response code was: %d", response_code);
        print(buffer);
    }
}

i want to save the cash of the player in the file that is on my site at webs, and then if that works i will continue with the rest of the player stats, but when i check my console, i get this:

Код:
The URL replied: 
{
 "car":{
  "slot0":{
   "ASpawn":179.604141,
   "XSpawn":2231.222900,
   "YSpawn":162.62240
thats what it sends in the console...

i want it to save the player's cash into the file at the player/cash. as i also do with djSetInt

the file of the name:

Код:
{
  "car":{
    "slot0":{
      "ASpawn":179.604141,
      "XSpawn":2231.222900,
      "YSpawn":162.622406,
      "ZSpawn":27.309289,
      "colour1":0,
      "colour2":1,
      "doors":0,
      "exhaust":0,
      "frontbumper":0,
      "fuel":90.888061,
      "health":1000.000000,
      "hood":0,
      "hydraulics":0,
      "lamps":0,
      "lights":0,
      "model":402,
      "neonmodel":0,
      "nitroamnt":9960,
      "nitrotype":1010,
      "paint":-1,
      "panels":0,
      "rearbumper":0,
      "roof":0,
      "sideskirt":0,
      "speedlimit":0.613110,
      "spoiler":0,
      "stereo":0,
      "tires":0,
      "ventleft":0,
      "ventright":0,
      "wheels":0
    },
    "slot1":{
      "ASpawn":180.477294,
      "XSpawn":2224.733154,
      "YSpawn":155.883743,
      "ZSpawn":26.452213,
      "colour1":3,
      "colour2":1,
      "doors":0,
      "exhaust":0,
      "frontbumper":0,
      "fuel":90.888061,
      "health":1000.000000,
      "hood":0,
      "hydraulics":0,
      "lamps":0,
      "lights":0,
      "model":560,
      "neonmodel":0,
      "nitroamnt":9960,
      "nitrotype":1010,
      "paint":1,
      "panels":0,
      "plate":"Reloaded",
      "rearbumper":0,
      "roof":0,
      "sideskirt":0,
      "speedlimit":0.613110,
      "spoiler":0,
      "stereo":0,
      "tires":0,
      "ventleft":0,
      "ventright":0,
      "wheels":0
    },
    "slot2":{
      "ASpawn":178.663009,
      "XSpawn":2242.886474,
      "YSpawn":162.014038,
      "ZSpawn":26.676546,
      "colour1":3,
      "colour2":78,
      "doors":0,
      "exhaust":1092,
      "frontbumper":1166,
      "fuel":90.888061,
      "health":1000.000000,
      "hood":0,
      "hydraulics":1087,
      "lamps":0,
      "lights":0,
      "model":558,
      "neonmodel":0,
      "nitroamnt":9960,
      "nitrotype":1010,
      "paint":1,
      "panels":0,
      "rearbumper":1168,
      "roof":1088,
      "sideskirt":1090,
      "speedlimit":0.613110,
      "spoiler":1164,
      "stereo":0,
      "tires":0,
      "ventleft":0,
      "ventright":0,
      "wheels":1080
    },
    "slot3":{
      "ASpawn":179.625885,
      "XSpawn":2242.259033,
      "YSpawn":182.193069,
      "ZSpawn":27.037286,
      "colour1":0,
      "colour2":3,
      "doors":0,
      "exhaust":0,
      "frontbumper":0,
      "fuel":90.888061,
      "health":1000.000000,
      "hood":0,
      "hydraulics":0,
      "lamps":0,
      "lights":0,
      "model":522,
      "neonmodel":0,
      "nitroamnt":9960,
      "nitrotype":1010,
      "paint":-1,
      "panels":0,
      "rearbumper":0,
      "roof":0,
      "sideskirt":0,
      "speedlimit":0.613110,
      "spoiler":0,
      "stereo":0,
      "tires":0,
      "ventleft":0,
      "ventright":0,
      "wheels":0
    }
  },
  "options":{
    "music":1098,
    "streamer":"http://82.201.100.9:8000/radio538.m3u"
  },
  "player":{
    "AdminLevel":5,
    "BRB-A":25.664928,
    "BRB-X":2286.287353,
    "BRB-Y":-62.369747,
    "BRB-Z":26.484375,
    "FinishedTownTut":1,
    "Job":"nothing",
    "VipLevel":4,
    "cash":59761677,
    "drugdealer":{
      "weed":0
    },
    "score":0,
    "skin":{
      "id":230
    },
    "weapon0":0,
    "weapon1":0,
    "weapon10":0,
    "weapon11":0,
    "weapon12":0,
    "weapon2":0,
    "weapon3":0,
    "weapon4":0,
    "weapon5":0,
    "weapon6":0,
    "weapon7":0,
    "weapon8":0,
    "weapon9":0
  }
}
how can i fix this issue? this is the first time i am working with HTTP and i really want to use this feature.

Greets
Reply
#2

bump...
Reply
#3

another bump...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)