21.08.2013, 10:26
pawn Код:
new CounterMortes[MAX_PLAYERS]; // Variбvel global
public OnPlayerDeath(playerid, killerid, reason)
{
new namekillerid[32]; // variбvel para armazenar o nome do assasнno
new nameplayerid[32]; // variбvel para armazenar o nome do morto
new string[128]; // variбvel para armazenar a frase
GetPlayerName(playerid, nameplayerid, sizeof(nameplayerid));
GetPlayerName(playerid, namekillerid, sizeof(namekillerid));
CounterMortes[killerid]++; // Se o jogador matar, aumenta 1 no contador
CounterMortes[playerid]--; // Se morrer, perde 1
if(CounterMortes[killerid] == 5) // Quando o contador for 5
{
SetPlayerScore(playerid, GetPlayerScore(playerid) +1); // Aumenta 1 no score
}
format(string, sizeof(string), "O jogador %s matou %s.", namekillerid, nameplayerid); // Frase
SendClientMessageToAll(-1, string); // Envia a mensagem para todos
return 1;
}