03.07.2014, 22:32
How can I load the owner's name of the vehicle as a string? So when someone gets into the car it will display the owner's name?
I have tried this way, but when I get into the vehicle it displays the name as '0'... Why?
here is the code:
I have tried this way, but when I get into the vehicle it displays the name as '0'... Why?
here is the code:
Код:
Load_Vehicles() { new count; new Query[512], savestr[50], rows, fields; for(new i=1; i < MAX_DVEHICLES; i++) { mysql_format(dbHandle,Query, sizeof(Query), "SELECT * FROM `Vehicles` WHERE `ID` = '%d'", i); mysql_query(dbHandle,Query); cache_get_data(rows, fields); if(rows) { cache_get_field_content(0, "ID", savestr); vInfo[i][vID] = strval(savestr); cache_get_field_content(0, "Owner", vInfo[i][vOwner]); cache_get_field_content(0, "Model", savestr); vInfo[i][vModel] = strval(savestr); cache_get_field_content(0, "PosX", savestr); vInfo[i][Pos][vX] = floatstr(savestr); cache_get_field_content(0, "PosY", savestr); vInfo[i][Pos][vY] = floatstr(savestr); cache_get_field_content(0, "PosZ", savestr); vInfo[i][Pos][vZ] = floatstr(savestr); cache_get_field_content(0, "PosA", savestr); vInfo[i][Pos][vR] = floatstr(savestr); cache_get_field_content(0, "Color1", savestr); vInfo[i][vColor1] = strval(savestr); cache_get_field_content(0, "Color2", savestr); vInfo[i][vColor2] = strval(savestr); count++; } AddStaticVehicleEx(vInfo[i][vModel], vInfo[i][Pos][vX], vInfo[i][Pos][vY], vInfo[i][Pos][vZ], vInfo[i][Pos][vR], vInfo[i][vColor1], vInfo[i][vColor2], 60000); } printf("Loaded %d vehicles", count); }