27.01.2019, 10:49
Basicamente vocк vai seguir o MAX_PLAYERCAR
no caso ele vai sempre o i, ConceInfo[playerid][i] aqui entra ele [vTemCarro] e depois й chamado o enum, entгo se vocк quiser verificar o carro 3 bota, ConceInfo[playerid][2][vTemCarro] ou carro 1 ConceInfo[playerid][1][vTemCarro]. enfim й isso, qualquer coisa mais tarde eu vejo sua duvida.
no caso ele vai sempre o i, ConceInfo[playerid][i] aqui entra ele [vTemCarro] e depois й chamado o enum, entгo se vocк quiser verificar o carro 3 bota, ConceInfo[playerid][2][vTemCarro] ou carro 1 ConceInfo[playerid][1][vTemCarro]. enfim й isso, qualquer coisa mais tarde eu vejo sua duvida.
PHP код:
#define MAX_PLAYERCAR 3
enum vConceInfo
{
vTemCarro,
vModel,
vColorOne,
vColorTwo,
Float:vLocal[3],
Float:vAngle,
vehicleconce,
}
new ConceInfo[MAX_PLAYERS][MAX_PLAYERCAR][vConceInfo];
stock SalvarPlayerCarro(playerid)
{
new file[100], nome[24];
GetPlayerName(playerid, nome, 24);
format(file, 74, "Concessionaria/%s.txt", nome);
if(!DOF2_FileExists(file)) DOF2_CreateFile(file);
// Carros
for(new i = 0; i < MAX_PLAYERCAR; i++){
DOF2_SetInt(file, "TemCarro", ConceInfo[playerid][i][vTemCarro]);
DOF2_SetInt(file, "Modelo", ConceInfo[playerid][i][vModel]);
DOF2_SetInt(file, "Cor1", ConceInfo[playerid][i][vColorOne]);
DOF2_SetInt(file, "Cor2", ConceInfo[playerid][i][vColorTwo]);
DOF2_SetFloat(file, "CarroX", ConceInfo[playerid][i][vLocal][0]);
DOF2_SetFloat(file, "CarroY", ConceInfo[playerid][i][vLocal][1]);
DOF2_SetFloat(file, "CarroZ", ConceInfo[playerid][i][vLocal][2]);
DOF2_SetFloat(file, "CarroA", ConceInfo[playerid][i][vAngle]);
}
DOF2_SaveFile();
return 1;
}
stock CarregarCarro(playerid)
{
new 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++){
ConceInfo[playerid][i][vTemCarro] = DOF2_GetInt(file, "TemCarro");
ConceInfo[playerid][i][vModel] = DOF2_GetInt(file, "Modelo");
ConceInfo[playerid][i][vColorOne] = DOF2_GetInt(file, "Cor1");
ConceInfo[playerid][i][vColorTwo] = DOF2_GetInt(file, "Cor2");
ConceInfo[playerid][i][vLocal][0] = DOF2_GetFloat(file, "CarroX");
ConceInfo[playerid][i][vLocal][1] = DOF2_GetFloat(file, "CarroY");
ConceInfo[playerid][i][vLocal][2] = DOF2_GetFloat(file, "CarroZ");
ConceInfo[playerid][i][vAngle] = DOF2_GetFloat(file, "CarroA");
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;
}
CMD:estacionar(playerid){
new vehicleid = GetPlayerVehicleID(playerid);
for(new i = 0; i < MAX_PLAYERCAR; i++){
if(ConceInfo[playerid][i][vehicleconce] == vehicleid){
new Float:pPos[4];
GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
GetPlayerFacingAngle(playerid, pPos[3]);
ConceInfo[playerid][i][vLocal][0] = 0.0;
ConceInfo[playerid][i][vLocal][1] = pPos[1];
ConceInfo[playerid][i][vLocal][2] = pPos[2];
ConceInfo[playerid][i][vAngle] = pPos[3];
DestroyVehicle(ConceInfo[playerid][i][vehicleconce]);
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);
break;
}
}
return 1;
}