SaveVehicle - Crashes the server
#1

Simples the title says it all.

When it does this function server goes bye bye!!!!

Код:
FUNCTION:SaveVehicleChecker(vehid)
{
    new Float:PosX, Float:PosY, Float:PosZ, Float:Angle, Model;
	GetVehiclePos(vehid,PosX,PosY,PosZ);
	GetVehicleZAngle(vehid, Angle);
	Model = GetVehicleModel(vehid);
	
	new mainstring[256];
    new rows, fields;
    cache_get_data(rows, fields);
    if(rows)
    {
		mysql_format(dbHandle, mainstring,sizeof(mainstring),"UPDATE `vehicles` SET Model=%d,PosX=%f,PosY=%f,PosZ=%f,Angle=%f,World=%d,Interior=%d,Color1=%d,Color2=%d,Faction=%d WHERE ID = '%d'",Model,PosX,PosY,PosZ,Angle,VehicleInfo[vehid][cWorld],VehicleInfo[vehid][cInterior],VehicleInfo[vehid][cColor1],VehicleInfo[vehid][cColor2],VehicleInfo[vehid][cFaction],vehid);
	    mysql_tquery(dbHandle, mainstring, "", ""); 
	}
	else
	{
	    mysql_format(dbHandle, mainstring,sizeof(mainstring),"INSERT INTO `vehicles` (id,Model,PosX,PosY,PosZ,Angle) VALUES (%d,%d,'%f','%f','%f','%f')",
		vehid,Model,PosX,PosY,PosZ,Angle);
	    mysql_tquery(dbHandle, mainstring, "", ""); 
	}
	VehicleInfo[vehid][cPosX] = PosX;
	VehicleInfo[vehid][cPosY] = PosY;
	VehicleInfo[vehid][cPosZ] = PosZ;
	VehicleInfo[vehid][cAngle] = Angle;
	return 1;
}

FUNCTION:SaveVehicle(vehid)
{
	new mainstring[256];
    mysql_format(dbHandle, mainstring,sizeof(mainstring),"SELECT * FROM `vehicles` WHERE ID = %d",vehid);
    mysql_tquery(dbHandle, mainstring, "SaveVehicleChecker", "d", vehid);
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)