19.03.2018, 13:33
alguem ajuda, nao sei oque ta acontecendo , nao sei se ta criando 2 veiculos ou se quando desloga o carro nao destroy, pode ser que esteja criando 2 carros ai quando desloga deleta somente 1 e assim sempre vai enchendo de carro
Код:
forward LoadPlayerVehicle(playerid); public LoadPlayerVehicle(playerid) { new openfile[128]; new nomeplayer[MAX_PLAYER_NAME];//, nomefavorecido[MAX_PLAYER_NAME], idfavorecido; GetPlayerName(playerid, nomeplayer, sizeof(nomeplayer)); format(openfile, sizeof openfile, VEH_SAVE_FILE, PlayerName(playerid)); printf("Nome do Arquivo: %s", openfile); if (!fexist(openfile)) return 1; // He doesn't own a vehicle print("Carregando Carro do Jogador"); new File:vehs = fopen(openfile,io_read); new string[256]; new load[30][32]; new newload = 15; // last "strval(load[x])" before the mods loop if(vehs) { print("Pronto para Ler Os Arquivos"); while (fread(vehs, string, 256)) { split(string, load, '|'); print("Spanwando o Veiculo"); // Spawn vehicles new vic = INVALID_VEHICLE_ID; if (strval(load[11]) == 1) { vic = CreateVehicle( strval(load[0]), floatstr(load[12]), floatstr(load[13]), floatstr(load[14]), floatstr(load[15]), strval(load[5]), strval(load[6]), RESPAWN_OWNER ); } else { vic = CreateVehicle( strval(load[0]), floatstr(load[1]), floatstr(load[2]), floatstr(load[3]), floatstr(load[4]), strval(load[5]), strval(load[6]), RESPAWN_OWNER ); } printf("Carro Spawnado: %d", vic); CarConce[vic] = 1; TOTAL_CARROS++; VehicleInfo[vic][vModel] = strval(load[0]); VehicleInfo[vic][vX] = floatstr(load[1]); VehicleInfo[vic][vY] = floatstr(load[2]); VehicleInfo[vic][vZ] = floatstr(load[3]); VehicleInfo[vic][vA] = floatstr(load[4]); VehicleInfo[vic][vColor1] = strval(load[5]); VehicleInfo[vic][vColor2] = strval(load[6]); VehicleInfo[vic][vPaintjob] = strval(load[7]); printf("Nome: %s", load[8]); strmid(VehicleInfo[vic][vName], load[8], 0, strlen(load[8]), 128); printf("Dono: %s", load[9]); strmid(VehicleInfo[vic][vOwner], load[9], 0, strlen(load[9]), MAX_PLAYER_NAME); VehicleInfo[vic][vLock] = strval(load[10]); VehicleInfo[vic][vPark] = strval(load[11]); VehicleInfo[vic][vPX] = floatstr(load[12]); VehicleInfo[vic][vPY] = floatstr(load[13]); VehicleInfo[vic][vPZ] = floatstr(load[14]); VehicleInfo[vic][vPA] = floatstr(load[15]); if (PlayerInfo[playerid][pVIP] >= 1) { SetVehicleNumberPlate(vic, load[9]); } for(new m = 0; m < MAX_MODS; m++) { newload++; VehicleInfo[vic][vMod][m] = strval(load[newload]); } if (VehicleInfo[vic][vPaintjob] > -1) { ChangeVehiclePaintjob(vic,VehicleInfo[vic][vPaintjob]); } new keller[50]; format(keller, sizeof(keller), "Placas/%s.ini", nomeplayer); if(DOF2_FileExists(keller)) { //new Text3D:vehicle3Dtext; format(string,sizeof(string), "{00FF00}%s",DOF2_GetInt(keller,"Placa")); //vehicle3Dtext = Create3DTextLabel(string, 0xADC7E7AA, 0.0, 0.0, 0.0, 20.0, 0, 1 ); //Attach3DTextLabelToVehicle(vehicle3Dtext, vic, 0.0, 0.0, 0.0); SetVehicleNumberPlate(vic, string); SetVehicleToRespawn(vic); } MAX_VEH_SPAWNED++; break; } fclose(vehs); } return 1; } forward SavePlayerVehicle(playerid); public SavePlayerVehicle(playerid) { new string[256]; format(string, 128, VEH_SAVE_FILE, PlayerName(playerid)); if (GetOwnedVehicleID(playerid) == INVALID_VEHICLE_ID) return 1; new File:vehs = fopen(string, io_write); if (vehs) { new vic = GetOwnedVehicleID(playerid); printf("vehicle name: %s", VehicleInfo[vic][vName]); format(string, sizeof(string), "%d|%f|%f|%f|%f|%d|%d|%d|%s|%s|%d|%d|%f|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d", VehicleInfo[vic][vModel], VehicleInfo[vic][vX], VehicleInfo[vic][vY], VehicleInfo[vic][vZ], VehicleInfo[vic][vA], VehicleInfo[vic][vColor1], VehicleInfo[vic][vColor2], VehicleInfo[vic][vPaintjob], VehicleInfo[vic][vName], VehicleInfo[vic][vOwner], VehicleInfo[vic][vLock], VehicleInfo[vic][vPark], VehicleInfo[vic][vPX], VehicleInfo[vic][vPY], VehicleInfo[vic][vPZ], VehicleInfo[vic][vPA], VehicleInfo[vic][vMod][0], VehicleInfo[vic][vMod][1], VehicleInfo[vic][vMod][2], VehicleInfo[vic][vMod][3], VehicleInfo[vic][vMod][4], VehicleInfo[vic][vMod][5], VehicleInfo[vic][vMod][6], VehicleInfo[vic][vMod][7], VehicleInfo[vic][vMod][8], VehicleInfo[vic][vMod][9], VehicleInfo[vic][vMod][10], VehicleInfo[vic][vMod][11] ); fwrite(vehs, string); fclose(vehs); VehicleInfo[vic][vModel] = 0; VehicleInfo[vic][vX] = 0; VehicleInfo[vic][vY] = 0; VehicleInfo[vic][vZ] = 0; VehicleInfo[vic][vA] = 0; VehicleInfo[vic][vColor1] = -1; VehicleInfo[vic][vColor2] = -1; VehicleInfo[vic][vPaintjob] = -1; format(VehicleInfo[vic][vName], MAX_PLAYER_NAME, "[NONE]"); format(VehicleInfo[vic][vOwner], MAX_PLAYER_NAME, "[NONE]"); VehicleInfo[vic][vPark] = 0; VehicleInfo[vic][vPX] = 0; VehicleInfo[vic][vPY] = 0; VehicleInfo[vic][vPZ] = 0; VehicleInfo[vic][vPA] = 0; for(new m = 0; m < MAX_MODS; m++) VehicleInfo[vic][vMod][m] = 0; CarConce[vic] = 0; TOTAL_CARROS--; new Text3D:TextoVeiculo[MAX_VEHICLES]; Delete3DTextLabel(TextoVeiculo[vic]); DestroyVehicle(vic); } return 1; }