29.10.2010, 11:23
Hello all.. Im have a biig problem with car system.. When i buy car, then tune it, and quit the game. - Saves perfectly. But, when i log on, take that saved car, and drive it somewhere, than relog - Car poz set's to first saved poz..
than, when player exit car:
Quote:
stock SaugojamMasina(playerid) { new failas[43],ZaidejoVardas[MAX_PLAYER_NAME],Float:mPozicija[3]; new vehicleid = playerDB[playerid][pcar]; GetPlayerName(playerid,ZaidejoVardas,MAX_PLAYER_NA ME); format(failas,43,"\\saves\\cars\\%s.ini",ZaidejoVa rdas); if(!dini_Exists(failas)) dini_Create(failas); dini_IntSet(failas,"Modelis",GetVehicleModel(vehic leid)); GetVehiclePos(vehicleid,mPozicija[0],mPozicija[1],mPozicija[2]); dini_FloatSet(failas,"X",mPozicija[0]); dini_FloatSet(failas,"Y",mPozicija[1]); dini_FloatSet(failas,"Z",mPozicija[2]); GetVehicleZAngle(vehicleid,mPozicija[0]); dini_FloatSet(failas,"F",mPozicija[0]); dini_IntSet(failas,"Degalai",vehicleDB[vehicleid][gas]); dini_IntSet(failas,"Spalva1",vehicleDB[vehicleid][spalvos][0]); dini_IntSet(failas,"Spalva2",vehicleDB[vehicleid][spalvos][1]); dini_IntSet(failas,"Paintjob",vehicleDB[vehicleid][spalvos][2]); dini_IntSet(failas,"Tune0",GetVehicleComponentInSl ot(vehicleid,0)); dini_IntSet(failas,"Tune1",GetVehicleComponentInSl ot(vehicleid,1)); dini_IntSet(failas,"Tune2",GetVehicleComponentInSl ot(vehicleid,2)); dini_IntSet(failas,"Tune3",GetVehicleComponentInSl ot(vehicleid,3)); dini_IntSet(failas,"Tune4",GetVehicleComponentInSl ot(vehicleid,4)); dini_IntSet(failas,"Tune5",GetVehicleComponentInSl ot(vehicleid,5)); dini_IntSet(failas,"Tune6",GetVehicleComponentInSl ot(vehicleid,6)); dini_IntSet(failas,"Tune7",GetVehicleComponentInSl ot(vehicleid,7)); dini_IntSet(failas,"Tune8",GetVehicleComponentInSl ot(vehicleid,8)); dini_IntSet(failas,"Tune9",GetVehicleComponentInSl ot(vehicleid,9)); dini_IntSet(failas,"Tune10",GetVehicleComponentInS lot(vehicleid,10)); dini_IntSet(failas,"Tune11",GetVehicleComponentInS lot(vehicleid,11)); dini_IntSet(failas,"Tune12",GetVehicleComponentInS lot(vehicleid,12)); dini_IntSet(failas,"Tune13",GetVehicleComponentInS lot(vehicleid,13)); } stock UzkraunamUzrakintaMasina(playerid) { new failas[43],ZaidejoVardas[MAX_PLAYER_NAME]; GetPlayerName(playerid,ZaidejoVardas,MAX_PLAYER_NA ME); format(failas,43,"\\saves\\cars\\%s.ini",ZaidejoVa rdas); if(dini_Exists(failas)) { new Transportas = CreateVehicle(dini_Int(failas,"Modelis"),dini_Floa t(failas,"X"),dini_Float(failas,"Y"),dini_Float(fa ilas,"Z"),dini_Float(failas,"F"),dini_Int(failas," Spalva1"),dini_Int(failas,"Spalva2"),-1); if(dini_Int(failas,"Paintjob") != 0) ChangeVehiclePaintjob(Transportas,dini_Int(failas, "Paintjob")); vehicleDB[Transportas][locked] = true; new i; for(i=0;i<MAX_PLAYERS;i++) { if(i != playerid) { SetVehicleParamsForPlayer(Transportas,i,0,1); // uzrakinimas } } format(vehicleDB[Transportas][owner_name],MAX_PLAYER_NAME,"%s",ZaidejoVardas); vehicleDB[Transportas][gas] = dini_Int(failas,"Degalai"); if(dini_Int(failas,"Tune0") != 0) AddVehicleComponent(Transportas,dini_Int(failas,"T une0")); if(dini_Int(failas,"Tune1") != 0) AddVehicleComponent(Transportas,dini_Int(failas,"T une1")); if(dini_Int(failas,"Tune2") != 0) AddVehicleComponent(Transportas,dini_Int(failas,"T une2")); if(dini_Int(failas,"Tune3") != 0) AddVehicleComponent(Transportas,dini_Int(failas,"T une3")); if(dini_Int(failas,"Tune4") != 0) AddVehicleComponent(Transportas,dini_Int(failas,"T une4")); if(dini_Int(failas,"Tune5") != 0) AddVehicleComponent(Transportas,dini_Int(failas,"T une5")); if(dini_Int(failas,"Tune6") != 0) AddVehicleComponent(Transportas,dini_Int(failas,"T une6")); if(dini_Int(failas,"Tune7") != 0) AddVehicleComponent(Transportas,dini_Int(failas,"T une7")); if(dini_Int(failas,"Tune8") != 0) AddVehicleComponent(Transportas,dini_Int(failas,"T une8")); if(dini_Int(failas,"Tune9") != 0) AddVehicleComponent(Transportas,dini_Int(failas,"T une9")); if(dini_Int(failas,"Tune10") != 0) AddVehicleComponent(Transportas,dini_Int(failas,"T une10")); if(dini_Int(failas,"Tune11") != 0) AddVehicleComponent(Transportas,dini_Int(failas,"T une11")); if(dini_Int(failas,"Tune12") != 0) AddVehicleComponent(Transportas,dini_Int(failas,"T une12")); if(dini_Int(failas,"Tune13") != 0) AddVehicleComponent(Transportas,dini_Int(failas,"T une13")); } } |
Quote:
if(vehicleDB[vehicleid][locked]) { SendClientMessage(playerid, MELYNA2,"Maрinos pozicija buvo iрsaugota."); if(vehicleid == playerDB[playerid][pcar]) SaugojamMasina(playerid); } |