Sistema de Concessionaria -
SmokeKiLL - 27.01.2019
Bom, eu estou criando esse sistema de concessionaria, nгo sei se foi o melhor jeito para criar, mas... eu estou com uma dъvida, como eu faзo para verificar se o carro que o cara estб й dele realmente e tambйm como eu verifico se ele estб no carro 1, 2 ou 3, por que estou querendo fazer um /estacionar e sem saber em qual carro ele estб, fica difнcil, se alguйm puder me ajudar eu agradeзo.
Se alguйm quiser me mostrar outra maneira de criar esse sistema eu agradeзo tambйm.
PHP код:
enum vConceInfo
{
vTemCarro,
vModel,
vColorOne,
vColorTwo,
Float:vLocalx,
Float:vLocaly,
Float:vLocalz,
Float:vAngle,
vehicleconce,
vTemCarro2,
vModel2,
vColorOne2,
vColorTwo2,
Float:vLocalx2,
Float:vLocaly2,
Float:vLocalz2,
Float:vAngle2,
vehicleconce2,
vTemCarro3,
vModel3,
vColorOne3,
vColorTwo3,
Float:vLocalx3,
Float:vLocaly3,
Float:vLocalz3,
Float:vAngle3,
vehicleconce3
}
new ConceInfo[MAX_PLAYERS][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);
// # Carro 1 #
DOF2_SetInt(file, "TemCarro", ConceInfo[playerid][vTemCarro]);
DOF2_SetInt(file, "Modelo", ConceInfo[playerid][vModel]);
DOF2_SetInt(file, "Cor1", ConceInfo[playerid][vColorOne]);
DOF2_SetInt(file, "Cor2", ConceInfo[playerid][vColorTwo]);
DOF2_SetFloat(file, "CarroX", ConceInfo[playerid][vLocalx]);
DOF2_SetFloat(file, "CarroY", ConceInfo[playerid][vLocaly]);
DOF2_SetFloat(file, "CarroZ", ConceInfo[playerid][vLocalz]);
DOF2_SetFloat(file, "CarroA", ConceInfo[playerid][vAngle]);
// # Carro 2 #
DOF2_SetInt(file, "TemCarro-2", ConceInfo[playerid][vTemCarro2]);
DOF2_SetInt(file, "Modelo-2", ConceInfo[playerid][vModel2]);
DOF2_SetInt(file, "Cor1-2", ConceInfo[playerid][vColorOne2]);
DOF2_SetInt(file, "Cor2-2", ConceInfo[playerid][vColorTwo2]);
DOF2_SetFloat(file, "CarroX-2", ConceInfo[playerid][vLocalx2]);
DOF2_SetFloat(file, "CarroY-2", ConceInfo[playerid][vLocaly2]);
DOF2_SetFloat(file, "CarroZ-2", ConceInfo[playerid][vLocalz2]);
DOF2_SetFloat(file, "CarroA-2", ConceInfo[playerid][vAngle2]);
// # Carro 3 #
DOF2_SetInt(file, "TemCarro-3", ConceInfo[playerid][vTemCarro3]);
DOF2_SetInt(file, "Modelo-3", ConceInfo[playerid][vModel3]);
DOF2_SetInt(file, "Cor1-3", ConceInfo[playerid][vColorOne3]);
DOF2_SetInt(file, "Cor2-3", ConceInfo[playerid][vColorTwo3]);
DOF2_SetFloat(file, "CarroX-3", ConceInfo[playerid][vLocalx3]);
DOF2_SetFloat(file, "CarroY-3", ConceInfo[playerid][vLocaly3]);
DOF2_SetFloat(file, "CarroZ-3", ConceInfo[playerid][vLocalz3]);
DOF2_SetFloat(file, "CarroA-3", ConceInfo[playerid][vAngle3]);
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))
{
ConceInfo[playerid][vTemCarro] = DOF2_GetInt(file, "TemCarro");
ConceInfo[playerid][vModel] = DOF2_GetInt(file, "Modelo");
ConceInfo[playerid][vColorOne] = DOF2_GetInt(file, "Cor1");
ConceInfo[playerid][vColorTwo] = DOF2_GetInt(file, "Cor2");
ConceInfo[playerid][vLocalx] = DOF2_GetFloat(file, "CarroX");
ConceInfo[playerid][vLocaly] = DOF2_GetFloat(file, "CarroY");
ConceInfo[playerid][vLocalz] = DOF2_GetFloat(file, "CarroZ");
ConceInfo[playerid][vAngle] = DOF2_GetFloat(file, "CarroA");
ConceInfo[playerid][vTemCarro2] = DOF2_GetInt(file, "TemCarro-2");
ConceInfo[playerid][vModel2] = DOF2_GetInt(file, "Modelo-2");
ConceInfo[playerid][vColorOne2] = DOF2_GetInt(file, "Cor1-2");
ConceInfo[playerid][vColorTwo2] = DOF2_GetInt(file, "Cor2-2");
ConceInfo[playerid][vLocalx2] = DOF2_GetFloat(file, "CarroX-2");
ConceInfo[playerid][vLocaly2] = DOF2_GetFloat(file, "CarroY-2");
ConceInfo[playerid][vLocalz2] = DOF2_GetFloat(file, "CarroZ-2");
ConceInfo[playerid][vAngle2] = DOF2_GetFloat(file, "CarroA-2");
ConceInfo[playerid][vTemCarro3] = DOF2_GetInt(file, "TemCarro-3");
ConceInfo[playerid][vModel3] = DOF2_GetInt(file, "Modelo-3");
ConceInfo[playerid][vColorOne3] = DOF2_GetInt(file, "Cor1-3");
ConceInfo[playerid][vColorTwo3] = DOF2_GetInt(file, "Cor2-3");
ConceInfo[playerid][vLocalx3] = DOF2_GetFloat(file, "CarroX-3");
ConceInfo[playerid][vLocaly3] = DOF2_GetFloat(file, "CarroY-3");
ConceInfo[playerid][vLocalz3] = DOF2_GetFloat(file, "CarroZ-3");
ConceInfo[playerid][vAngle3] = DOF2_GetFloat(file, "CarroA-3");
if(ConceInfo[playerid][vTemCarro] == 1)
{
ConceInfo[playerid][vehicleconce] = CreateVehicle(ConceInfo[playerid][vModel],
ConceInfo[playerid][vLocalx], ConceInfo[playerid][vLocaly], ConceInfo[playerid][vLocalz],
ConceInfo[playerid][vAngle], ConceInfo[playerid][vColorOne], ConceInfo[playerid][vColorTwo], -1);
SetVehicleVirtualWorld(ConceInfo[playerid][vehicleconce], 0);
LinkVehicleToInterior(ConceInfo[playerid][vehicleconce], 0);
}
if(ConceInfo[playerid][vTemCarro2] == 1)
{
ConceInfo[playerid][vehicleconce2] = CreateVehicle(ConceInfo[playerid][vModel2],
ConceInfo[playerid][vLocalx2], ConceInfo[playerid][vLocaly2], ConceInfo[playerid][vLocalz2],
ConceInfo[playerid][vAngle2], ConceInfo[playerid][vColorOne2], ConceInfo[playerid][vColorTwo2], -1);
SetVehicleVirtualWorld(ConceInfo[playerid][vehicleconce2], 0);
LinkVehicleToInterior(ConceInfo[playerid][vehicleconce2], 0);
}
if(ConceInfo[playerid][vTemCarro3] == 1)
{
ConceInfo[playerid][vehicleconce3] = CreateVehicle(ConceInfo[playerid][vModel3],
ConceInfo[playerid][vLocalx3], ConceInfo[playerid][vLocaly3], ConceInfo[playerid][vLocalz3],
ConceInfo[playerid][vAngle3], ConceInfo[playerid][vColorOne3], ConceInfo[playerid][vColorTwo3], -1);
SetVehicleVirtualWorld(ConceInfo[playerid][vehicleconce3], 0);
LinkVehicleToInterior(ConceInfo[playerid][vehicleconce3], 0);
}
}
return 1;
}
Re: Sistema de Concessionaria -
Felipealves - 27.01.2019
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.
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;
}
Re: Sistema de Concessionaria -
SmokeKiLL - 27.01.2019
Humm... entendi mais ou menos. Tipo... eu coloquei assim:
PHP код:
// Quando ele cria o veнculo
carro_conce[playerid] = CreateVehicle(strval(inputtext), ....);
if(dialogid == 10)
{
if(!response)
{
SendClientMessage(playerid, COLOR_GREY, "Voce cancelou a compra do veiculo.");
return 1;
}
if(response)
{
new vehicleid = GetPlayerVehicleID(playerid),
color_1, color_2, Float:X, Float:Y, Float:Z,
Float:Angle;
GetVehicleColor(vehicleid, color_1, color_2);
GetVehiclePos(vehicleid, X, Y, Z);
GetVehicleZAngle(vehicleid, Angle);
if(ConceInfo[playerid][1][vTemCarro] == 0)
{
ConceInfo[playerid][1][vTemCarro] = 1;
ConceInfo[playerid][1][vModel] = GetVehicleModel(vehicleid);
ConceInfo[playerid][1][vColorOne] = color_1;
ConceInfo[playerid][1][vColorTwo] = color_2;
ConceInfo[playerid][1][vLocal][0] = X;
ConceInfo[playerid][1][vLocal][1] = Y;
ConceInfo[playerid][1][vLocal][2] = Z;
ConceInfo[playerid][1][vAngle] = Angle;
}
SetVehicleVirtualWorld(carro_conce[playerid], 0);
SetPlayerVirtualWorld(playerid, 0);
SetCameraBehindPlayer(playerid);
SalvarPlayerCarro(playerid);
}
return 1;
}
Ai tipo, ele nгo estб salvando, ele cria o arquivo mas nгo salva os dados, to fazendo errado nй?
Re: Sistema de Concessionaria -
Felipealves - 27.01.2019
essa й uma das forma de vc salvar, lembrando que, vocк pode optar por salvar apenas qnd o player sair do servidor ou qnd ele comprar o veiculo, mas lembre de carregar, pd ser dessa mesma forma sу q invertido ;0
que nгo vai
PHP код:
new string[34], file[24];
// Carros
format(file, sizeof(file), "Concessionaria/%s.txt", nome);
DOF2_CreateFile(file);
for(new i = 0; i < 3; i++){
format(string, sizeof(string), "TemCarro_%d", i);
DOF2_SetInt(file, string, ConceInfo[0][i][vTemCarro]);
format(string, sizeof(string), "Modelo_%d", i);
DOF2_SetInt(file, string, ConceInfo[0][i][vModel]);
format(string, sizeof(string), "Cor1_%d", i);
DOF2_SetInt(file, string, ConceInfo[0][i][vColorOne]);
format(string, sizeof(string), "Cor2_%d", i);
DOF2_SetInt(file, string, ConceInfo[0][i][vColorTwo]);
format(string, sizeof(string), "CarroX_%d", i);
DOF2_SetFloat(file, string, ConceInfo[0][i][vLocal][0]);
format(string, sizeof(string), "CarroY_%d", i);
DOF2_SetFloat(file, string, ConceInfo[0][i][vLocal][1]);
format(string, sizeof(string), "CarroZ_%d", i);
DOF2_SetFloat(file, string, ConceInfo[0][i][vLocal][2]);
format(string, sizeof(string), "CarroA_%d", i);
DOF2_SetFloat(file, string, ConceInfo[0][i][vAngle]);
}
DOF2_SaveFile();
@edit: o 'zero' ali й o player id.
Re: Sistema de Concessionaria -
SmokeKiLL - 27.01.2019
Pera... agora buguei de vez kkkk tipo... pra mim setar esses valores, eu tenho que colocar isso que vocк mandou e tambйm colocar exemplo:
PHP код:
ConceInfo[playerid][1][vTemCarro] = 1;
ConceInfo[playerid][1][vModel] = GetVehicleModel(vehicleid);
ConceInfo[playerid][1][vColorOne] = color_1;
ConceInfo[playerid][1][vColorTwo] = color_2;
ConceInfo[playerid][1][vLocal][0] = X;
ConceInfo[playerid][1][vLocal][1] = Y;
ConceInfo[playerid][1][vLocal][2] = Z;
ConceInfo[playerid][1][vAngle] = Angle;
Colocar essas informaзхes, й isso?
@edit Ah entendi mano, estб pegando aqui, vlw +REP Qualquer coisa eu venho encher teu saco de novo aqui ksksks
Re: Sistema de Concessionaria -
Felipealves - 27.01.2019
Sim, isso que vc vai colocar pra armazenar as informaзхes do veiculo novo do player, qnd ele comprar, dps sу salva.
coloque abaixo, ou crie uma funзгo para salvar desse jeito.
PHP код:
new string[34], file[18+24+1];
// Carros
format(file, sizeof(file), "Concessionaria/%s.txt", nome);
if(!DOF2_FileExists(file)){
DOF2_CreateFile(file);
for(new i = 0; i < 3; i++){
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), "CarroX_%d", i);
DOF2_SetFloat(file, string, ConceInfo[playerid][i][vLocal][playerid]);
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]);
}
DOF2_SaveFile();
}else{
for(new i = 0; i < 3; i++){
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), "CarroX_%d", i);
DOF2_SetFloat(file, string, ConceInfo[playerid][i][vLocal][playerid]);
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]);
}
DOF2_SaveFile();
}
Re: Sistema de Concessionaria -
SmokeKiLL - 27.01.2019
Blz, vou dar uma testada aqui.
Re: Sistema de Concessionaria -
SmokeKiLL - 27.01.2019
@Edit Refiz o sistema aqui, estб salvando de boas, cada um dos carros, o problema й que nгo estб carregando o carro quando ele destrуi.
PHP код:
stock CarregarCarros(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;
}
Re: Sistema de Concessionaria -
Felipealves - 28.01.2019
Eu falei pra carregar igual salvar...
ex: faz isso em todos...
PHP код:
format(string, sizeof(string), "TemCarro_%d", i);
ConceInfo[playerid][i][vTemCarro] = DOF2_GetInt(file, string);
Re: Sistema de Concessionaria -
SmokeKiLL - 28.01.2019
Estб carregando apenas 1 carro
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;
}
@Edit Dialog caso precise...
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;
}