Guys, I have this located at OnPlayerEnterVehicle, which works fine but the problem is with this applied, even with a driver, passengers of the same team are unable to enter as passenger. The team jack is only to work as anti team jacking the driver, but it does not allow for the use of Passengers also (G).
Another thing, because while I'm at it, how do I add an anti G abuse, where there is no driver, the player can't enter as passenger?
Here is the stock details:
+REP to those who help me in this endeavour. Thank you.
Code:
new id = GetDriverID(vehicleid); //Anti Team-Jack
if(IsPlayerInAnyVehicle(id) && !ispassenger && GetPlayerTeam(playerid) == GetPlayerTeam(id))
{
GameTextForPlayer(playerid, "~r~Team Jack is not allowed!", 2100, 3);
SetVehicleParamsForPlayer(vehicleid, playerid, false, true);
}
Here is the stock details:
Code:
stock GetDriverID(vehicleid)
{
for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
{
if(GetPlayerVehicleID(i) == vehicleid && GetPlayerState(i) == PLAYER_STATE_DRIVER) return i;
}
return 1;
}