19.11.2010, 20:25
Hi all and thanks for have read this.
Where is the problem?
I use the mysql plugin of StrikenKid. But why this don't work and don't load my vehicles?
Very Thanks to all xpeppe
Where is the problem?
Код:
public LoadPlayerVehicles(playerid)
{
new data[1024],loaded,row;
new c,a,dbid,model,vowner,Float:posx,Float:posy,Float:posz,Float:posa,vcolor1,vcolor2,vpaintjob,vmod[128],vplate[20],vlock,vgas,vgps,vassi;
format(Query,sizeof(Query),"SELECT * FROM `uvehicles` WHERE `owner` = %d",PlayerInfo[playerid][pDatabaseID]);
mysql_query(Query);
mysql_store_result();
row = mysql_num_rows();
for(new i = 0; i < row; i++)
{
mysql_fetch_row(data,"|"); // Creo stringa dati
printf("%s",data);
sscanf(data, "p<|>dddfffddds[128]s[20]dddd",dbid,model,vowner,posx,posy,posz,posa,vcolor1,vcolor2,vpaintjob,vmod,vplate,vlock,vgps,vassi);
c = AddStaticVehicleEx(model,posx,posy,posz,posa,vcolor1,vcolor2,-1);
printf("%d",c);
PVehicles[c][pvehidDB] = dbid; PVehicles[c][pvehid] = c; PVehicles[c][pmodelid] = model; PVehicles[c][powner] = vowner;
PVehicles[c][pposx] = posx; PVehicles[c][pposy] = posy; PVehicles[c][pposz] = posz; PVehicles[c][pposa] = posa;
PVehicles[c][pcolor1] = vcolor1; PVehicles[c][pcolor2] = vcolor2; PVehicles[c][pmod] = vmod; PVehicles[c][pplate] = vplate;
PVehicles[c][plock] = vlock; PVehicles[c][pgas] = vgas; PVehicles[c][pgps] = vgps; PVehicles[c][passi] = vassi;
PVehicles[c][ppaintjob] = vpaintjob;
if (vpaintjob != 20) {ChangeVehiclePaintjob(c,vpaintjob);}
SendClientMessageEx(playerid,COLOR_ALERT,"%s",c);
printf("|> E' stato creato un veicolo di: %s. Con ID: %d",PlayerName(playerid),c);
loaded++;
}
printf("|> Sono stati caricati i %d veicoli di %s",loaded,PlayerName(playerid));
mysql_free_result();
}
Very Thanks to all xpeppe

