27.11.2015, 14:54
I have code like this.
and i have 3 rows in my database, but only one of last entry that can CreateVehicle.
Any one can help me?
Please ...
Код:
enum vInfo { vOwner[24], vModel, vId, Float:vPosX, Float:vPosY, Float:vPosZ, Float:vPosA, } new VehicleInfo [MAX_PLAYERS][vInfo]; new OwnedVehicle [MAX_VEHICLES];
Код:
stock LoadVehicleData(playerid) { new savingstring[20]; GetPlayerName(playerid, pName, MAX_PLAYER_NAME); format(query, sizeof(query), "SELECT * FROM `vehicles` WHERE `owner` = '%s'", pName); mysql_query(query); mysql_store_result(); while(mysql_fetch_row_format(query,"|")) { mysql_fetch_field_row(VehicleInfo[playerid][vOwner], "owner"); mysql_fetch_field_row(savingstring, "vid"); VehicleInfo[playerid][vId] = strval(savingstring); mysql_fetch_field_row(savingstring, "model"); VehicleInfo[playerid][vModel] = strval(savingstring); mysql_fetch_field_row(savingstring, "posx"); VehicleInfo[playerid][vPosX] = strval(savingstring); mysql_fetch_field_row(savingstring, "posy"); VehicleInfo[playerid][vPosY] = strval(savingstring); mysql_fetch_field_row(savingstring, "posz"); VehicleInfo[playerid][vPosZ] = strval(savingstring); mysql_fetch_field_row(savingstring, "posa"); VehicleInfo[playerid][vPosA] = strval(savingstring); } mysql_free_result(); OwnedVehicle[playerid] = CreateVehicle(VehicleInfo[playerid][vModel],VehicleInfo[playerid][vPosX],VehicleInfo[playerid][vPosY],VehicleInfo[playerid][vPosZ],VehicleInfo[playerid][vPosA],-1,-1,300); return 1; }
Any one can help me?
Please ...