Death Evaders
#3

Quote:
Originally Posted by HellSphinX
Посмотреть сообщение
Hmm you can use OnPlayerTakeDamage to get around this, code:

pawn Код:
new LastAttacker[MAX_PLAYERS]; // a variable to store the last player who gives damage
new LastAttackerWeapon[MAX_PLAYERS]; // a variable to store the weapon of the last player who gives damage

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(IsPlayerConnected(issuerid)) // if the issuer connected
    {
        LastAttacker[playerid] = issuerid; // now the last one who attacked our victim is issuerid
        LastAttackerWeapon[playerid] = weaponid; // the weapon of the issuerid which was used to damage the victim
    }
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    if(reason == 54) // Splat. You can change that if you want
    {
        if(IsPlayerConnected(LastAttacker[playerid])) // if the last player who gave damage is connected
        {
            SendDeathMessage(LastAttacker[playerid], playerid, LastAttackerWeapon[playerid]);
            // Other stuff
        }
        else // not connected
        {
            SendDeathMessage(INVALID_PLAYER_ID, playerid, reason);
            // Other stuff
        }
    }
    return 1;
}
Edit:

Or (for the OnPlayerDeath part)

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(killerid == INVALID_PLAYER_ID)
    {
        if(IsPlayerConnected(LastAttacker[playerid])) // if the last player who gave damage is connected
        {
            SendDeathMessage(LastAttacker[playerid], playerid, LastAttackerWeapon[playerid]);
            // Other stuff
        }
        else // not connected
        {
            SendDeathMessage(INVALID_PLAYER_ID, playerid, reason);
            // Other stuff
        }
    }
    return 1;
}
Excuse me , but wouldn't OnPlayerTakeDamage remove lag shooting from the server?
Reply


Messages In This Thread
Death Evaders - by CoDeZ - 21.07.2012, 16:20
Re: Death Evaders - by [KHK]Khalid - 21.07.2012, 16:47
Re: Death Evaders - by CoDeZ - 21.07.2012, 18:01
Re: Death Evaders - by [KHK]Khalid - 21.07.2012, 18:11
Re: Death Evaders - by CoDeZ - 21.07.2012, 18:38

Forum Jump:


Users browsing this thread: 1 Guest(s)