Not correct serverID
#1

I do not correctly extract [ vServerID ] mysql database !
VehiclesInfo[i][vModel],VehiclesInfo[i][vPositionX],VehiclesInfo[i][vPositionY],VehiclesInfo[i][vPositionZ],VehiclesInfo[i][vAngle],VehiclesInfo[i][vColor1],VehiclesInfo[i][vColor2] are extracted correctly !

Код HTML:
stock LoadVehiclesMySQL()
{
    new Str[128], query[128], i = 1;
    mysql_format(handle, query, sizeof(query), "SELECT * FROM `vehicles`");
    mysql_tquery(handle, query, "", "");

    mysql_store_result();
    if(mysql_num_rows() != 0)
    {
        while(mysql_fetch_row(Str))
        {
            sscanf(Str, "p<|>iffffiiiiiiis[16]iiiiiiiiiiiiiiiiiii", VehiclesInfo[i][vModel], VehiclesInfo[i][vPositionX], VehiclesInfo[i][vPositionY], VehiclesInfo[i][vPositionZ], VehiclesInfo[i][vAngle],
            VehiclesInfo[i][vColor1], VehiclesInfo[i][vColor2], VehiclesInfo[i][vPaintJob], VehiclesInfo[i][vOwner], VehiclesInfo[i][vLock], VehiclesInfo[i][vKM], VehiclesInfo[i][vDays], VehiclesInfo[i][vNumberPlate],
            VehiclesInfo[i][vComponent1], VehiclesInfo[i][vComponent2], VehiclesInfo[i][vComponent3], VehiclesInfo[i][vComponent4], VehiclesInfo[i][vComponent5],
            VehiclesInfo[i][vComponent6], VehiclesInfo[i][vComponent7], VehiclesInfo[i][vComponent8], VehiclesInfo[i][vComponent9], VehiclesInfo[i][vComponent10],
            VehiclesInfo[i][vComponent11], VehiclesInfo[i][vComponent12], VehiclesInfo[i][vComponent13], VehiclesInfo[i][vComponent14], VehiclesInfo[i][vComponent15],
            VehiclesInfo[i][vComponent16], VehiclesInfo[i][vComponent17], VehiclesInfo[i][vServerID], VehiclesInfo[i][vSlot]);
            VehiclesInfo[i][vServerID] = CreateVehicle(VehiclesInfo[i][vModel],VehiclesInfo[i][vPositionX],VehiclesInfo[i][vPositionY],VehiclesInfo[i][vPositionZ],VehiclesInfo[i][vAngle],VehiclesInfo[i][vColor1],VehiclesInfo[i][vColor2],60000);
            mysql_format(handle, query, sizeof(query), "UPDATE `vehicles` SET `ServerID` = '%i' WHERE ID = '%i'", VehiclesInfo[i][vServerID], VehiclesInfo[i][vID]);
            mysql_query(handle, query);
            if(i > MotoCros[20])
            {
                Tunen(i);
            }
            SetVehicleToRespawn(i);
            i++;
        }
    }
    mysql_free_result();
    printf("--- %i vehicles loaded from the MySQL Database. ---", i);
    return 1;
}
Database table:
Код HTML:
CREATE TABLE IF NOT EXISTS `vehicles` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `Model` int(11) NOT NULL,
  `PositionX` float NOT NULL,
  `PositionY` float NOT NULL,
  `PositionZ` float NOT NULL,
  `Angle` float NOT NULL,
  `Color1` int(11) NOT NULL,
  `Color2` int(11) NOT NULL,
  `PaintJob` int(11) NOT NULL,
  `Owner` int(11) NOT NULL,
  `Lock` int(11) NOT NULL,
  `KM` int(11) NOT NULL,
  `Days` int(11) NOT NULL,
  `NumberPlate` varchar(16) NOT NULL,
  `Component1` int(11) NOT NULL,
  `Component2` int(11) NOT NULL,
  `Component3` int(11) NOT NULL,
  `Component4` int(11) NOT NULL,
  `Component5` int(11) NOT NULL,
  `Component6` int(11) NOT NULL,
  `Component7` int(11) NOT NULL,
  `Component8` int(11) NOT NULL,
  `Component9` int(11) NOT NULL,
  `Component10` int(11) NOT NULL,
  `Component11` int(11) NOT NULL,
  `Component12` int(11) NOT NULL,
  `Component13` int(11) NOT NULL,
  `Component14` int(11) NOT NULL,
  `Component15` int(11) NOT NULL,
  `Component16` int(11) NOT NULL,
  `Component17` int(11) NOT NULL,
  `ServerID` int(11) NOT NULL,
  `Slot` int(11) NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
Код HTML:
new v;
        v = PlayerInfo[playerid][pCarKey];
        printf("serverid: %i", VehiclesInfo[v][vServerID]); // debugging.
LOG: serverid: 0
correctly should be: serveri:17

[+REP]
Reply


Messages In This Thread
Not correct serverID - by norton2 - 08.02.2015, 22:29
Re: Not correct serverID - by iZN - 09.02.2015, 05:55
Re: Not correct serverID - by norton2 - 09.02.2015, 06:50
Re: Not correct serverID - by norton2 - 09.02.2015, 12:51
Re: Not correct serverID - by HazardouS - 09.02.2015, 12:55

Forum Jump:


Users browsing this thread: 2 Guest(s)