I need help with a code that sends a chat message to some people.
#1

Basically my server has automatic chat. If you kill an enemy, it sends a radio message to your team. I'm trying to also send a chat message, as if that player said it. It just look nicer and its better/efficiant for a hardcore roleplay server. This is my code.

Код:
public RadioT1EnemyDown()//T1E
{
	for(new i = 0; i <MAX_PLAYERS; i++)
	{
        if(TeamID[i] == 1)
		{
			if(Killer[i] == 0)
			{
       			PlayAudioStreamForPlayer(i, "http://k003.kiwi6.com/hotlink/5wc142yiqy/t1_tango_down.mp3");
				SetTimerEx("StopAudio", 30000, false, "i", 1);
       			//SendClientMessage(i, COLOR_TEAM_1, "")
				
				new name[MAX_PLAYER_NAME+1], string[128+MAX_PLAYER_NAME+1];
				GetPlayerName(playerid, name, sizeof(name));
				format(string, sizeof(string), "%s: {FFFFFF}Command, enemy taken down.", name);
				SendClientMessage(i, COLOR_WHITE, string);
				
				SendClientMessage(i, COLOR_TEAM_1, "Command: {FFFFFF}Rodger that, tango down.")

			}
        	if(Killer[i] == 1)
			{
        	    Killer[i] = 0;
       			PlayAudioStreamForPlayer(i, "http://k003.kiwi6.com/hotlink/40c6d0k92l/t1_tango_down_1st_person_001.mp3");
				SetTimerEx("StopAudio", 30000, false, "i", 1);
				
				new name[MAX_PLAYER_NAME+1], string[128+MAX_PLAYER_NAME+1];
				GetPlayerName(playerid, name, sizeof(name));
				format(string, sizeof(string), "%s: {FFFFFF}Command, enemy taken down.", name);
				SendClientMessage(i, COLOR_WHITE, string);

				SendClientMessage(i, COLOR_TEAM_1, "Command: {FFFFFF}Rodger that, tango down.")
			}
		}
	}
	return 1;
}


The problem is getting the killers name. Under GetPlayerName, well its a copy, so it still says playerid. The problem is that i need that value to be the killer. This is in 2 sections, because the radio heard from the killer, and from the rest of the team, is 2 seperate things.

So yeah, how can i get the killers ID in GetPlayerName, so his name shows up. It should look similar to this in the end, if Bashir was to take out an enemy.

Bashit_Muhummabar: Command, enemy taken down.
Command: Rodger that, tango down.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)