Vehicle Spawn using Dini.
#1

I've made a system that when you purchase a vehicle, you will be created a new dini file where the information is about your vehicle listed below:
Код:
VehicleID=363
VehicleOwner=Berky_Brada
VehX=1895.7
VehY=-1746.5
VehZ=13.2
VehicleAngle=89.8
LicensePlate=4456
VehColorOne=0
VehColorTwo=0
VehLocked=0
OnPlayerLogin I've used the next line to make your vehicle spawn:
Код:
		if(PlayerInfo[playerid][pStaticVehicle] == 1)
		{
		    new berkycardealership[164];
		    OnPlayerVehicleLoad(playerid);
		    HouseVehicleIDTemp[playerid] = CreateVehicle(CarInfo[playerid][vID],CarInfo[playerid][vVehX],CarInfo[playerid][vVehY],CarInfo[playerid][vVehZ],CarInfo[playerid][vAngle],CarInfo[playerid][vColorOne],CarInfo[playerid][vColorTwo], 900);
//		    CarInfo[playerid][VehicleSpawn] = CreateVehicle(CarInfo[playerid][vID], CarInfo[playerid][vVehX], CarInfo[playerid][vVehY], CarInfo[playerid][vVehZ], CarInfo[playerid][vAngle], CarInfo[playerid][vColorOne], CarInfo[playerid][vColorTwo], 900);
			vehicle3Dtextdynamic[MAX_VEHICLES] = Create3DTextLabel(berkycardealership,COLOR_BIZ, CarInfo[playerid][vVehX],CarInfo[playerid][vVehY],CarInfo[playerid][vVehZ],20.0,0,1);
 	    	Attach3DTextLabelToVehicle(vehicle3Dtextdynamic[MAX_VEHICLES], CarInfo[playerid][VehicleSpawn], 0.0, 0.0, -0.0);
 	    	printf("LOGIN SPAWN, Info: ID: %d, X: %f, Y: %f, Z: %f, A: %f, ColorOne: %d, ColorTwo: %d.",CarInfo[playerid][vID], CarInfo[playerid][vVehX], CarInfo[playerid][vVehY], CarInfo[playerid][vVehZ], CarInfo[playerid][vAngle], CarInfo[playerid][vColorOne], CarInfo[playerid][vColorTwo]);
		}
PlayerInfo[playerid][pStaticVehicle] is if you have a vehicle = 1 else 0.

Everything is perfect according to the printf messages I get in the command prompt, but the vehicle won't be created Ingame, I have no clue why not. Can somebody help me with this?
Reply
#2

Did you put it under OnPlayerSpawn?
Reply
#3

It's because you're trying to create a vehicle with an invalid model id. Vehicle models are numbered 400 to 611.
It looks like you're saving the vehicle id to the file instead of the model id.
Reply
#4

OMFG, thank you man, I was using no brains at making that part -.-
Reply
#5

I have a similar script that works, but the Z angle is saved but not readed and setted
Reply
#6

I also want to make this system available for static, how can I load this system using OnGameModeInit? This system using format [CAR]PLAYERNAME.ini.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)