OnPlayerTakeDamage
#1

i need code if someone give damage to anyone it get store in new checkdamage
and when someone kill him, any player gives him damage will get money can you tell how to do that, if yes so tell me please
Reply
#2

I'm not going to write that for you but basicly you set the amount of damage you want in and add the cash to the shooter.

OnPlayerTakeDamage, for example

pawn Код:
if(issuerid != INVALID_PLAYER_ID && weaponid == 24) // Checks that the user is using a Desert Eagle and he is really logged in.
{

        Float: fHealth;
        GetPlayerArmour( playerid, fHealth ); //Checks for player health.
        SetPlayerArmour( playerid, fHealth - 55 ); //Decreases 55 health.
        GiveMoney(issuerid, +55) // Gives the shooter 55 dollar.

}
Reply
#3

no dude, thats not the right thing, that i need.
please read my post again.
ill found this in one server (91.121.6.5:8888 ) give damage to player and after that player died will the player who given damages will get 1 point..
Reply
#4

pawn Код:
//At the top of your script under your includes:
new LastDamager[MAX_PLAYERS];

public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
    if(issuerid != INVALID_PLAYER_ID) LastDamager[playerid] = issuerid;
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    //Underneath will give the damager $10,000. Change this however you like.
    if(LastDamager[playerid] != INVALID_PLAYER_ID) GivePlayerMoney(LastDamager[playerid], 10000);
    LastDamager[playerid] = INVALID_PLAYER_ID;
    return 1;
}

public OnPlayerDisconnect(playerid)
{
    for(new i = 0; i < MAX_PLAYERS; i++) //'foreach' is the better option here.
    {
        if(!IsPlayerConnected(i)) continue;
        if(LastDamager[i] == playerid) LastDamager[i] = INVALID_PLAYER_ID;
    }
    return 1;
}
Reply
#5

ty BENZOAMGE
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)