GM loading vehicle wrong at Mysql
#1

I want to make a system that once you hit a certain dialogue on the car will function checks whether there is enough money, the car will add MySQL, and finally load the car.
It makes everything but she is not charging correctly the data.

Function what i use:
PHP код:
function AddCar(omanikDesc[], modelpriceid)
{
    new 
query[512], amswer;
    if(
PlayerInfo[id][pCash] < hind) return SendClientMessage(id, -1"You don't have enough money!");
    
format(querysizeof(query), "INSERT INTO `Cars` (Owned, Owner, Model, Value, Locationx, Locationy, Locationz, Angle, Parked, Stock) VALUES (1, %d, %d, %d, 763.7009, -1016.5224, 23.9668, 0, 0, %d)"KasutajaInfo[id][pSQLID], modelpriceprice);
    
mysql_query(query);
    
mysql_query(query);
    
answer mysql_insert_id();
    
SFM(id, -1"DEBUG: sql last insert id %d"answer);
    
LoadCarID(answer);
    
SetPlayerCheckpointid763.7009, -1016.522423.96683.0 );
    
GivePlayerMoneyExid, -(price) );
    
SFMidCOLOR_LIGHTBLUE"Car: %s Price: %d euro. (( Car id %d ))"Deschindanswer );
    return 
1;

