03.09.2012, 19:04
Eae gente beleza? eu andei estudando um gamemodes e achei um de TDM, e vi um sistema muito legal, mais eu nгo entendi, alguйm ai poderia me explicar mais ou menos como faзo isso? (Cada vez que um player matar 1 swat/exercito ele gahar 2000 de recompensa por ser morto)
Cуdigo:
Cуdigo:
pawn Код:
new Bounty[MAX_PLAYERS];
new BountyKills[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, reason)
{
if(gTeam[killerid] != gTeam[playerid])
{
// Valid kill
new str[128];
SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
GivePlayerMoney(killerid, 1000);
if(IsPlayerJustice(playerid) && !IsPlayerJustice(killerid))
{
BountyKills[killerid]++;
if(BountyKills[killerid] > 3)
{
if(BountyKills[killerid] == 4) Bounty[killerid] = 10000;
else Bounty[killerid] += 2500;
GetName(killerid, killername);
format(str, sizeof(str), "%s (%d) now has a bounty of $%d", killername, killerid, Bounty[killerid]);
SendClientMessageToAll(COLOR_YELLOW, str);
}
}
if(Bounty[playerid] > 0)
{
GetName(playerid, playername);
GivePlayerMoney(killerid, Bounty[playerid]);
format(str, sizeof(str), "You got $%d bounty reward for killing %s (%d)", Bounty[playerid], playername, playerid);
SendClientMessage(killerid, COLOR_YELLOW, str);
}
}
}
Bounty[playerid] = 0;
BountyKills[playerid] = 0;
return 1;
}