14.09.2013, 10:46
Hello, i made teams (TDM) and team cars.When i add one team car in OnGameModeInit only players in the team can drive the car, but when i add more team cars everybody can drive the cars
Cars[GroveCars] = CreateVehicle(487,2776.1999500,1290.5000000,13.7000000,272.0000000,151,149,15); //Maverick
Cars[GroveCars] = CreateVehicle(487,2776.8000500,1274.1999500,13.7000000,272.0000000,151,149,15); //Maverick
Cars[GroveCars] = CreateVehicle(487,2776.1999500,1290.5000000,13.7000000,272.0000000,151,149,15); //Maverick
new
Team: gTeam[MAX_PLAYERS char], // stores the team of the player
Team: gTeamClass[300 char] = {Team: -1, ...}, // stores the team of the class
Team: gTeamVehicle[MAX_VEHICLES + 1 char] = {Team: -1, ...} // stores the team of the vehicle
;
SetClassToTeam(Team: teamid, classid) {
if((0 <= classid < (sizeof gTeamClass * 4)) && (0 <= _: teamid <= 255)) {
gTeamClass{classid} = teamid;
return classid;
}
return printf("* SetClassToTeam(%d, %d) failed", _: teamid, classid);
}
SetVehicleToTeam(Team: teamid, vehicleid) {
if((1 <= vehicleid < (sizeof gTeamVehicle * 4)) && (0 <= _: teamid <= 255)) {
gTeamVehicle{vehicleid} = teamid;
return vehicleid;
}
return printf("* SetVehicleToTeam(%d, %d) failed", _: teamid, vehicleid);
}
enum Team { // edit to your wish
GROVE_STREET,
POLICE
}
new const
gTeamColors[Team] = { // edit to your wish
0x00820FAA, // GROVE
0x003DF5AA // POLICE
}
;
//OnPlayerRequestClass
gTeam{playerid} = gTeamClass{classid};
//OnPlayerRequestSpawn
SetPlayerColor(playerid, gTeamColors[gTeam{playerid}]);
//OnGameModeInit - edit to your wish
SetClassToTeam(GROVE_STREET, AddPlayerClass(105,2497.2693,-1676.9578,13.3398,23.6501,0,0,0,0,0,0));
SetClassToTeam(GROVE_STREET, AddPlayerClass(105,2497.2693,-1676.9578,13.3398,23.6501,0,0,0,0,0,0));
SetVehicleToTeam(GROVE_STREET, CreateVehicle(492,2484.3054,-1655.0886,13.1036,90.8565,44,16,900)); //Greenwood
SetClassToTeam(POLICE, AddPlayerClass(280,1544.0514,-1675.7766,13.5577,98.0974,0,0,0,0,0,0));
SetClassToTeam(POLICE, AddPlayerClass(280,1544.0514,-1675.7766,13.5577,98.0974,0,0,0,0,0,0));
SetVehicleToTeam(POLICE, CreateVehicle(596,1536.0603,-1676.5302,13.1054,0.6847,-1,-1,900)); //LSPD Cruiser