LoadCarID(CarID) function:
PHP код:
funktsioon LoadCarID(z)
{
    
mysql_debug(1);
    new 
result[128], sql[256];
    
format(sqlsizeof(sql), "SELECT * FROM `Cars` WHERE `CarId` = '%d'"z);
    
mysql_query(sql);
    
mysql_store_result();
    if(
mysql_fetch_row_format(sql,"|"))
    {
        
mysql_fetch_field_row(result,"Owned"); AutoInfo[z][cOwned] = strval(result);
        
mysql_fetch_field_row(result,"Owner"); AutoInfo[z][cOwner] = strval(result);
        
mysql_fetch_field_row(result,"Description"); strmid(AutoInfo[z][cDescription], result0strlen(result), 255);//
        
mysql_fetch_field_row(result,"Model"); AutoInfo[z][cModel] = strval(result);
        
mysql_fetch_field_row(result,"Value"); AutoInfo[z][cValue] = strval(result);
        
mysql_fetch_field_row(result,"Lock"); AutoInfo[z][cLock] = strval(result);
        
mysql_fetch_field_row(result,"Locationx"); AutoInfo[z][cLocationx] = floatstr(result);
        
mysql_fetch_field_row(result,"Locationy"); AutoInfo[z][cLocationy] = floatstr(result);
        
mysql_fetch_field_row(result,"Locationz"); AutoInfo[z][cLocationz] = floatstr(result);
        
mysql_fetch_field_row(result,"Angle"); AutoInfo[z][cAngle] = floatstr(result);
        
mysql_fetch_field_row(result,"Parked"); AutoInfo[z][cParked] = strval(result);
        
mysql_fetch_field_row(result,"ParkLocationx"); AutoInfo[z][cParkLocationx] = floatstr(result);
        
mysql_fetch_field_row(result,"ParkLocationy"); AutoInfo[z][cParkLocationy] = floatstr(result);
        
mysql_fetch_field_row(result,"ParkLocationz"); AutoInfo[z][cParkLocationz] = floatstr(result);
        
mysql_fetch_field_row(result,"ParkAngle"); AutoInfo[z][cParkAngle] = floatstr(result);
        
mysql_fetch_field_row(result,"Narkot"); AutoInfo[z][cNarkot] = strval(result);
        
mysql_fetch_field_row(result,"AMaterjale"); AutoInfo[z][cMaterjale][0] = strval(result);
        
mysql_fetch_field_row(result,"BMaterjale"); AutoInfo[z][cMaterjale][1] = strval(result);
        
mysql_fetch_field_row(result,"CMaterjale"); AutoInfo[z][cMaterjale][2] = strval(result);
        
mysql_fetch_field_row(result,"Nitro"); AutoInfo[z][cNitro] = strval(result);
        
mysql_fetch_field_row(result,"GPS"); AutoInfo[z][cGPS] = strval(result);
        
mysql_fetch_field_row(result,"Raadio"); AutoInfo[z][cRaadio] = strval(result);
        
mysql_fetch_field_row(result,"Comp1"); AutoInfo[z][cComp1] = strval(result);
        
mysql_fetch_field_row(result,"Comp2"); AutoInfo[z][cComp2] = strval(result);
        
mysql_fetch_field_row(result,"Comp3"); AutoInfo[z][cComp3] = strval(result);
        
mysql_fetch_field_row(result,"Comp4"); AutoInfo[z][cComp4] = strval(result);
        
mysql_fetch_field_row(result,"Comp5"); AutoInfo[z][cComp5] = strval(result);
        
mysql_fetch_field_row(result,"Comp6"); AutoInfo[z][cComp6] = strval(result);
        
mysql_fetch_field_row(result,"Comp7"); AutoInfo[z][cComp7] = strval(result);
        
mysql_fetch_field_row(result,"Comp8"); AutoInfo[z][cComp8] = strval(result);
        
mysql_fetch_field_row(result,"Comp9"); AutoInfo[z][cComp9] = strval(result);
        
mysql_fetch_field_row(result,"Comp10"); AutoInfo[z][cComp10] = strval(result);
        
mysql_fetch_field_row(result,"Color1"); AutoInfo[z][cColor1] = strval(result);
        
mysql_fetch_field_row(result,"Color2"); AutoInfo[z][cColor2] = strval(result);
        
mysql_fetch_field_row(result,"Stock"); AutoInfo[z][cStock] = strval(result);
        
mysql_fetch_field_row(result,"CarKeyGiven"); AutoInfo[z][cCarKeyGiven] = strval(result);
        
//mysql_fetch_field_row(result,"Number"); AutoInfo[z][cRegistration] = result;
        
Car[z] = AddStaticVehicleEx(AutoInfo[z][cModel],AutoInfo[z][cLocationx],AutoInfo[z][cLocationy],AutoInfo[z][cLocationz]+0.1AutoInfo[z][cAngle],AutoInfo[z][cColor1],AutoInfo[z][cColor2],60000);
        
OnCarUpdate(z);
    }
    
mysql_free_result();
    
mysql_debug(0);

Debug.txt show that:
PHP код:
[14:03:26] >> mysql_queryConnection handle)
[
14:03:26CMySQLHandler::Query(SELECT FROM `CarsWHERE `CarId` = '6') - Successfully executed.
[
14:03:26] >> mysql_store_resultConnection handle)
[
14:03:26CMySQLHandler::StoreResult() - Result was stored.
[
14:03:26] >> mysql_fetch_row_formatConnection handle)
[
14:03:26CMySQLHandler::FetchRow() - Return: 6|1|126||426|90000|0|None|763.701|-1016.52|23.9668|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|90000|0|sarmo
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("Owned") - 1
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("Owner") - 126
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("Description") - 
[
14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("Model") - 426
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("Value") - 90000
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("Lock") - 
[
14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("Locationx") - 763.701
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("Locationy") - -1016.52
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("Locationz") - 23.9668
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("Angle") - 0
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("Parked") - 0
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("ParkLocationx") - 0
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("ParkLocationy") - 0
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("ParkLocationz") - 0
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("ParkAngle") - 0
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("Narkot") - 0
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("AMaterjale") - 0
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("BMaterjale") - 0
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("CMaterjale") - 0
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("Nitro") - 0
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("GPS") - 0
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("Radio") - 0
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("Comp1") - 0
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("Comp2") - 0
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("Comp3") - 0
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("Comp4") - 0
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("Comp5") - 0
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("Comp6") - 0
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("Comp7") - 0
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("Comp8") - 0
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("Comp9") - 0
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("Comp10") - 0
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("Color1") - 0
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("Color2") - 0
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("Stock") - 90000
[14:03:26] >> mysql_fetch_field_rowConnection handle)
[
14:03:26CMySQLHandler::FetchField("CarKeyGiven") - 0
[14:03:26] >> mysql_queryConnection handle)
[
14:03:26CMySQLHandler::Query(UPDATE Cars SET Owned '1'Owner '126'Parked '0'ParkLocationx '0.000000'ParkLocationy '0.000000'ParkLocationz '0.000000'ParkAngle '0.000000'Narkot '0'AMaterjale '0'BMaterjale '0'CMaterjale '0'Nitro '0'GPS '0'CarKeyGiven '0'Raadio '0' WHERE CarId '6') - Successfully executed.
[
14:03:26] >> mysql_free_resultConnection handle)
[
14:03:26CMySQLHandler::FreeResult() - Result was successfully free'd. 
Reply


Messages In This Thread
GM loading vehicle wrong at Mysql - by Porgand - 02.07.2014, 12:51
Re: GM loading vehicle wrong at Mysql - by Porgand - 02.07.2014, 18:03
Re: GM loading vehicle wrong at Mysql - by Porgand - 14.07.2014, 21:13
Re: GM loading vehicle wrong at Mysql - by azzerking - 14.07.2014, 22:22
Re: GM loading vehicle wrong at Mysql - by Porgand - 14.08.2014, 23:45
Re: GM loading vehicle wrong at Mysql - by Porgand - 25.08.2014, 19:40
Re: GM loading vehicle wrong at Mysql - by Porgand - 28.08.2014, 02:23

Forum Jump:


Users browsing this thread: 3 Guest(s)