Bis jetzt habe ich halt das hier:
//Autohäuser
enum carEnum{
id_x,
model,
besitzer,
Float:c_x,
Float:c_y,
Float:c_z,
Float:c_r,
db_id
}
new cInfo[50][carEnum];
enum autohauscarEnum{
model,
Float:c_x,
Float:c_y,
Float:c_z,
Float:c_r,
c_preis,
ah_id,
id_x
}
new ahCars[][autohauscarEnum] = {
//WangCars
{487,-1917.1354,299.7520,41.2230,180.0101,1500000,0}, //Model: Meverick, Autohaus: WangCars
{500,-1923.9785,244.8190,41.1475,53.7090,50000,0}, //Model: Mesa, Autohaus: WangCars
//OttosAutohaus
//Lowrider
//Premiumautohaus
{568,1251.3125,-1640.1052,13.4124,145.3927,1500000,3}, //Model: Bandito, Autohaus: Premiumautohaus
{539,1255.1907,-1640.6780,12.9069,140.7137,1000000,3}, //Model: Vox, Autohaus: Premiumautohaus
{434,1263.1641,-1640.3898,13.5158,89.8404,1500000,3}, //Model: Hotnife, Autohaus: Premiumautohaus
{522,1251.5408,-1670.7122,12.2304,31.8340,2000000,3}, //Model: NRG, Autohaus: Premiumautohaus
{494,1243.3973,-1673.5649,11.6967,0.0512,3000000,3}, //Model: Hotracer1, Autohaus: Premiumautohaus
{502,1239.7628,-1673.7272,11.6929,0.8531,3000000,3}, //Model: Hotracer2, Autohaus: Premiumautohaus
{503,1235.8809,-1673.5684,11.6912,0.0183,3000000,3}, //Model: Hotracer3, Autohaus: Premiumautohaus
{444,1217.1498,-1653.9860,12.1682,269.6946,5000000,3}, //Model: Monster1, Autohaus: Premiumautohaus
{556,1217.1593,-1648.1937,12.1719,269.6790,5000000,3}, //Model: Monster2, Autohaus: Premiumautohaus
{557,1216.8578,-1660.8678,12.1718,270.0042,5000000,3}, //Model: Monster3, Autohaus: Premiumautohaus
{495,1263.7916,-1670.3401,13.8987,335.5295,3500000,3}, //Model: Sandking, Autohaus: Premiumautohaus
{469,1276.7881,-1635.3541,27.3875,271.3130,7000000,3}, //Model: Sparrow, Autohaus: Premiumautohaus
{417,1275.1055,-1623.1155,27.4622,267.7712,10000000,3} //Model: Levertan, Autohaus: Premiumautohaus
};
enum autohausEnum{
Float:s_x,
Float:s_y,
Float:s_z,
Float:s_r
}
new ahInfo[][autohausEnum] = {
{-1986.1544,301.9274,34.8220,270.8789}, //WangCars
{-1639.6356,1198.5074,6.8353,269.5013}, //OttosAutohaus
{662.8196,1697.3425,6.8945,220.6671}, //Lowrider
{1284.0648,-1701.2526,13.9219,270.8031} //Premiumautohaus
};
//OnGamemodeInit
//Autohäuser laden
for(new i=0; i<sizeof(ahCars); i++)
{
new string[125];
new Text3D:VehicleTextLabel;
ahCars[i][id_x] = AddStaticVehicle(ahCars[i][model],ahCars[i][c_x],ahCars[i][c_y],ahCars[i][c_z],ahCars[i][c_r],-1,-1);
format(string,sizeof(string),"{B90000}%s\n{FFFFFF}Preis: %d$",VehName,ahCars[i][c_preis]);
VehicleTextLabel = Create3DTextLabel(string,Weis,0,0,0,15,0,1);
Attach3DTextLabelToVehicle(VehicleTextLabel,ahCars[i][id_x],0,0,0); // Das klappt noch nicht so wie ich will...
}
//OnDialogResponse
if(dialogid == DIALOG_AUTOHAUS)
{
if(response == 0)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,Grau,"Du hast den Verkaufsprozess beendet.");
return 1;
}
if(response == 1)
{
new id = GetPVarInt(playerid,"buyCarID");
if(GetPlayerMoney(playerid) < ahCars[id][c_preis])
{
SendClientMessage(playerid,Grau,"Du hast nicht genug Geld.");
RemovePlayerFromVehicle(playerid);
return 1;
}
GivePlayerMoney(playerid,-ahCars[id][c_preis]);
createPlayerCar(playerid,ahCars[id][model],ahInfo[ahCars[id][ah_id]][s_x],ahInfo[ahCars[id][ah_id]][s_y],ahInfo[ahCars[id][ah_id]][s_z],ahInfo[ahCars[id][ah_id]][s_r]);
SendClientMessage(playerid,Blau,"Der Verkauf wurde erfolgreich beendet!");
RemovePlayerFromVehicle(playerid);
return 1;
}
}
//OnPlayerStateChange
if(newstate == PLAYER_STATE_DRIVER)
{
new vID = GetPlayerVehicleID(playerid);
for(new i=0; i<sizeof(ahCars); i++)
{
if(ahCars[i][id_x] != vID) continue;
//Verkaufsprozess
SetPVarInt(playerid,"buyCarID",i);
new string[256];
format(string,sizeof(string),"Type: %d\nPreis: %d$\nMöchtest du das Fahrzeug wirklich kaufen?",vID,ahCars[i][c_preis]);
ShowPlayerDialog(playerid,DIALOG_AUTOHAUS,DIALOG_STYLE_MSGBOX,"Fahrzeugverkauf",string,"Ja","Nein");
break;
}
return 1;
}
//Unten im Script
saveCarToDB(playerid,carid)
{
new query[128],name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(query,sizeof(query),"INSERT INTO autos (modelx,y,z,r) VALUES ('%i','%i','%f','%f','%f','%f')",name,cInfo[carid][model],cInfo[carid][c_x],cInfo[carid][c_y],cInfo[carid][c_z],cInfo[carid][c_r]);
return 1;
}
createPlayerCar(playerid,modelid,Float:x,Float:y,Float:z,Float:r)
{
for(new i=0; i<sizeof(cInfo); i++)
{
if(cInfo[i][id_x] != 0) continue;
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
cInfo[i][besitzer] = playerid;
cInfo[i][c_x] = x;
cInfo[i][c_y] = y;
cInfo[i][c_z] = z;
cInfo[i][c_r] = r;
cInfo[i][model] = modelid;
cInfo[i][id_x] = CreateVehicle(modelid,x,y,z,r,-1,-1,-1);
printf("Das Auto cInfo[%i] wurde erstellt.",i);
saveCarToDB(playerid,i);
return 1;
}
return 1;
}
Und bei mir muss es halt jetzt speichern...