public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
printf("OnPlayerEnterVehicle(%d, %d, %d)", playerid, vehicleid, ispassenger);
if (vehicleid == 0 || vehicleid == 1 || vehicleid == 2 || vehicleid == 3 || vehicleid == 4){
if (gTeam[playerid] == TEAM_TAXI){
SendClientMessage(playerid, COLOR_YELLOW, ">> You have entered a taxi as the taxi driver.");
if (gTaxiFee[playerid] == 0){
SendClientMessage(playerid, COLOR_YELLOW, ">> Please set a taxi fee by typing /setfee <amount>");
}
else {
new str[STR_LEN] = "";
format(str, STR_LEN, ">> Your fee is currently %d", gTaxiFee[playerid]);
SendClientMessage(playerid, COLOR_YELLOW, str);
}
SendClientMessage(playerid, COLOR_YELLOW, ">> Go make some money!");
gIsInTaxi[playerid] == 1;
}
else {
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER){
new DriverID;
DriverID = GetVehicleDriverID(vehicleid, playerid)
//DriverID now holds the ID of the driver of the vehicle.
if(!DriverID == -1)
{
//There is a driver in this taxi
//
//Do funky code
//
}else{
//There is no driver in this taxi
}
//gPayFee[playerid] = gTaxiFee[];
}
else {
SendClientMessage(playerid, COLOR_YELLOW, ">> You are not a taxi driver. No profit will be made.");
}
}
}
return 1;
}
public GetVehicleDriverID(vehicleid, passengerplayerid)
{
new Result = -1;
for(new i=0; i<MAX_PLAYERS;i++)
{
//We dont want to scan the passenger player ID..
if(!i == passengerplayerid)
{
//Check if this player is inside the vehicle ID Supplied
if(IsPlayerInVehicle(i,vehicleid)) {
Result = i;
}
}
}
return Result;
}