Team cars problem
#1

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
Reply
#2

Show us your code
Reply
#3

Its just a team, i used this tutorial http://forum.sa-mp.com/showthread.ph...ight=undefined
And when i add more 1 car per team in OnGameModeInit all players can enter in thise cars
Ifmy OngGameModeInit is:
PHP код:
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 
All can enter in thise mavericks, but if my OnGameModeInit is:
PHP код:
Cars[GroveCars] = CreateVehicle(487,2776.1999500,1290.5000000,13.7000000,272.0000000,151,149,15); //Maverick 
Only Grove members will can enter
Reply
#4

bump,cos i really need help
Reply
#5

Thats a pretty bad tutorial (not only the team car part) and it would never work like that

From the start, we create three arrays
pawn Код:
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
;
Than two easy function to set the team of the class and the vehicle
pawn Код:
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);
}
Now we create our teams and an array for the colors
pawn Код:
enum Team { // edit to your wish
    GROVE_STREET,
    POLICE
}

new const
   gTeamColors[Team] = { // edit to your wish
        0x00820FAA, // GROVE
        0x003DF5AA // POLICE
    }
;
The publics which set the class and the color
pawn Код:
//OnPlayerRequestClass
    gTeam{playerid} = gTeamClass{classid};

//OnPlayerRequestSpawn
    SetPlayerColor(playerid, gTeamColors[gTeam{playerid}]);
And now OnGameModeInit
pawn Код:
//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
Reply
#6

But with this all players can enter in all cars and cant spawn
Reply
#7

Will someone help ?
Reply
#8

BUMP
Reply
#9

BUMPP
Reply
#10

BUMP for 99999 time :@
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)