Vehicles Gang
#7

Hi, in order to lock the vehicles for everyone but the members of the particular team, you should write something like the following (not compiled/tested, just a sketch):
Код:
#define TEAMS 10

new number_of_vehicles[TEAMS];
new team_vehicles[MAX_VEHICLES] = { INVALID_VEHICLE_ID, ... };

CreateTeamVehicle(team_id, modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, color1, color2) {
	if (team_id < 0 || team_id >= TEAMS) return INVALID_VEHICLE_ID;
	
	new vehicle_id = AddStaticVehicle(modelid, spawn_x, spawn_y, spawn_z, z_angle, color1, color2);
	
	team_vehicles[vehicle_id] = team_id;
	return vehicle_id;
}

GetVehicleTeam(vehicleid) {
	return team_vehicles[vehicleid];
}

public OnVehicleStreamIn(vehicleid, forplayerid) {
	SetVehicleParamsForPlayer(vehicleid, forplayerid, 0, GetPlayerTeam(forplayerid) != GetVehicleTeam(vehicleid));
}
You need to create the vehicles at OnGameModInit (or OnFilterScriptInit) with the CreateTeamVehicle function. Then, if a vehicle is streamed in for a member of the team, it will be unlocked, otherwise locked. Keep in mind that all the vehicles will still be unlocked for passengers.
Reply


Messages In This Thread
Vehicles Gang - by KamilPolska - 09.12.2018, 13:15
Re: Vehicles Gang - by KamilPolska - 09.12.2018, 20:51
Re: Vehicles Gang - by Hunud - 09.12.2018, 22:01
Re: Vehicles Gang - by Kontrol - 09.12.2018, 23:09
Re: Vehicles Gang - by Kontrol - 09.12.2018, 23:11
Re: Vehicles Gang - by KamilPolska - 09.12.2018, 23:30
Re: Vehicles Gang - by Altus - 10.12.2018, 04:33
Re: Vehicles Gang - by Calisthenics - 10.12.2018, 10:24
Re: Vehicles Gang - by Altus - 10.12.2018, 16:57
Re: Vehicles Gang - by KamilPolska - 11.12.2018, 17:47

Forum Jump:


Users browsing this thread: 3 Guest(s)