07.02.2013, 01:19
Okay Guys before I begin, this IS a Ravens edit and I'm sure this problem is been delt with before so that is why I've come here to ask you guys as a community if you've had to deal with this before! Thank you to who ever responds, Okay here we go:
Heres the Car Loading and Saving
Heres OnGameModeInit() - This is were the server spawns the cars.. which might be the problem ? idk guys
Okay, SO Can anyone help me? Anyone who answers this I seriously appreciate and will +rep. Thanks guys!
- Chris
Problem: The vehicle ownership Works when you purchase the vehicle from the dealership.
Once I restart the server via /gmx or /upload the ownerships all switch around. Check this:
This picture is When I purchased the Vehicle The Ownership is in 'Nathan Dobbs' also the vehicle ID is (3)
**SERVER RESTART**
After the server restart the ownership changed to the person who bought the last vehicle.
Each Cars Ownership changes to a different name. and the vehicle ID changes because now its (2)
The files all match up.
2 - Anthony's
3 - Nathan's
/v buy - The buy commandOnce I restart the server via /gmx or /upload the ownerships all switch around. Check this:
This picture is When I purchased the Vehicle The Ownership is in 'Nathan Dobbs' also the vehicle ID is (3)
**SERVER RESTART**
After the server restart the ownership changed to the person who bought the last vehicle.
Each Cars Ownership changes to a different name. and the vehicle ID changes because now its (2)
The files all match up.
2 - Anthony's
3 - Nathan's
Код:
else if(strcmp(x_nr,"buy",true) == 0) { new car = 1; new model = GetVehicleModel(idcar); if(IsASalesVehicle(idcar)) { if(PlayerInfo[playerid][pLevel] < 2) { SendClientMessage(playerid, COLOR_GREY, "You need to be level 2 to buy a vehicle!"); return 1; } if(PlayerInfo[playerid][pPcarkey] == 9999 || PlayerInfo[playerid][pPcarkey2] == 9999) { } else return SendClientMessage(playerid, COLOR_GREY,"* You already own Two cars!"); if(GetPlayerMoney(playerid) >= GetVehiclePrice(idcar)) { if(PlayerInfo[playerid][pCarLic] == 1) { for(new h = 1; h < sizeof(CarInfo); h++) { if(CarInfo[h][cOwned] == 0) { car = h; h = 9999; } } format(string, sizeof(string),"LARP/Vehicles/%d.ini",car) dini_Create(string); if(PlayerInfo[playerid][pPcarkey] != 9999) { PlayerInfo[playerid][pPcarkey2] = 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] = 1432.6451; CarInfo[car][cLocationy] = 1378.7216; CarInfo[car][cLocationz] = 11.5507; CarInfo[car][cAngle] = 359.2072; SendClientMessage(playerid, COLOR_YELLOW2, "Your Aircraft has been deliveried to Las Venturas 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] = -1568.9614; CarInfo[car][cLocationy] = 169.0118; CarInfo[car][cLocationz] = -0.6016; CarInfo[car][cAngle] = 208.7506; SendClientMessage(playerid, COLOR_YELLOW2, "Your Boat has been deliveried to San Fierro 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] = 2129.9709; CarInfo[car][cLocationy] = -1144.0637; CarInfo[car][cLocationz] = 24.81; CarInfo[car][cAngle] = 90.0; SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle has been deliveried to San Fierro 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); } 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; 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; SendClientMessage(playerid, COLOR_GREY, "Remember to set the new Security Code of the Car (/v setcode)!"); new pass[24]; format(pass, sizeof(pass),"%d%d%d",random(9),random(9),random(9)); CarInfo[car][cCode] = strval(pass); OnPropUpdate(4,car); 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; } } }
Код:
/////////////////////////// CAR LOADING ////////////////////////////// public LoadCar() { new file[26]; for(new idx = 1; idx < sizeof(CarInfo) ; idx++) { format(file, sizeof(file),"LARP/Vehicles/%d.ini", idx); CarInfo[idx][cModel] = dini_Int(file,"Model"); CarInfo[idx][cLocationx] = dini_Float(file,"Location_X"); CarInfo[idx][cLocationy] = dini_Float(file,"Location_Y"); CarInfo[idx][cLocationz] = dini_Float(file,"Location_Z"); CarInfo[idx][cAngle] = dini_Float(file,"Angle"); CarInfo[idx][cColorOne] = dini_Int(file,"Color_1"); CarInfo[idx][cColorTwo] = dini_Int(file,"Color_2"); strmid(CarInfo[idx][cOwner], dini_Get(file,"Owner"), 0, strlen(dini_Get(file,"Owner")), 255); CarInfo[idx][cOwned] = dini_Int(file,"Owned"); strmid(CarInfo[idx][cPlate], dini_Get(file,"Plate"), 0, strlen(dini_Get(file,"Plate")), 255); CarInfo[idx][cLock] = dini_Int(file,"Locked"); CarInfo[idx][cID] = dini_Int(file,"ID"); CarInfo[idx][cPaintjob] = dini_Int(file,"Paintjob"); CarInfo[idx][cVirWorld] = dini_Int(file,"VirtualWorld"); CarInfo[idx][cUnused] = dini_Int(file,"Unused"); CarInfo[idx][cComponent0] = dini_Int(file,"Component0"); CarInfo[idx][cComponent1] = dini_Int(file,"Component1"); CarInfo[idx][cComponent2] = dini_Int(file,"Component2"); CarInfo[idx][cComponent3] = dini_Int(file,"Component3"); CarInfo[idx][cComponent4] = dini_Int(file,"Component4"); CarInfo[idx][cComponent5] = dini_Int(file,"Component5"); CarInfo[idx][cComponent6] = dini_Int(file,"Component6"); CarInfo[idx][cComponent7] = dini_Int(file,"Component7"); CarInfo[idx][cComponent8] = dini_Int(file,"Component8"); CarInfo[idx][cComponent9] = dini_Int(file,"Component9"); CarInfo[idx][cComponent10] = dini_Int(file,"Component10"); CarInfo[idx][cComponent11] = dini_Int(file,"Component11"); CarInfo[idx][cComponent12] = dini_Int(file,"Component12"); CarInfo[idx][cComponent13] = dini_Int(file,"Component13"); CarInfo[idx][cCode] = dini_Int(file,"SecurityCode"); CarInfo[idx][cParkTicket] = dini_Int(file,"TicketPrice"); strmid(CarInfo[idx][cTicketer], dini_Get(file,"Officer"), 0, strlen(dini_Get(file,"Officer")), 255); CarInfo[idx][cTrunkGun1] = dini_Int(file,"Gun1"); CarInfo[idx][cTrunkAmmo1] = dini_Int(file,"Ammo1"); CarInfo[idx][cTrunkGun2] = dini_Int(file,"Gun2"); CarInfo[idx][cTrunkAmmo2] = dini_Int(file,"Ammo2"); CarInfo[idx][cTrunkGun3] = dini_Int(file,"Gun3"); CarInfo[idx][cTrunkAmmo3] = dini_Int(file,"Ammo3"); CarInfo[idx][cTrunkGun4] = dini_Int(file,"Gun4"); CarInfo[idx][cTrunkAmmo4] = dini_Int(file,"Ammo4"); CarInfo[idx][cTrunkGun5] = dini_Int(file,"Gun5"); CarInfo[idx][cTrunkAmmo5] = dini_Int(file,"Ammo5"); CarInfo[idx][cTrunkGun6] = dini_Int(file,"Gun6"); CarInfo[idx][cTrunkAmmo6] = dini_Int(file,"Ammo6"); CarInfo[idx][cTrunkGun7] = dini_Int(file,"Gun7"); CarInfo[idx][cTrunkAmmo7] = dini_Int(file,"Ammo7"); CarInfo[idx][cTrunkGun8] = dini_Int(file,"Gun8"); CarInfo[idx][cTrunkAmmo8] = dini_Int(file,"Ammo8"); CarInfo[idx][cTrunkGun9] = dini_Int(file,"Gun9"); CarInfo[idx][cTrunkAmmo9] = dini_Int(file,"Ammo9"); CarInfo[idx][cTrunkGun10] = dini_Int(file,"Gun10"); CarInfo[idx][cTrunkAmmo10] = dini_Int(file,"Ammo10"); CarInfo[idx][cTrunkGun11] = dini_Int(file,"Gun11"); CarInfo[idx][cTrunkAmmo11] = dini_Int(file,"Ammo11"); } return 1; }
Код:
////////////////////// CAR SAVING ////////////////// else if(update == 4) { format(file, sizeof(file),"LARP/Vehicles/%d.ini",idx); if(dini_Exists(file)) { dini_IntSet(file,"Model",CarInfo[idx][cModel]); dini_FloatSet(file,"Location_X",CarInfo[idx][cLocationx]); dini_FloatSet(file,"Location_Y",CarInfo[idx][cLocationy]); dini_FloatSet(file,"Location_Z",CarInfo[idx][cLocationz]); dini_IntSet(file,"Worth",CarInfo[idx][cWorth]); dini_FloatSet(file,"Angle",CarInfo[idx][cAngle]); dini_IntSet(file,"Color_1",CarInfo[idx][cColorOne]); dini_IntSet(file,"Color_2",CarInfo[idx][cColorTwo]); dini_Set(file,"Owner",CarInfo[idx][cOwner]); dini_IntSet(file,"Owned",CarInfo[idx][cOwned]); dini_Set(file,"Plate",CarInfo[idx][cPlate]); dini_IntSet(file,"ID",CarInfo[idx][cID]); dini_IntSet(file,"Locked",CarInfo[idx][cLock]); dini_IntSet(file,"Paintjob",CarInfo[idx][cPaintjob]); dini_IntSet(file,"VirtualWorld",CarInfo[idx][cVirWorld]); dini_IntSet(file,"Unused",CarInfo[idx][cUnused]); dini_IntSet(file,"Component0",CarInfo[idx][cComponent0]); dini_IntSet(file,"Component1",CarInfo[idx][cComponent1]); dini_IntSet(file,"Component2",CarInfo[idx][cComponent2]); dini_IntSet(file,"Component3",CarInfo[idx][cComponent3]); dini_IntSet(file,"Component4",CarInfo[idx][cComponent4]); dini_IntSet(file,"Component5",CarInfo[idx][cComponent5]); dini_IntSet(file,"Component6",CarInfo[idx][cComponent6]); dini_IntSet(file,"Component7",CarInfo[idx][cComponent7]); dini_IntSet(file,"Component8",CarInfo[idx][cComponent8]); dini_IntSet(file,"Component9",CarInfo[idx][cComponent9]); dini_IntSet(file,"Component10",CarInfo[idx][cComponent10]); dini_IntSet(file,"Component11",CarInfo[idx][cComponent11]); dini_IntSet(file,"Component12",CarInfo[idx][cComponent12]); dini_IntSet(file,"Component13",CarInfo[idx][cComponent13]); dini_IntSet(file,"SecurityCode",CarInfo[idx][cCode]); dini_IntSet(file,"TrunkCash",CarInfo[idx][cTrunkMoney]); dini_IntSet(file,"TrunkCrack",CarInfo[idx][cTrunkCrack]); dini_IntSet(file,"TrunkWeed",CarInfo[idx][cTrunkWeed]); dini_IntSet(file,"Impounded",CarInfo[idx][cImpounded]); dini_IntSet(file,"TrunkArmour",CarInfo[idx][cTrunkArmour]); dini_IntSet(file,"ImpoundPrice",CarInfo[idx][cImpoundPrice]); } }
Код:
for(new h = 1; h < sizeof(CarInfo); h++) { format(string2, sizeof(string2), "LARP/Vehicles/%d.ini",h); if(dini_Exists(string2)) { ownedcar[h] = AddStaticVehicleEx(CarInfo[h][cModel],CarInfo[h][cLocationx],CarInfo[h][cLocationy],CarInfo[h][cLocationz]+1.0,CarInfo[h][cAngle],CarInfo[h][cColorOne],CarInfo[h][cColorTwo],60000); if(CarInfo[h][cPaintjob] != 999) { ChangeVehiclePaintjob(h, CarInfo[h][cPaintjob]); } SetVehicleVirtualWorld(h, CarInfo[h][cVirWorld]); SetVehicleModifications(h); } }
- Chris