new q[128],w;
format(q,sizeof q,"SELECT `ID`, `Status`, `Model` FROM `Playercars` WHERE `Owner` = '%s'",pInfo[playerid][pName]);
//mysql_format(dbHandle,q,sizeof q,"SELECT `ID`, `Status`, `Model` FROM `Playercars` WHERE `Owner` = '%e'",pInfo[playerid][pName]);
mysql_query(q);
mysql_store_result();
if(mysql_num_rows()) {
while(mysql_fetch_row(str)) {
w++;
new st,md,id;
sscanf(str,"p<|>ddd",id,st,md);
switch(w) {
case 1: {
PlayerTextDrawSetPreviewModel(playerid, Stats[29][playerid], md);
cStats[0][playerid] = id;
if(st == 1) { PlayerTextDrawBackgroundColor(playerid, Stats[29][playerid], 0x00D900FF); format(in,sizeof in,"%s~n~~g~Nicht Defekt",PlayerVehicle[md-400]); PlayerTextDrawSetString(playerid, Stats[33][playerid], in); }
else if(st == 0) { PlayerTextDrawBackgroundColor(playerid, Stats[29][playerid], 0xFF0000FF); format(in,sizeof in,"%s~n~~r~Defekt",PlayerVehicle[md-400]); PlayerTextDrawSetString(playerid, Stats[33][playerid], in); }
PlayerTextDrawShow(playerid, Stats[29][playerid]), PlayerTextDrawShow(playerid, Stats[33][playerid]);
}
case 2: {
PlayerTextDrawSetPreviewModel(playerid, Stats[30][playerid], md);
cStats[1][playerid] = id;
if(st == 1) { PlayerTextDrawBackgroundColor(playerid, Stats[30][playerid], 0x00D900FF); format(in,sizeof in,"%s~n~~g~Nicht Defekt",PlayerVehicle[md-400]); PlayerTextDrawSetString(playerid, Stats[34][playerid], in); }
else if(st == 0) { PlayerTextDrawBackgroundColor(playerid, Stats[30][playerid], 0xFF0000FF); format(in,sizeof in,"%s~n~~r~Defekt",PlayerVehicle[md-400]); PlayerTextDrawSetString(playerid, Stats[34][playerid], in); }
PlayerTextDrawShow(playerid, Stats[29][playerid]), PlayerTextDrawShow(playerid, Stats[33][playerid]), PlayerTextDrawShow(playerid, Stats[30][playerid]), PlayerTextDrawShow(playerid, Stats[34][playerid]);
}
}
}
}
mysql_free_result();
zu
new dbhandle; //Oben erstellen lassen
dbhandle = mysql_connect(host, user, data, pass, port, autoreconnect, pool); //Verbindungsaufbau
switch(mysql_errno(dbhandle)){
case false:{
// Verbindung steht
}
default: {
// Verbindung fehlt
}
}
mysql_format(dbhandle, q, sizeof q, "SELECT `ID`, `Status`, `Model` FROM `Playercars` WHERE `Owner` = '%e'", pInfo[playerid][pName]),
mysql_pquery(dbhandle, q, "LoadingModel", "i", playerid); //Query ausführen
//Callback
static LoadingModel(playerid);
public LoadingModel(playerid){
if(cache_get_row_count(dbhandle) > 0){
new w;
for(new i;i<cache_get_row_count(dbhandle);i++){
new st,md,id;
w++,
st = cache_get_field_content_int(i, "Status", dbhandle),
md = cache_get_field_content_int(i, "Model", dbhandle),
id = cache_get_field_content_int(i, "ID", dbhandle);
switch(w) {
case 1:{
PlayerTextDrawSetPreviewModel(playerid, Stats[29][playerid], md);
cStats[0][playerid] = id;
if(st == 1) { PlayerTextDrawBackgroundColor(playerid, Stats[29][playerid], 0x00D900FF); format(in,sizeof in,"%s~n~~g~Nicht Defekt",PlayerVehicle[md-400]); PlayerTextDrawSetString(playerid, Stats[33][playerid], in); }
else if(st == 0) { PlayerTextDrawBackgroundColor(playerid, Stats[29][playerid], 0xFF0000FF); format(in,sizeof in,"%s~n~~r~Defekt",PlayerVehicle[md-400]); PlayerTextDrawSetString(playerid, Stats[33][playerid], in); }
PlayerTextDrawShow(playerid, Stats[29][playerid]), PlayerTextDrawShow(playerid, Stats[33][playerid]);
}
case 2:{
PlayerTextDrawSetPreviewModel(playerid, Stats[30][playerid], md);
cStats[1][playerid] = id;
if(st == 1) { PlayerTextDrawBackgroundColor(playerid, Stats[30][playerid], 0x00D900FF); format(in,sizeof in,"%s~n~~g~Nicht Defekt",PlayerVehicle[md-400]); PlayerTextDrawSetString(playerid, Stats[34][playerid], in); }
else if(st == 0) { PlayerTextDrawBackgroundColor(playerid, Stats[30][playerid], 0xFF0000FF); format(in,sizeof in,"%s~n~~r~Defekt",PlayerVehicle[md-400]); PlayerTextDrawSetString(playerid, Stats[34][playerid], in); }
PlayerTextDrawShow(playerid, Stats[29][playerid]), PlayerTextDrawShow(playerid, Stats[33][playerid]), PlayerTextDrawShow(playerid, Stats[30][playerid]), PlayerTextDrawShow(playerid, Stats[34][playerid]);
}
}
}
}
}
Orientiere dich mal an dem Quellcode.
mfg 