/fare command duty broadcast
#1

I want to make a BroadCast meesage to all server that if someone get on taxi duty it will show:
Код:
BroadCast(TEAM_GROVE_COLOR, "Bus Driver %s is On Duty, fare: $%d, If you need a Bus, type /service taxi", GetPlayerNameEx(playerid), TransportValue[playerid]);
But however, it shows only the following line after /fare command.


After it says the player who did /fare "You are on duty bla bla bla" then it should show to all server the broadcast message but nothing seems.

Код:
CMD:fare(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] == 10||PlayerInfo[playerid][pLeader] == 10|| PlayerInfo[playerid][pJob] == 17 || PlayerInfo[playerid][pJob2] == 17 || PlayerInfo[playerid][pTaxiLicense] == 1)
	{
		new string[128], fare;
		if(sscanf(params, "d", fare)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /fare [price]");

		if(TransportDuty[playerid] > 0)
		{
			if(TransportDuty[playerid] == 1)
			{
				TaxiDrivers -= 1;
			}
			else if(TransportDuty[playerid] == 2)
			{
				BusDrivers -= 1;
			}
			TransportDuty[playerid] = 0;
			format(string, sizeof(string), "* You are now off duty and earned $%d.", TransportMoney[playerid]);
			SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
			GivePlayerCash(playerid, TransportMoney[playerid]);
			ConsumingMoney[playerid] = 1; TransportValue[playerid] = 0; TransportMoney[playerid] = 0;
			SetPlayerToTeamColor(playerid);
			BroadCast(TEAM_GROVE_COLOR, "Bus Driver %s is On Duty, fare: $%d, If you need a Bus, type /service taxi", GetPlayerNameEx(playerid), TransportValue[playerid]);
			return 1;
		}
		if(JobDuty[playerid] != 0) return SendClientMessageEx(playerid,COLOR_GREY,"You need to get off duty with your mechanic/lawyer job first.");
		new newcar = GetPlayerVehicleID(playerid);
		if(IsAnTaxi(newcar))
		{
			if(GetPlayerState(playerid) == 2)
			{
				if(fare < 1 || fare > 300)
				{
					SendClientMessageEx(playerid, COLOR_GREY, "   Fare price must be between $1 and $300!");
					return 1;
				}
				TaxiDrivers += 1; TransportDuty[playerid] = 1; TransportValue[playerid] = fare;
				format(string, sizeof(string), "You are now on-duty as Taxi Driver, fare: $%d.", TransportValue[playerid]);
				SendClientMessageEx(playerid, COLOR_WHITE, string);
				SetPlayerToTeamColor(playerid);
			}
			else
			{
				SendClientMessageEx(playerid, COLOR_GREY, "   You are not the driver!");
				return 1;
			}
		}
		else if(IsAnBus(newcar))
		{
			if(GetPlayerState(playerid) == 2)
			{
				if(fare < 1 || fare > 300)
				{
					SendClientMessageEx(playerid, COLOR_GREY, "   Fare price must be between $1 and $300!");
					return 1;
				}
				BusDrivers += 1; TransportDuty[playerid] = 2; TransportValue[playerid]=fare;
				format(string, sizeof(string), "You are now on-duty as Bus Driver, fare: $%d.", TransportValue[playerid]);
				SendClientMessageEx(playerid, COLOR_WHITE, string);
				SetPlayerToTeamColor(playerid);
			}
			else
			{
				SendClientMessageEx(playerid, COLOR_GREY, "   You are not the driver!");
				return 1;
			}
		}
		else if (PlayerInfo[playerid][pTaxiLicense] == 1)
		{
			if(GetPlayerState(playerid) == 2)
			{
				if(fare < 1 || fare > 300)
				{
					SendClientMessageEx(playerid, COLOR_GREY, "   Fare price must be between $1 and $300!");
					return 1;
				}
				TaxiDrivers += 1; TransportDuty[playerid] = 1; TransportValue[playerid] = fare;
				format(string, sizeof(string), "You are now on-duty as Taxi Driver, fare: $%d.", TransportValue[playerid]);
				SendClientMessageEx(playerid, COLOR_WHITE, string);
				SetPlayerToTeamColor(playerid);
			}
			else
			{
				SendClientMessageEx(playerid, COLOR_GREY, "   You are not the driver!");
				return 1;
			}
		}
		else
		{
			SendClientMessageEx(playerid, COLOR_GREY, "You're not in a taxi or a bus!");
		}
	}
	else
	{
		SendClientMessageEx(playerid,COLOR_GREY,"You're not a licensed taxi/bus driver!");
		return 1;
	}
	return 1;
}
Reply
#2

Remove this line:

pawn Код:
BroadCast(TEAM_GROVE_COLOR, "Bus Driver %s is On Duty, fare: $%d, If you need a Bus, type /service taxi", GetPlayerNameEx(playerid), TransportValue[playerid]);
And add this instead, to the same place:

pawn Код:
new drivername[MAX_PLAYER_NAME];
GetPlayerName(playerid, drivername, sizeof(drivername));
format(string, sizeof(string), "Bus driver %s is now on duty, fare: %d. If you need a Bus, type /service taxi.", drivername, fare");
SendClientMessageToAll(TEAM_GROVE_COLOR, string);
Do the same under:

pawn Код:
else if (PlayerInfo[playerid][pTaxiLicense] == 1)
underneath:

pawn Код:
SetPlayerToTeamColor(playerid);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)