all going thro mysql locking finding car gass and other simple stuff but when need
vehicleid i don't know how get it because its a simple lines of mysql wich just spawning ongamemodeinit and controling them by player from server. problem is that when player destroy vehicle or just simple want to respawn the vehicle in script dos not have realy vehicle id.
actuoly I need a break server vehicles{server/vehicleid} | private vehicles (mysql/vehicleid's)
Код:
//ongamemodeinit
new Queryqx[250], float: LPos[6],Cowner[250],CVid[250],owgass[258],carsids[358],bool:carlock[250],color[2];
format(Queryqx, sizeof(Queryqx), "SELECT * FROM `masina`");
mysql_query(Queryqx);
mysql_store_result();
new b = 0;
while(mysql_retrieve_row())
{
mysql_fetch_field_row(LPos[0], "x"); manomasina[b][mano_x] = floatstr(LPos[0]);
mysql_fetch_field_row(LPos[1], "y"); manomasina[b][mano_y] = floatstr(LPos[1]);
mysql_fetch_field_row(LPos[2], "z"); manomasina[b][mano_z] = floatstr(LPos[2]);
mysql_fetch_field_row(LPos[3], "a"); manomasina[b][mano_a] = floatstr(LPos[3]);
mysql_fetch_field_row(Cowner, "owner"); manomasina[b][massavininkas] = strval(Cowner);
mysql_fetch_field_row(CVid, "vid"); manomasina[b][manomid] = strval(CVid);
mysql_fetch_field_row(owgass, "bakas"); manomasina[b][manomkuras] = strval(owgass);
mysql_fetch_field_row(carsids, "id"); manomasina[b][masvehidq] = !strval(carsids);
mysql_fetch_field_row(carlock, "locked"); manomasina[b][lockedvehm] = strval(carlock);
mysql_fetch_field_row(LPos[4], "health"); manomasina[b][masinoshealth] = floatstr(LPos[4]);
mysql_fetch_field_row(LPos[5], "rida"); manomasina[b][masinosrida] = floatstr(LPos[4]);
mysql_fetch_field_row(color[0], "spalva"); manomasina[b][macolor0] = strval(color[0]);
mysql_fetch_field_row(color[1], "spalva1"); manomasina[b][macolor1] = strval(color[1]);
manomasina[b][masvehid] = Vehicle(manomasina[b][manomid],manomasina[b][mano_x], manomasina[b][mano_y], manomasina[b][mano_z],manomasina[b][mano_a],manomasina[b][macolor0],manomasina[b][macolor1],manomasina[b][manomkuras],manomasina[b][masinoshealth],manomasina[b][masinosrida]);
b++;
}
forward checkcarlock(playerid);
public checkcarlock(playerid){
new Float:cooc[4];
// GetPlayerPos(playerid,cooc[0],cooc[1],cooc[2]);
new Queryqx[250], float: LPos[3],Cowner[250],CVid[250],owgass[258],carsids[358],carlock[250];
format(Queryqx, sizeof(Queryqx), "SELECT * FROM `masina`");
mysql_query(Queryqx);
mysql_store_result();
new b = 0;
while(mysql_retrieve_row()){
mysql_fetch_field_row(LPos[0], "x"); manomasina[b][mano_x] = floatstr(LPos[0]);
mysql_fetch_field_row(LPos[1], "y"); manomasina[b][mano_y] = floatstr(LPos[1]);
mysql_fetch_field_row(LPos[2], "z"); manomasina[b][mano_z] = floatstr(LPos[2]);
mysql_fetch_field_row(Cowner, "owner"); manomasina[b][massavininkas] = strval(Cowner);
mysql_fetch_field_row(CVid, "vid"); manomasina[b][manomid] = strval(CVid);
mysql_fetch_field_row(owgass, "bakas"); manomasina[b][manomkuras] = strval(owgass);
mysql_fetch_field_row(carsids, "id"); manomasina[b][masvehidq] = strval(carsids);
mysql_fetch_field_row(carlock, "locked"); manomasina[b][lockedvehm] = strval(carlock);
GetVehiclePos(manomasina[b][masvehid], cooc[0], cooc[1], cooc[2]);
GetVehicleZAngle(manomasina[b][masvehid], cooc[3]);
if(manomasina[b][lockedvehm] == 1) {
SetVehicleParamsForPlayer(manomasina[b][masvehid], playerid, 0, 1);
}else{
SetVehicleParamsForPlayer(manomasina[b][masvehid], playerid, 0, 0);
}
b++;
}
}
b is great for listing cars anmd controling them but somewhere you can't use b because they crash. i tried make and shop but when new car added to mysql and server then mysql ids makes random like before 1 2 3 4 5 after 2 5 4 3 1 and all system goes crazy