MySQL help (strickenkids plugin)
#1

Hi guys!

I've got a big problem I think!

I am trying to read out of a mysql table, it has circa 15 entries, which are sub-divided in user entries

example:

ID-PlayerSQLID-ModelID
1-2-541
2-1-581
3-3-560
4-3-520

PlayerSQLID is the ID from the player from the user table.

Now, when I log in, I don't spawn (it comes the spawn dialog, where I can click spawn, but I don't spawn) and the server crashes.

I can see 5 entries in the server log:

[11:53:17] [MySQL] Error (0): Function: mysql_fetch_field failed, no field data.
[11:53:17] [MySQL] Error (0): Function: mysql_fetch_field failed, no field data.
[11:53:17] [MySQL] Error (0): Function: mysql_fetch_field failed, no field data.
[11:53:17] [MySQL] Error (0): Function: mysql_fetch_field failed, no field data.

It reads out until the PosZ, then the server crashes.

The code:

Код:
stock LoadCS(playerid)
{
    MySQLCheck();
	new query[MAX_STRING],playername[MAX_PLAYER_NAME],data[256],modelid,color1,color2,lock,Float:health,Float:posx,Float:posy,Float:posz,Float:angle;
	GetPlayerName(playerid, playername, sizeof(playername));
	PlayerInfo[playerid][pSQLID] = MySQLCheckAccount(playername);
	for(new i=0;i<MAX_PCARS;i++)
	{
		format(query, MAX_STRING, "SELECT * FROM csveh WHERE PSQLID=%d AND Slot=%d",PlayerInfo[playerid][pSQLID],i);
		mysql_query(query);
		mysql_store_result();
  		if(mysql_num_rows())
  		{
			format(query, sizeof(query), "SELECT * FROM csveh WHERE PSQLID = %d AND Slot=%d",PlayerInfo[playerid][pSQLID],i);
			mysql_query(query); mysql_store_result();
		    mysql_fetch_field("Status",data);PlayerVeh[playerid][i][pcsstatus] = strval(data);
		    mysql_fetch_field("ModelID", data);modelid = strval(data);PlayerVeh[playerid][i][pcsmodelid] = strval(data);
		    mysql_fetch_field("PosX", data);posx = floatstr(data);PlayerVeh[playerid][i][pcsposx] = floatstr(data);
		    mysql_fetch_field("PosY", data);posy = floatstr(data);PlayerVeh[playerid][i][pcsposy] = floatstr(data);
//after that it carshes!!
			mysql_fetch_field("PosZ", data);posz = floatstr(data);PlayerVeh[playerid][i][pcsposz] = floatstr(data);
			mysql_fetch_field("Angle", data);angle = floatstr(data);PlayerVeh[playerid][i][pcsangle] = floatstr(data);
			mysql_fetch_field("Color1", data);color1 = strval(data);PlayerVeh[playerid][i][pcscolor1] = strval(data);
			mysql_fetch_field("Color2", data);color2 = strval(data);PlayerVeh[playerid][i][pcscolor2] = strval(data);
			mysql_fetch_field("Health", data);health = floatstr(data);PlayerVeh[playerid][i][pcshealth] = floatstr(data);
			mysql_fetch_field("Locked", data);lock = strval(data);PlayerVeh[playerid][i][pcslock] = strval(data);
			mysql_fetch_field("Cost", data);PlayerVeh[playerid][i][pcscost] = strval(data);
			PlayerVeh[playerid][i][pcsvehid] = CreateVehicle(modelid,posx,posy,posz,angle,color1,color2,-1);
			SetVehicleHealth(PlayerVeh[playerid][i][pcsvehid],health);
			CSSetVehicleParamsForAll(PlayerVeh[playerid][i][pcsvehid],0,lock);
			lockveh[PlayerVeh[playerid][i][pcsvehid]] = lock;
		}
	}
}
Who can help?!

selEcT
Reply
#2

nobody can help?

could it be, when I start the server from a usb drive, it takes this error?
Reply
#3

you didnt use mysql_free_result
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)