28.01.2019, 01:51
Estб carregando apenas 1 carro
@Edit Dialog caso precise...
PHP код:
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), "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);
if(ConceInfo[playerid][i][vTemCarro] == i)
{
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);
}
}
}
return 1;
}
PHP код:
if(dialogid == D_Conce)
{
if(response)
{
if(!strlen(inputtext) || (!IsNumeric(inputtext)))
return ForT:conce(playerid);
if(strval(inputtext) < 400 || (strval(inputtext) > 611))
return SendClientMessage(playerid, -1, "Modelo Do Carro Tem Que Ser Entre 411 e 600 !");
if(!IsACarrosConce(strval(inputtext))) return SendClientMessage(playerid, -1, "Este modelo nao esta disponivel !");
SetPVarInt(playerid, "idcarro_conce", strval(inputtext));
new randomMundo;
randomMundo = random(50000);
if(ConceInfo[playerid][0][vTemCarro] == 0)
{
ConceInfo[playerid][0][vehicleconce] = CreateVehicle(strval(inputtext), 2148.0720, -1143.0665, 25.0160, -90.0000, 1, 1, -1);
PutPlayerInVehicle(playerid, ConceInfo[playerid][0][vehicleconce], 0);
SetVehicleVirtualWorld(ConceInfo[playerid][0][vehicleconce], randomMundo);
}
else if(ConceInfo[playerid][1][vTemCarro] == 0)
{
ConceInfo[playerid][1][vehicleconce] = CreateVehicle(strval(inputtext), 2148.0720, -1143.0665, 25.0160, -90.0000, 1, 1, -1);
PutPlayerInVehicle(playerid, ConceInfo[playerid][1][vehicleconce], 0);
SetVehicleVirtualWorld(ConceInfo[playerid][1][vehicleconce], randomMundo);
}
else if(ConceInfo[playerid][2][vTemCarro] == 0)
{
ConceInfo[playerid][2][vehicleconce] = CreateVehicle(strval(inputtext), 2148.0720, -1143.0665, 25.0160, -90.0000, 1, 1, -1);
PutPlayerInVehicle(playerid, ConceInfo[playerid][2][vehicleconce], 0);
SetVehicleVirtualWorld(ConceInfo[playerid][2][vehicleconce], randomMundo);
}
SetPlayerCameraPos(playerid, 2152.5361, -1133.9518, 29.8716);
SetPlayerCameraLookAt(playerid, 2152.0764, -1134.8392, 29.5416);
SetPlayerVirtualWorld(playerid, randomMundo);
SetPlayerInterior(playerid, 0);
SetTimerEx("Dialog_Conce_Preco", 2000, false, "i", playerid);
}
return 1;
}
if(dialogid == D_Conce_Preco)
{
if(!response)
{
if(ConceInfo[playerid][0][vTemCarro] == 0){DestroyVehicle(ConceInfo[playerid][0][vehicleconce]);}
else if(ConceInfo[playerid][1][vTemCarro] == 0){DestroyVehicle(ConceInfo[playerid][1][vehicleconce]);}
else if(ConceInfo[playerid][2][vTemCarro] == 0){DestroyVehicle(ConceInfo[playerid][2][vehicleconce]);}
SetPlayerPos(playerid, 2131.8552, -1151.3229, 24.0606);
SetPlayerFacingAngle(playerid, 178.9879);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
SetCameraBehindPlayer(playerid);
SendClientMessage(playerid, -1, "Voce cancelou a compra do veiculo.");
return 1;
}
if(response)
{
new vehicleid = GetPlayerVehicleID(playerid),
color_1, color_2, Float:PosVeh[4];
for(new i = 0; i < MAX_PLAYERCAR; i++)
{
if(ConceInfo[playerid][i][vehicleconce] == vehicleid)
{
GetVehicleColor(vehicleid, color_1, color_2);
GetVehiclePos(vehicleid, PosVeh[0], PosVeh[1], PosVeh[2]);
GetVehicleZAngle(vehicleid, PosVeh[3]);
ConceInfo[playerid][i][vTemCarro] = 1;
ConceInfo[playerid][i][vModel] = GetVehicleModel(vehicleid);
ConceInfo[playerid][i][vColorOne] = color_1;
ConceInfo[playerid][i][vColorTwo] = color_2;
ConceInfo[playerid][i][vLocal][0] = PosVeh[0];
ConceInfo[playerid][i][vLocal][1] = PosVeh[1];
ConceInfo[playerid][i][vLocal][2] = PosVeh[2];
ConceInfo[playerid][i][vAngle] = PosVeh[3];
SetVehicleVirtualWorld(ConceInfo[playerid][i][vehicleconce], 0);
SetPlayerVirtualWorld(playerid, 0);
}
}
SetCameraBehindPlayer(playerid);
SalvarCarros(playerid);
}
return 1;
}