/carwhisper bug - sends a message to every vehicle
#1

i got most of it working except it sends the message to everybody who is in a vehicle instead of just theirs
i just dont know how to get it to grab the vehicles ID and limit the messages to that vehicle only

Код:
forward SendCarMessage(color, string[]);

public SendCarMessage(color, string[])
{
	for(new i = 0; i < MAX_PLAYERS; i ++)
	{
  	if(IsPlayerConnected(i))
	  {
	    if(IsPlayerInVehicle(i, GetPlayerVehicleID(i)))
			{
		  	SendClientMessage(i, color, string);
			}
	  }
	}
}
Код:
CMD:carwhisper(playerid, params[] )
{
	new string[128];

	if(isnull(params)) return SendClientMessage(playerid,-1,"USAGE: /cw [message]");
	if(IsPlayerInAnyVehicle(playerid) == 0) return SendClientMessage(playerid, -1, "You are not in any vehicle.");
	{
	    if(IsPlayerInAnyVehicle(playerid) == 1) GetPlayerVehicleID(playerid);
		format(string, sizeof(string), "%s whispers: %s", GetName(playerid), params);
		SendCarMessage(COLOR_YELLOW, string);
		format(string, sizeof(string), "%s mutters something.", GetName(playerid));
		SetPlayerChatBubble(playerid, string, COLOR_PURPLE, 5.0, 4000);
	}
	return 1;
}
help is appreciated my mens
Reply


Messages In This Thread
/carwhisper bug - sends a message to every vehicle - by sampEv0 - 29.03.2017, 19:25
Re: /carwhisper bug - sends a message to every vehicle - by Toroi - 29.03.2017, 19:29
Re: /carwhisper bug - sends a message to every vehicle - by sampEv0 - 29.03.2017, 19:37

Forum Jump:


Users browsing this thread: 1 Guest(s)