[Help] MySQL Vehicle system crashing server
#1

I have this enum:

Код:
enum pVehicles
{
	//STORED IN A DB
	vID,            //Separate IDs for all the player owned vehicles
	Model,
	vOwner[MAX_PLAYER_NAME],
	Float:VehX,
	Float:VehY,
	Float:VehZ,
	Float:VehA,
	Color1,
	Color2,
	Plate[8],
	//NOT STORED IN A DB
	PVID,           //ID for the player's vehicle to control it
	

}new PlayerVehicle[MAX_PLAYERS][pVehicles];
and in my dialogid I have this:

Код:
                new PlayerName[MAX_PLAYER_NAME], query[128], str[128];
	        GetPlayerName(playerid, PlayerName, sizeof(PlayerName));


                switch(listitem)
		{
		    case 0://Manana ID:410
		    {
			    if(PlayerInfo[playerid][Cash] < 2500) return SendClientMessage(playerid, COLOR_DARKCORAL, "[BS] {AFAFAF}You cannot afford this car ($2.500)!");
			    PlayerVehicle[playerid][Model] = 410;
			    PlayerVehicle[playerid][VehX] = CSPAWN_X;
			    PlayerVehicle[playerid][VehY] = CSPAWN_Y;
			    PlayerVehicle[playerid][VehZ] = CSPAWN_Z;
			    PlayerVehicle[playerid][VehA] = CSPAWN_A;

			    mysql_format(g_Sql, query, sizeof(query), "INSERT INTO `pvehicles` (`Model`, `vOwner`, `VehX`, `VehY`, `VehZ`, `VehA`) VALUES (%d, '%e', %f, %f, %f, %f,)",
		            PlayerVehicle[playerid][Model], PlayerName, PlayerVehicle[playerid][VehX], PlayerVehicle[playerid][VehY], PlayerVehicle[playerid][VehZ], PlayerVehicle[playerid][VehA] );
		     	    mysql_tquery(g_Sql, query, "VehicleBuy", "i", playerid);

		     	    PlayerVehicle[playerid][PVID] = CreateVehicle(PlayerVehicle[playerid][Model],
			    PlayerVehicle[playerid][VehX],
			    PlayerVehicle[playerid][VehY],
			    PlayerVehicle[playerid][VehZ],
			    PlayerVehicle[playerid][VehA],
			    135,
			    135, -1, 0);
			    format(str, sizeof(str),"[BS] New vehicle with ID: %d", PlayerVehicle[playerid][PVID]);
			    SendClientMessage(playerid, COLOR_DARKCORAL, str);
                            print(query);
			}
		}
I just have a script for one car so I can test it. Here's the callback VehicleBuy

Код:
public VehicleBuy(playerid)
{
    PlayerVehicle[playerid][vID] = cache_insert_id();
    printf("[Registration] New car registered. pvehicles ID: [%d]", PlayerVehicle[playerid][vID]);
    return 1;
}

When I'm in game and test this, the car gets created and everything, but for the MySQL part I get a (null)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)