14.04.2013, 02:02
Hy everyone..I have a problem with command /v buy. From a few days ago, I want to put a dynamic system for the cars..but I don't want to use the /acreatecar command everytime, when the dealershipcars go out..i had a system, than, when you are in the dealership car, for example, in Infernus, and type the command "/v buy", you will get your car at specific coordonates [at me, at Los Santos Airport], and saves in 1.ini, if the car is first on server, 2.ini, if is second, etc.. and my first cars, is in gm, as ids 1 2 3 etc.. and the ownablecars, are putting on them.. but when i restart my server, everything goes to normal.. I tried, very much, to save the cars in one file, cars.cfg, I modified LoadCar() and OnProppUpdate(), with a little help from a fs, Dynamic Vehicle System. and I modified from my on, the command /v buy such as:
The problem is, that the cars are saved in cars.cfg, but aren't created on the server..the carsonserver variable is 444.
So, anyone, that have some ideas why, or i have mistaken in the script..if you want something tell me, and i post in small time
ThankYou:]
Код:
else if(strcmp(x_nr,"buy",true) == 0) { new coordsstring[256]; new car = 1; new model = GetVehicleModel(idcar); if(IsASalesVehicle(idcar)) { if(IsPlayerInVehicle(playerid, idcar)) { if(PlayerInfo[playerid][pLevel] < 4) { SendClientMessage(playerid, COLOR_GREY, "You need to be level 4 to buy a vehicle!"); return 1; } if(PlayerInfo[playerid][pPcarkey] == 9999 || PlayerInfo[playerid][pPcarkey2] == 9999 || PlayerInfo[playerid][pPcarkey3] == 9999) { } else return SendClientMessage(playerid, COLOR_GREY,"* You already own 3 cars!"); if(GetPlayerMoney(playerid) >= GetVehiclePrice(idcar)) { if(PlayerInfo[playerid][pCarLic] == 1) { for(new h = carsonserver; h < sizeof(CarInfo); h++) { if(CarInfo[h][cOwned] == 0) { car = h; h = 9999; } } new File: file = fopen("masini.cfg", io_read); if(PlayerInfo[playerid][pPcarkey] != 9999 && PlayerInfo[playerid][pPcarkey2] == 9999) { PlayerInfo[playerid][pPcarkey2] = car; } else if(PlayerInfo[playerid][pPcarkey] != 9999 && PlayerInfo[playerid][pPcarkey2] != 9999){ PlayerInfo[playerid][pPcarkey3] = car; } else { PlayerInfo[playerid][pPcarkey] = car; } CarInfo[car][cOwned] = 1; strmid(CarInfo[car][cOwner], sendername, 0, strlen(sendername), 999); SafeGivePlayerMoney(playerid,-GetVehiclePrice(idcar)); if(IsModelAPlane(idcar) || IsModelAHeli(idcar)) { CarInfo[car][cLocationx] = 1409.4000200; CarInfo[car][cLocationy] = -2492.5000000; CarInfo[car][cLocationz] = 180.0000000; CarInfo[car][cAngle] = 0; SendClientMessage(playerid, COLOR_YELLOW2, "Your Aircraft has been deliveried to Los Santos Airport, you can get it there!"); SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle is unlocked so you can pay someone to deliver it to your new spawn point!"); SendClientMessage(playerid, COLOR_NICERED, "REMEMBER: Leaving your car in the deliver point can get your car SOLD by an administration without refund!"); GameTextForPlayer(playerid, "~p~Congratulations~n~~w~Don't forget to pickup your car at the ~b~Las Venturas Airport!", 5000, 3); } else if(IsModelABoat(idcar)) { CarInfo[car][cLocationx] = 308.1000100; CarInfo[car][cLocationy] = -2068.5000000; CarInfo[car][cLocationz] = 0.0000000; CarInfo[car][cAngle] = 0; SendClientMessage(playerid, COLOR_YELLOW2, "Your Boat has been deliveried to Los Santos Docks, you can get it there!"); SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle is unlocked so you can pay someone to deliver it to your new spawn point!"); SendClientMessage(playerid, COLOR_NICERED, "REMEMBER: Leaving your car in the deliver point can get your car SOLD by an administration without refund!"); GameTextForPlayer(playerid, "~p~Congratulations~n~~w~Don't forget to pickup your car at the ~b~San Fierro Docks!", 5000, 3); } else { CarInfo[car][cLocationx] = 1963.6999500; CarInfo[car][cLocationy] = -2308.3000500; CarInfo[car][cLocationz] = 13.2000000; CarInfo[car][cAngle] = 0; SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle has been deliveried to Los Santos Airport, you can get it there!"); SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle is unlocked so you can pay someone to deliver it to your new spawn point!"); SendClientMessage(playerid, COLOR_NICERED, "REMEMBER: Leaving your car in the deliver point can get your car SOLD by an administration without refund!"); GameTextForPlayer(playerid, "~p~Congratulations~n~~w~Don't forget to pickup your car at the ~b~Los Santos Airport!", 5000, 3); } format(coordsstring, sizeof(coordsstring), "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", CarInfo[car][cModel] = model, CarInfo[car][cVirWorld] = 0, CarInfo[car][cPaintjob] = 999, CarInfo[car][cColorOne] = 1, CarInfo[car][cColorTwo] = 1, CarInfo[car][cComponent0] = 0, CarInfo[car][cComponent1] = 0, CarInfo[car][cComponent2] = 0, CarInfo[car][cComponent3] = 0, CarInfo[car][cComponent4] = 0, CarInfo[car][cComponent5] = 0, CarInfo[car][cComponent6] = 0, CarInfo[car][cComponent7] = 0, CarInfo[car][cComponent8] = 0, CarInfo[car][cComponent9] = 0, CarInfo[car][cComponent10] = 0, CarInfo[car][cComponent11] = 0, CarInfo[car][cComponent12] = 0, CarInfo[car][cComponent13] = 0); { file = fopen("masini.cfg", io_write); } fwrite(file, coordsstring); car++; fclose(file); DestroyVehicle(car); ownedcar[car] = CreateVehicle(CarInfo[car][cModel],CarInfo[car][cLocationx],CarInfo[car][cLocationy],CarInfo[car][cLocationz],90.0,1,1,30000); PlayerPlayMusic(playerid); SendClientMessage(playerid, COLOR_GRAD2, "Congratulations on your new purchase!"); SendClientMessage(playerid, COLOR_GRAD2, "Type /vehiclehelp to view the vehicle manual!"); gEngine[playerid] = 0; engineOn[GetPlayerVehicleID(playerid)] = false; SafeRemovePlayerFromVehicle(playerid); OnProppUpdate(); OnPlayerUpdateEx(playerid); } else { SendClientMessage(playerid, COLOR_WHITE, "* For security reasons, a Driving License is needed to buy a car!"); return 1; } } else { SendClientMessage(playerid, COLOR_GREY, " You don't have enough cash with you ! "); return 1; } } else { //do nothing } } }
So, anyone, that have some ideas why, or i have mistaken in the script..if you want something tell me, and i post in small time
ThankYou:]