25.02.2019, 08:15
(
Последний раз редактировалось SmokeKiLL; 25.02.2019 в 08:46.
)
Pessoal, estou com um problema muito chato, eu jб identifiquei o problema, mas ta osso de resolver. O que acontece й o seguinte... O carro estб salvando/carregando de boas ! O mas o que acontece й que, se eu NГO coloco esse cуdigo:
Ai o player que logou, puxa os dados de quem comprou um carro recentemente (Ou de quem deslogou, slб) ou seja... se eu nгo reseto, da merda.
Mas ai se eu coloco esse cуdigo ai, TEM VEZ que quem tem um carro acaba meio que resetando '-' e perde o carro, tem como vocкs me ajudarem?
Vou deixar aqui a callback de salvar e carregar o carro.
Se puderem me ajudar, agradeзo, por que eu nгo sei mais o que tentar kkk
PHP код:
for(new i; i < MAX_PLAYERCAR; i ++)
{
ConceInfo[playerid][i][vTemCarro] = 0;
ConceInfo[playerid][i][vModel] = 0;
ConceInfo[playerid][i][vColorOne] = 0;
ConceInfo[playerid][i][vColorTwo] = 0;
ConceInfo[playerid][i][vPlaca] = 0;
ConceInfo[playerid][i][vIPVADia] = 0;
ConceInfo[playerid][i][vIPVAValor] = 0;
ConceInfo[playerid][i][vDPVATDia] = 0;
ConceInfo[playerid][i][vDPVAValor] = 0;
ConceInfo[playerid][i][vTaPreso] = false;
ConceInfo[playerid][i][vLocal][0] = 0;
ConceInfo[playerid][i][vLocal][1] = 0;
ConceInfo[playerid][i][vLocal][2] = 0;
ConceInfo[playerid][i][vAngle] = 0;
ConceInfo[playerid][i][vPreso][0] = 0;
ConceInfo[playerid][i][vPreso][1] = 0;
ConceInfo[playerid][i][vPreso][2] = 0;
ConceInfo[playerid][i][vPresoAngle] = 0;
ConceInfo[playerid][i][vehicleconce] = INVALID_VEHICLE_ID;
}
Mas ai se eu coloco esse cуdigo ai, TEM VEZ que quem tem um carro acaba meio que resetando '-' e perde o carro, tem como vocкs me ajudarem?
Vou deixar aqui a callback de salvar e carregar o carro.
PHP код:
stock SalvarCarros(playerid)
{
new string[34], file[18+24+1];
format(file, sizeof(file), "Concessionaria/%s.txt", pName[playerid]);
for(new i; i < MAX_PLAYERCAR; i ++)
{
if(!DOF2_FileExists(file))
{
DOF2_CreateFile(file);
format(string, sizeof(string), "TemCarro_%d", i);
DOF2::SetInt(file, string, ConceInfo[playerid][i][vTemCarro]);
format(string, sizeof(string), "Modelo_%d", i);
DOF2::SetInt(file, string, ConceInfo[playerid][i][vModel]);
format(string, sizeof(string), "Cor1_%d", i);
DOF2::SetInt(file, string, ConceInfo[playerid][i][vColorOne]);
format(string, sizeof(string), "Cor2_%d", i);
DOF2::SetInt(file, string, ConceInfo[playerid][i][vColorTwo]);
format(string, sizeof(string), "Placa_%d", i);
DOF2::SetString(file, string, ConceInfo[playerid][i][vPlaca]);
format(string, sizeof(string), "IPVADia_%d", i);
DOF2::SetInt(file, string, ConceInfo[playerid][i][vIPVADia]);
format(string, sizeof(string), "IPVAValor_%d", i);
DOF2::SetInt(file, string, ConceInfo[playerid][i][vIPVAValor]);
format(string, sizeof(string), "DPVATDia_%d", i);
DOF2::SetInt(file, string, ConceInfo[playerid][i][vDPVATDia]);
format(string, sizeof(string), "DPVATValor_%d", i);
DOF2::SetInt(file, string, ConceInfo[playerid][i][vDPVAValor]);
format(string, sizeof(string), "CarroX_%d", i);
DOF2::SetFloat(file, string, ConceInfo[playerid][i][vLocal][0]);
format(string, sizeof(string), "CarroY_%d", i);
DOF2::SetFloat(file, string, ConceInfo[playerid][i][vLocal][1]);
format(string, sizeof(string), "CarroZ_%d", i);
DOF2::SetFloat(file, string, ConceInfo[playerid][i][vLocal][2]);
format(string, sizeof(string), "CarroA_%d", i);
DOF2::SetFloat(file, string, ConceInfo[playerid][i][vAngle]);
format(string, sizeof(string), "TaPreso_%d", i);
DOF2::SetBool(file, string, ConceInfo[playerid][i][vTaPreso]);
format(string, sizeof(string), "PresoX_%d", i);
DOF2::SetFloat(file, string, ConceInfo[playerid][i][vPreso][0]);
format(string, sizeof(string), "PresoY_%d", i);
DOF2::SetFloat(file, string, ConceInfo[playerid][i][vPreso][1]);
format(string, sizeof(string), "PresoZ_%d", i);
DOF2::SetFloat(file, string, ConceInfo[playerid][i][vPreso][2]);
format(string, sizeof(string), "PresoA_%d", i);
DOF2::SetFloat(file, string, ConceInfo[playerid][i][vPresoAngle]);
DOF2::SaveFile();
}
else
{
format(string, sizeof(string), "TemCarro_%d", i);
DOF2::SetInt(file, string, ConceInfo[playerid][i][vTemCarro]);
format(string, sizeof(string), "Modelo_%d", i);
DOF2::SetInt(file, string, ConceInfo[playerid][i][vModel]);
format(string, sizeof(string), "Cor1_%d", i);
DOF2::SetInt(file, string, ConceInfo[playerid][i][vColorOne]);
format(string, sizeof(string), "Cor2_%d", i);
DOF2::SetInt(file, string, ConceInfo[playerid][i][vColorTwo]);
format(string, sizeof(string), "Placa_%d", i);
DOF2::SetString(file, string, ConceInfo[playerid][i][vPlaca]);
format(string, sizeof(string), "IPVADia_%d", i);
DOF2::SetInt(file, string, ConceInfo[playerid][i][vIPVADia]);
format(string, sizeof(string), "IPVAValor_%d", i);
DOF2::SetInt(file, string, ConceInfo[playerid][i][vIPVAValor]);
format(string, sizeof(string), "DPVATDia_%d", i);
DOF2::SetInt(file, string, ConceInfo[playerid][i][vDPVATDia]);
format(string, sizeof(string), "DPVATValor_%d", i);
DOF2::SetInt(file, string, ConceInfo[playerid][i][vDPVAValor]);
format(string, sizeof(string), "CarroX_%d", i);
DOF2::SetFloat(file, string, ConceInfo[playerid][i][vLocal][0]);
format(string, sizeof(string), "CarroY_%d", i);
DOF2::SetFloat(file, string, ConceInfo[playerid][i][vLocal][1]);
format(string, sizeof(string), "CarroZ_%d", i);
DOF2::SetFloat(file, string, ConceInfo[playerid][i][vLocal][2]);
format(string, sizeof(string), "CarroA_%d", i);
DOF2::SetFloat(file, string, ConceInfo[playerid][i][vAngle]);
format(string, sizeof(string), "TaPreso_%D", i);
DOF2::SetBool(file, string, ConceInfo[playerid][i][vTaPreso]);
format(string, sizeof(string), "PresoX_%d", i);
DOF2::SetFloat(file, string, ConceInfo[playerid][i][vPreso][0]);
format(string, sizeof(string), "PresoY_%d", i);
DOF2::SetFloat(file, string, ConceInfo[playerid][i][vPreso][1]);
format(string, sizeof(string), "PresoZ_%d", i);
DOF2::SetFloat(file, string, ConceInfo[playerid][i][vPreso][2]);
format(string, sizeof(string), "PresoA_%d", i);
DOF2::SetFloat(file, string, ConceInfo[playerid][i][vPresoAngle]);
DOF2::SaveFile();
}
}
return 1;
}
stock CarregarCarros(playerid)
{
new string[34], file[100], nome[24];
GetPlayerName(playerid, nome, 24);
format(file, 74, "Concessionaria/%s.txt", nome);
if(DOF2_FileExists(file))
{
for(new i = 0; i < MAX_PLAYERCAR; i++)
{
format(string, sizeof(string), "TemCarro_%d", i);
ConceInfo[playerid][i][vTemCarro] = DOF2_GetInt(file, string);
format(string, sizeof(string), "Modelo_%d", i);
ConceInfo[playerid][i][vModel] = DOF2_GetInt(file, string);
format(string, sizeof(string), "Cor1_%d", i);
ConceInfo[playerid][i][vColorOne] = DOF2_GetInt(file, string);
format(string, sizeof(string), "Cor2_%d", i);
ConceInfo[playerid][i][vColorTwo] = DOF2_GetInt(file, string);
format(string, sizeof(string), "IPVADia_%d", i);
ConceInfo[playerid][i][vIPVADia] = DOF2_GetInt(file, string);
format(string, sizeof(string), "IPVAValor_%d", i);
ConceInfo[playerid][i][vIPVAValor] = DOF2_GetInt(file, string);
format(string, sizeof(string), "DPVATDia_%d", i);
ConceInfo[playerid][i][vDPVATDia] = DOF2_GetInt(file, string);
format(string, sizeof(string), "DPVATValor_%d", i);
ConceInfo[playerid][i][vDPVAValor] = DOF2_GetInt(file, string);
format(string, sizeof(string), "CarroX_%d", i);
ConceInfo[playerid][i][vLocal][0] = DOF2_GetFloat(file, string);
format(string, sizeof(string), "CarroY_%d", i);
ConceInfo[playerid][i][vLocal][1] = DOF2_GetFloat(file, string);
format(string, sizeof(string), "CarroZ_%d", i);
ConceInfo[playerid][i][vLocal][2] = DOF2_GetFloat(file, string);
format(string, sizeof(string), "CarroA_%d", i);
ConceInfo[playerid][i][vAngle] = DOF2_GetFloat(file, string);
format(string, sizeof(string), "TaPreso_%d", i);
ConceInfo[playerid][i][vTaPreso] = DOF2_GetBool(file, string);
format(string, sizeof(string), "PresoX_%d", i);
ConceInfo[playerid][i][vPreso][0] = DOF2_GetFloat(file, string);
format(string, sizeof(string), "PresoY_%d", i);
ConceInfo[playerid][i][vPreso][1] = DOF2_GetFloat(file, string);
format(string, sizeof(string), "PresoZ_%d", i);
ConceInfo[playerid][i][vPreso][2] = DOF2_GetFloat(file, string);
format(string, sizeof(string), "PresoA_%d", i);
ConceInfo[playerid][i][vPresoAngle] = DOF2_GetFloat(file, string);
if(ConceInfo[playerid][i][vTemCarro] == 1)
{
ConceInfo[playerid][i][vehicleconce] = CreateVehicle(ConceInfo[playerid][i][vModel],
ConceInfo[playerid][i][vLocal][0], ConceInfo[playerid][i][vLocal][1], ConceInfo[playerid][i][vLocal][2],
ConceInfo[playerid][i][vAngle], ConceInfo[playerid][i][vColorOne], ConceInfo[playerid][i][vColorTwo], -1);
SetVehicleVirtualWorld(ConceInfo[playerid][i][vehicleconce], 0);
LinkVehicleToInterior(ConceInfo[playerid][i][vehicleconce], 0);
vIDPlayer[ConceInfo[playerid][i][vehicleconce]] = playerid;
vTrancado[ConceInfo[playerid][i][vehicleconce]] = 1;
}
}
}
return 1;
}