28.03.2014, 22:45
It's a bit more complicated than that Remba, I'm sorry I should have explained this you need to set all players to the same team so they can't damage each other otherwise they will be taking double damage. You will also need some variables to indicate who killed the player so that OnPlayerDeath() knows who killed the player.
Here is the basic logic structure.
Here is the basic logic structure.
pawn Код:
new KilledBy[MAX_PLAYERS];
new KillReason[MAX_PLAYERS];
public OnPlayerSpawn(playerid)
{
...
// Killed by no one (reset each spawn)
KilledBy[playerid] = INVALID_PLAYER_ID;
}
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
...
// Player was killed set their killer id
KilledBy[damagedid] = playerid;
KillReason[damagedid] = weaponid;
}
public OnPlayerDeath(playerid, killerid, reason)
{
// Player was killed by another player set the killerid
if(KilledBy[playerid] != INVALID_PLAYER_ID)
{
killerid = KilledBy[playerid];
reason = KillReason[damagedid];
}
return 1;
}