Urgent help please REP to woever solve this!
#1

Ok so I have a car system that Only loads ini files when the car owner join the server,

so its onplayerconnect

Код:
public OnPlayerConnect(playerid)
{
    new filecar[256], namecar[MAX_PLAYER_NAME];
    GetPlayerName(playerid, namecar, sizeof(namecar));
	format(filecar,sizeof(filecar),"Cars/%s.ini",namecar);
	if(dini_Exists(filecar))
	{
	    VehicleInfo[playerid][Model] = dini_Int(filecar, "Model");
	    VehicleInfo[playerid][Price] = dini_Int(filecar, "Price");
	    VehicleInfo[playerid][CarX] = dini_Float(filecar, "X");
	    VehicleInfo[playerid][CarY] = dini_Float(filecar, "Y");
	    VehicleInfo[playerid][CarZ] = dini_Float(filecar, "Z");
	    VehicleInfo[playerid][CarRot] = dini_Float(filecar, "Rot");
	    VehicleInfo[playerid][Locked] = dini_Int(filecar, "Locked");
		VehicleInfo[playerid][mod1] = dini_Int(filecar, "mod1");
		VehicleInfo[playerid][mod2] = dini_Int(filecar, "mod2");
		VehicleInfo[playerid][mod3] = dini_Int(filecar, "mod3");
		VehicleInfo[playerid][mod4] = dini_Int(filecar, "mod4");
		VehicleInfo[playerid][mod5] = dini_Int(filecar, "mod5");
		VehicleInfo[playerid][mod6] = dini_Int(filecar, "mod6");
		VehicleInfo[playerid][mod7] = dini_Int(filecar, "mod7");
		VehicleInfo[playerid][mod8] = dini_Int(filecar, "mod8");
		VehicleInfo[playerid][mod9] = dini_Int(filecar, "mod9");
		VehicleInfo[playerid][mod10] = dini_Int(filecar, "mod10");
		VehicleInfo[playerid][mod11] = dini_Int(filecar, "mod11");
		VehicleInfo[playerid][mod12] = dini_Int(filecar, "mod12");
		VehicleInfo[playerid][mod13] = dini_Int(filecar, "mod13");
		VehicleInfo[playerid][mod14] = dini_Int(filecar, "mod14");
		VehicleInfo[playerid][mod15] = dini_Int(filecar, "mod15");
		VehicleInfo[playerid][mod16] = dini_Int(filecar, "mod16");
		VehicleInfo[playerid][mod17] = dini_Int(filecar, "mod17");
		VehicleInfo[playerid][paintjob] = dini_Int(filecar, "paintjob");
		VehicleInfo[playerid][colora] = dini_Int(filecar, "color1");
		VehicleInfo[playerid][colorb] = dini_Int(filecar, "color2");
		Vehicle[playerid] = CreateVehicle(VehicleInfo[playerid][Model], VehicleInfo[playerid][CarX], VehicleInfo[playerid][CarY], VehicleInfo[playerid][CarZ], VehicleInfo[playerid][CarRot], -1, -1, 3600000);
    	if(VehicleInfo[playerid][mod1]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod1]); }
		if(VehicleInfo[playerid][mod2]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod2]); }
		if(VehicleInfo[playerid][mod3]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod3]); }
		if(VehicleInfo[playerid][mod4]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod4]); }
		if(VehicleInfo[playerid][mod5]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod5]); }
		if(VehicleInfo[playerid][mod6]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod6]); }
		if(VehicleInfo[playerid][mod7]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod7]); }
		if(VehicleInfo[playerid][mod8]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod8]); }
		if(VehicleInfo[playerid][mod9]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod9]); }
		if(VehicleInfo[playerid][mod10]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod10]); }
		if(VehicleInfo[playerid][mod11]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod11]); }
		if(VehicleInfo[playerid][mod12]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod12]); }
		if(VehicleInfo[playerid][mod13]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod13]); }
		if(VehicleInfo[playerid][mod14]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod14]); }
		if(VehicleInfo[playerid][mod15]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod15]); }
		if(VehicleInfo[playerid][mod16]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod16]); }
		if(VehicleInfo[playerid][mod17]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod17]); }
		if(VehicleInfo[playerid][colora]!=0 || VehicleInfo[playerid][colorb]!=0)
		{
			ChangeVehicleColor(Vehicle[playerid],VehicleInfo[playerid][colora],VehicleInfo[playerid][colorb]);
		}
		if(VehicleInfo[playerid][paintjob]!=0)
		{
		    ChangeVehiclePaintjob(Vehicle[playerid],VehicleInfo[playerid][paintjob]);
  		}
		new tmpcar[256]; tmpcar = dini_Get(filecar, "Plate");
		gPlayerHasCar[playerid] = 1;
		VehOwned[Vehicle[playerid]] = 1;
		OwnerID[Vehicle[playerid]] = playerid;
		SetVehicleParamsForPlayer(Vehicle[playerid], playerid, 0, VehicleInfo[playerid][Locked]);
		gVehLocked[Vehicle[playerid]] = VehicleInfo[playerid][Locked];
		SetVehicleNumberPlate(Vehicle[playerid], tmpcar);
		VehPlate[Vehicle[playerid]] = tmpcar;
		LoadTrunk(playerid);
	}
	return 1;
}
ok so I want all the cars to be created when i open the server can anyone help me with this?
Reply


Messages In This Thread
Urgent help please REP to woever solve this! - by cacauagiar - 14.10.2011, 03:15
Re: Urgent help please REP to woever solve this! - by ma7rix - 14.10.2011, 03:36
Re: Urgent help please REP to woever solve this! - by DaRkAnGeL[NBK] - 14.10.2011, 03:38
Re: Urgent help please REP to woever solve this! - by cacauagiar - 14.10.2011, 03:41

Forum Jump:


Users browsing this thread: 1 Guest(s)