static stock SalvarCarros()
{
new strsave[64];
for(new idx = 0; idx < sizeof(CarInfo); idx ++)
{
format(strsave, sizeof strsave, Pasta_Carros, idx);
DOF2_SetInt(strsave, "Modelo", CarInfo[idx][cModel]);
DOF2_SetFloat(strsave, "CarroX", CarInfo[idx][cLocationx]);
DOF2_SetFloat(strsave, "CarroY", CarInfo[idx][cLocationy]);
DOF2_SetFloat(strsave, "CarroZ", CarInfo[idx][cLocationz]);
DOF2_SetFloat(strsave, "CarroA", CarInfo[idx][cAngle]);
DOF2_SetInt(strsave, "cor1", CarInfo[idx][cColorOne]);
DOF2_SetInt(strsave, "cor2", CarInfo[idx][cColorTwo]);
DOF2_SetString(strsave, "Dono", CarInfo[idx][cOwner]);
DOF2_SetString(strsave, "Descricao", CarInfo[idx][cDescription]);
DOF2_SetInt(strsave, "Valor", CarInfo[idx][cValue]);
DOF2_SetInt(strsave, "Licence", CarInfo[idx][cLicense]);
DOF2_SetInt(strsave, "TemDono", CarInfo[idx][cOwned]);
DOF2_SetInt(strsave, "Trancado", CarInfo[idx][cLock]);
DOF2_SetInt(strsave, "Grana", CarInfo[idx][cGrana]);
DOF2_SetInt(strsave, "Entrada", CarInfo[idx][cEntrada]);
DOF2_SetInt(strsave, "Date", CarInfo[idx][cDate]);
DOF2_SetFloat(strsave, "OCarroX", CarInfo[idx][cOLocationx]);
DOF2_SetFloat(strsave, "OCarroY", CarInfo[idx][cOLocationy]);
DOF2_SetFloat(strsave, "OCarroZ", CarInfo[idx][cOLocationz]);
DOF2_SetFloat(strsave, "OCarroA", CarInfo[idx][cOAngle]);
DOF2_SaveFile();
}
return true;
}
static stock SalvarCarro(idx)
{
new strsave[64];
format(strsave, sizeof strsave, Pasta_Carros, idx);
if(DOF2_FileExists(strsave))
{
DOF2_SetInt(strsave, "Modelo", CarInfo[idx][cModel]);
DOF2_SetFloat(strsave, "CarroX", CarInfo[idx][cLocationx]);
DOF2_SetFloat(strsave, "CarroY", CarInfo[idx][cLocationy]);
DOF2_SetFloat(strsave, "CarroZ", CarInfo[idx][cLocationz]);
DOF2_SetFloat(strsave, "CarroA", CarInfo[idx][cAngle]);
DOF2_SetInt(strsave, "cor1", CarInfo[idx][cColorOne]);
DOF2_SetInt(strsave, "cor2", CarInfo[idx][cColorTwo]);
DOF2_SetString(strsave, "Dono", CarInfo[idx][cOwner]);
DOF2_SetString(strsave, "Descricao", CarInfo[idx][cDescription]);
DOF2_SetInt(strsave, "Valor", CarInfo[idx][cValue]);
DOF2_SetInt(strsave, "Licence", CarInfo[idx][cLicense]);
DOF2_SetInt(strsave, "TemDono", CarInfo[idx][cOwned]);
DOF2_SetInt(strsave, "Trancado", CarInfo[idx][cLock]);
DOF2_SetInt(strsave, "Grana", CarInfo[idx][cGrana]);
DOF2_SetInt(strsave, "Entrada", CarInfo[idx][cEntrada]);
DOF2_SetInt(strsave, "Date", CarInfo[idx][cDate]);
DOF2_SetFloat(strsave, "OCarroX", CarInfo[idx][cOLocationx]);
DOF2_SetFloat(strsave, "OCarroY", CarInfo[idx][cOLocationy]);
DOF2_SetFloat(strsave, "OCarroZ", CarInfo[idx][cOLocationz]);
DOF2_SetFloat(strsave, "OCarroA", CarInfo[idx][cOAngle]);
DOF2_SaveFile();
}
return true;
}
static stock CarregarCarros()
{
new strsave[100];
//new string[128];
new idx = 0;
while(idx < sizeof(CarInfo))
{
format(strsave, sizeof strsave, Pasta_Carros, idx);
if(DOF2_FileExists(strsave))
{
CarInfo[idx][cModel] = DOF2_GetInt(strsave, "Modelo");
CarInfo[idx][cLocationx] = DOF2_GetFloat(strsave, "CarroX");
CarInfo[idx][cLocationy] = DOF2_GetFloat(strsave, "CarroY");
CarInfo[idx][cLocationz] = DOF2_GetFloat(strsave, "CarroZ");
CarInfo[idx][cAngle] = DOF2_GetFloat(strsave, "CarroA");
CarInfo[idx][cColorOne] = DOF2_GetInt(strsave, "cor1");
CarInfo[idx][cOLocationx] = DOF2_GetFloat(strsave, "CarroX");
CarInfo[idx][cOLocationy] = DOF2_GetFloat(strsave, "CarroY");
CarInfo[idx][cOLocationz] = DOF2_GetFloat(strsave, "CarroZ");
CarInfo[idx][cOAngle] = DOF2_GetFloat(strsave, "CarroA");
CarInfo[idx][cColorTwo] = DOF2_GetInt(strsave, "cor2");
strmid(CarInfo[idx][cOwner], DOF2_GetString(strsave, "Dono"), 0 , strlen(DOF2_GetString(strsave, "Dono")), 255);
strmid(CarInfo[idx][cDescription], DOF2_GetString(strsave, "Descricao"), 0, strlen(DOF2_GetString(strsave, "Descricao")), 255);
CarInfo[idx][cValue] = DOF2_GetInt(strsave, "Valor");
CarInfo[idx][cLicense] = DOF2_GetInt(strsave, "Licence");
CarInfo[idx][cOwned] = DOF2_GetInt(strsave, "TemDono");
CarInfo[idx][cLock] = DOF2_GetInt(strsave, "Trancado");
CarInfo[idx][cGrana] = DOF2_GetInt(strsave, "Grana");
CarInfo[idx][cEntrada] = DOF2_GetInt(strsave, "Entrada");
CarInfo[idx][cDate] = DOF2_GetInt(strsave, "Date");
if(CarInfo[idx][cModel] == 0)
{
CarInfo[idx][cModel] = 559;
}
if(CarInfo[idx][cValue] == 0)
{
CarInfo[idx][cValue] = 10000;
}
if(CarInfo[idx][cEntrada] < 1000)
{
CarInfo[idx][cEntrada] = 1000;
}
CarInfo[idx][ownedvehicle] = AddStaticVehicleEx(CarInfo[idx][cModel],
CarInfo[idx][cLocationx],CarInfo[idx][cLocationy],CarInfo[idx][cLocationz],
CarInfo[idx][cAngle],CarInfo[idx][cColorOne],CarInfo[idx][cColorTwo],-1);
if(strlen(CarInfo[idx][cDescription]) < 2){
strmid(CarInfo[idx][cDescription], "Nenhuma", 0, strlen("Nenhuma"), 255);
}
if(strlen(CarInfo[idx][cOwner]) < 2){
strmid(CarInfo[idx][cOwner], "Ninguйm", 0, strlen("Ninguйm"), 255);
}
if(CarInfo[idx][cOwned])
{
//format(string, sizeof string, "{50AAFE}Dono: %s\n{FFFF00}Descriзгo\n{FFFFFF}»%s«", CarInfo[idx][cOwner], CarInfo[idx][cDescription]);
//CarInfo[idx][cText] = Create3DTextLabel(string, 0xffffaa, 0.0, 0.0, 0.0, 10.0, 0);
//Attach3DTextLabelToVehicle(CarInfo[idx][cText], CarInfo[idx][ownedvehicle], 0.0, 0.0, 0.0);
}
else
{
//CarInfo[idx][cText] = Create3DTextLabel("{50AAFE}Dono: Ninguйm\n{FFFF00}Descriзгo\n{FFFFFF}»Sem Dono«", 0xffffaa, 0.0, 0.0, 0.0, 15.0, 0);
//Attach3DTextLabelToVehicle(CarInfo[idx][cText], CarInfo[idx][ownedvehicle], 0.0, 0.0, 0.0);
}
}
idx++;
}
return idx;
}
|