SA-MP Forums Archive
Load car tuning - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Load car tuning (/showthread.php?tid=206878)



Load car tuning - Typhome - 04.01.2011

Car have this: (Mod17=1029, Mod8=1036, etc) at tabel (after tuned) [working].. but after server restarting car isn't tuned. Why?

At LoadCar func.

Код:
		AddStaticVehicleEx(bla bla...);
		if(CarInfo[idx][cPaintjob]!=0) { ChangeVehiclePaintjob(idx,CarInfo[idx][cPaintjob]); }
		if(CarInfo[idx][cMod1]!=0) { AddVehicleComponent(idx,CarInfo[idx][cMod1]); }
		if(CarInfo[idx][cMod2]!=0) { AddVehicleComponent(idx,CarInfo[idx][cMod2]); }
		if(CarInfo[idx][cMod3]!=0) { AddVehicleComponent(idx,CarInfo[idx][cMod3]); }
		if(CarInfo[idx][cMod4]!=0) { AddVehicleComponent(idx,CarInfo[idx][cMod4]); }
		if(CarInfo[idx][cMod5]!=0) { AddVehicleComponent(idx,CarInfo[idx][cMod5]); }
		if(CarInfo[idx][cMod6]!=0) { AddVehicleComponent(idx,CarInfo[idx][cMod6]); }
		if(CarInfo[idx][cMod7]!=0) { AddVehicleComponent(idx,CarInfo[idx][cMod7]); }
		if(CarInfo[idx][cMod8]!=0) { AddVehicleComponent(idx,CarInfo[idx][cMod8]); }
		if(CarInfo[idx][cMod9]!=0) { AddVehicleComponent(idx,CarInfo[idx][cMod9]); }
		if(CarInfo[idx][cMod10]!=0) { AddVehicleComponent(idx,CarInfo[idx][cMod10]); }
		if(CarInfo[idx][cMod11]!=0) { AddVehicleComponent(idx,CarInfo[idx][cMod11]); }
		if(CarInfo[idx][cMod12]!=0) { AddVehicleComponent(idx,CarInfo[idx][cMod12]); }
		if(CarInfo[idx][cMod13]!=0) { AddVehicleComponent(idx,CarInfo[idx][cMod13]); }
		if(CarInfo[idx][cMod14]!=0) { AddVehicleComponent(idx,CarInfo[idx][cMod14]); }
		if(CarInfo[idx][cMod15]!=0) { AddVehicleComponent(idx,CarInfo[idx][cMod15]); }
		if(CarInfo[idx][cMod16]!=0) { AddVehicleComponent(idx,CarInfo[idx][cMod16]); }
		if(CarInfo[idx][cMod17]!=0) { AddVehicleComponent(idx,CarInfo[idx][cMod17]); }



Re: Load car tuning - Typhome - 04.01.2011

Topic up. (Topic was in 2 pages)


Re: Load car tuning - Jefff - 04.01.2011

U must save into file?


Re: Load car tuning - Typhome - 05.01.2011

No. Im using mySQL.

Theres tabel was Mod17=1082, etc... I restarting server and still car isn't tuned. Why?


Re: Load car tuning - veyron - 05.01.2011

I cant understand isnt it woking at all? Or just tuning is gone after server restart?
Try to use printf() to find out if all variables are correct.
Like:
pawn Код:
printf("Vehicle id: %d and VehicleComponent: %d",idx,CarInfo[idx][cMod1]);
Most likely your componentIDs are not loaded properly, and they are 0.


Re: Load car tuning - Typhome - 05.01.2011

0 = Not tuned

thats why:
if(CarInfo[idx][cMod1]!=0) {

Car isnt still tuned after server restart...

But.. car had this..




Re: Load car tuning - Hiitch - 05.01.2011

If you are using mysql, are you reading the information from the database at all in the script? If not, I think that might be why it's not changing anything. Look over it and see if you can figure out how to read info from the DB, if that is the problem.


Re: Load car tuning - Typhome - 05.01.2011

Quote:
Originally Posted by Hiitch
Посмотреть сообщение
If you are using mysql, are you reading the information from the database at all in the script? If not, I think that might be why it's not changing anything. Look over it and see if you can figure out how to read info from the DB, if that is the problem.
Sorry, im not begginer scripter.

Added picture..


Re: Load car tuning - Hiitch - 05.01.2011

Quote:
Originally Posted by Typhome
Посмотреть сообщение
Sorry, im not begginer scripter.

Added picture..
-Are you saying you are a beginner scripter, or you aren't?

Anyways, let me try to break it down for you.

If you store any information to mysql for whatever reason, at a time you might want the gamemode to read the information from the mysql, in this case it is the vehicle mods.

You need to create something so when the gamemode is started, it gets (loads) the information from the mysql, and gives the vehicle its mods. I am not 100% sure how you do this, as I haven't done anything in mysql for a while. Do you understand it now?


Re: Load car tuning - veyron - 05.01.2011

Quote:
Originally Posted by Typhome
Посмотреть сообщение
0 = Not tuned

thats why:
if(CarInfo[idx][cMod1]!=0) {
yes, i understand.
Same question in different way: Are you sure you are loading every variable correctly and to correct car id in an array?
What i mean is that your component id may be in wrong place or not loaded at all.
Code you posted doesnt really tell anything about the reason.