Você está fazendo uma gambiarra sem lógica, por que não simplesmente atribuir o ID da organização ao veículo e ao jogador e verificar se ambos são iguais? O mesmo vale para veículos próprios, basta atribuir o ID/Nome do jogador ao veículo e verificar se ambos são iguais.
Carregue primeiro os dados de veículos de organização e depois os de veículos próprios.
Código:
VehicleOrgID[ORG_VEHICLE[f][c]] = f;
Código:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) {
if (!ispassenger) {
new orgid = VehicleOrgID[vehicleid];
if (orgid != INVALID_ORG_ID) {
if (PlayerOrgID[playerid] != orgid) {
ClearAnimations(playerid);
}
} else {
static vehicleOwnerName[MAX_PLAYER_NAME];
format(vehicleOwnerName, MAX_PLAYER_NAME, VehicleOwnerName[vehicleid]);
if (!IsNull(vehicleOwnerName)) {
static name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
if (strcmp(vehicleOwnerName, name)) {
ClearAnimations(playerid);
}
}
}
}
}
public OnPlayerStateChange(playerid, newstate, oldstate) {
new vehicleid = GetPlayerVehicleID(playerid);
if (newstate == PLAYER_STATE_DRIVER) {
new orgid = VehicleOrgID[vehicleid];
if (orgid != INVALID_ORG_ID) {
if (PlayerOrgID[playerid] != orgid) {
RemovePlayerFromVehicle(playerid);
}
} else {
static vehicleOwnerName[MAX_PLAYER_NAME];
format(vehicleOwnerName, MAX_PLAYER_NAME, VehicleOwnerName[vehicleid]);
if (!IsNull(vehicleOwnerName)) {
static name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
if (strcmp(vehicleOwnerName, name)) {
RemovePlayerFromVehicle(playerid);
}
}
}
}
}
Carregue primeiro os dados de veículos de organização e depois os de veículos próprios.