17/07/2024 20:05 
	
	
	
		Olá tudo bem?
Então recentemente fiz a conversão do meu servidor de dini para MySQL
e quando crio veículos ele salva e tals, mas quando reinicio o servidor os veículos não são criado novamente.
OnGameModeInt:
CMD de criar veículo caso precise:
	
	
	
	
Então recentemente fiz a conversão do meu servidor de dini para MySQL
e quando crio veículos ele salva e tals, mas quando reinicio o servidor os veículos não são criado novamente.
OnGameModeInt:
Código:
for(new carror = 0; carror < MAX_CARROS; carror++) {
        CarregarCarros(carror);
    }Código:
function:CarregarCarros(vehid) {
    VehInfo[vehid][vORM] = orm_create("concessionaria", Conexao);
    VehInfo[vehid][VehID] = vehid;
    orm_addvar_float(VehInfo[vehid][vORM], VehInfo[vehid][CordX], "CordX");
    orm_addvar_float(VehInfo[vehid][vORM], VehInfo[vehid][CordY], "CordY");
    orm_addvar_float(VehInfo[vehid][vORM], VehInfo[vehid][CordZ], "CordZ");
    orm_addvar_float(VehInfo[vehid][vORM], VehInfo[vehid][Angulo], "Angulo");
    orm_addvar_float(VehInfo[vehid][vORM], VehInfo[vehid][rtX], "rtX");
    orm_addvar_float(VehInfo[vehid][vORM], VehInfo[vehid][rtY], "rtY");
    orm_addvar_float(VehInfo[vehid][vORM], VehInfo[vehid][rtZ], "rtZ");
    orm_addvar_float(VehInfo[vehid][vORM], VehInfo[vehid][Angulo1], "Angulo1");
    orm_addvar_int(VehInfo[vehid][vORM], VehInfo[vehid][Modelo], "Modelo");
    orm_addvar_int(VehInfo[vehid][vORM], VehInfo[vehid][vCor1], "Cor1");
    orm_addvar_int(VehInfo[vehid][vORM], VehInfo[vehid][vCor2], "Cor2");
    orm_addvar_int(VehInfo[vehid][vORM], VehInfo[vehid][TDono], "TDono");
    orm_addvar_int(VehInfo[vehid][vORM], VehInfo[vehid][TDono2], "TDono2");
    orm_addvar_int(VehInfo[vehid][vORM], VehInfo[vehid][Preco], "Preco");
    orm_addvar_int(VehInfo[vehid][vORM], VehInfo[vehid][Destrancado], "Destrancado");
    orm_addvar_int(VehInfo[vehid][vORM], VehInfo[vehid][Farol], "Farol");
    orm_addvar_int(VehInfo[vehid][vORM], VehInfo[vehid][Capo], "Capo");
    orm_addvar_int(VehInfo[vehid][vORM], VehInfo[vehid][Motor], "Motor");
    orm_addvar_int(VehInfo[vehid][vORM], VehInfo[vehid][Alarme], "Alarme");
    orm_addvar_int(VehInfo[vehid][vORM], VehInfo[vehid][Portas], "Portas");
    orm_addvar_int(VehInfo[vehid][vORM], VehInfo[vehid][PMalas], "PMalas");
    orm_addvar_int(VehInfo[vehid][vORM], VehInfo[vehid][Litros], "Litros");
    orm_addvar_int(VehInfo[vehid][vORM], VehInfo[vehid][Problema], "Problema");
    orm_addvar_int(VehInfo[vehid][vORM], VehInfo[vehid][Contasveiculo], "Contasveiculo");
    orm_addvar_string(VehInfo[vehid][vORM], VehInfo[vehid][Dono], 24, "Dono");
    orm_addvar_string(VehInfo[vehid][vORM], VehInfo[vehid][Dono2], 24, "Dono2");
    orm_addvar_string(VehInfo[vehid][vORM], VehInfo[vehid][vNome], 24, "Nome");
    orm_addvar_string(VehInfo[vehid][vORM], VehInfo[vehid][Placa], 24, "Placa");
    orm_setkey(VehInfo[vehid][vORM], "VehID");
    orm_select(VehInfo[vehid][vORM], "GerarV2", "i", indid);
    return 1;
}
    
function:GerarV2(vehid) {
    if(orm_errno(VehInfo[vehid][vORM]) != ERROR_NO_DATA) {
        if(VehInfo[vehid][Modelo] != 0) {
            new carroid;
            SetVehicleNumberPlate(carroid = CreateVehicle(VehInfo[carror][Modelo],
            VehInfo[carror][CordX],
            VehInfo[carror][CordY],
            VehInfo[carror][CordZ],
            VehInfo[carror][Angulo],
            VehInfo[carror][vCor1],
            VehInfo[carror][vCor2], false),
            VehInfo[carror][Placa]);
            VehInfo[carror][Carro] = carroid;
            CarregCar(carroid);
            CarregarCarros(carroid);
            proximocarro++;
        }
    }
}CMD de criar veículo caso precise:
Código:
CMD:ccar(playerid, params[]) {
    if(IsPlayerAdmin(playerid)|| pAdmin[playerid] == 5) {
        new carid, Float:ang, preco, cor1, cor2, string[200];
        if(sscanf(params, "dddd", carid, preco, cor1, cor2)) return SendClientMessage(playerid, ERRO_BVR, "| ERRO | Digite: /ccar [id] [preço] [cor1] [cor2]");
        if(carid >= 400 && carid <= 611) {
            if(IsPlayerInAnyVehicle(playerid)) {
                new Float:X, Float:Y, Float:Z;
                GetPlayerPos(playerid, X, Y, Z);
                GetVehicleZAngle(GetPlayerVehicleID(playerid), ang);
//                if(VehInfo[proximocarro][VehID] == 0) {
                new Query[400];
                mysql_format(Conexao, Query, sizeof(Query), "INSERT INTO `concessionaria`(`VehID`, `Modelo`, `CordX`, `CordY`, `CordZ`, `Angulo`, `Cor1`, `Cor2`, `Preco`, `rtX`, `rtY`, `rtZ`, `Angulo1`) VALUES ('%d', '%d',     '%f', '%f', '%f', '%f', '%d', '%d', '%d', '%f', '%f', '%f', '%f')", proximocarro, carid, X, Y, Z, ang, cor1, cor2, preco, X, Y, Z, ang);
                mysql_tquery(Conexao, Query);
//                }
                SetTimerEx("CriarVeiculo2", 5000, false, "dffffdd", carid, X, Y, Z, ang, cor1, cor2);
                format(string, sizeof(string), "| INFO | Você colocou um veículo a venda.");
                SendClientMessage(playerid, 0xB0FF30AA, string);
                format(string, sizeof(string), "| INFO | Saia do local onde você colocou o veículo!");
                SendClientMessage(playerid, ERRO_BVR, string);
                return 1;
            } else SendClientMessage(playerid, ERRO_BVR, "| ERRO | Você não está em um veículo.");
            return 1;
        } else SendClientMessage(playerid, ERRO_BVR, "| ERRO | Veículo inválido!");
        return 1;
    } else SendClientMessage(playerid, ERRO_BVR, "| ERRO | Você não tem permissão!");
    return 1;
}