OnPlayerGiveDamage Grenades problem
#1

This callback does not detect explosion damage. In order to disable OnPlayerTakeDamage i have set all players to the same team, somehow i need to add grenades into OnPlayerTakeDamage as an exception and take damage even if all the players are in the same team. I use SetPlayerTeam.
Reply
#2

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if((gTeam[issuerid] == gTeam[playerid]) && weaponid == 16 )
    {
        SetPlayerHealth(playerid, GetPlayerHealth(playerid)-amount);
    }
    return 1;
}
Reply
#3

Thing is, when 2 players are on the same team they dont recieve any damage from each others, so i dont think that callback is the way to go..

btw gTeam should compare like != and not == because i dont want teamplayers to kill eachothers
Reply
#4

No help?
Reply
#5

Bump!
Reply
#6

I'm not sure if I understand what you mean. The example posted by RoXor will not work because the damage is never registered (the player will not take damage). Why doesn't OnPlayerGiveDamage work for this?

On a side note, stop bumping your topic so much, I know your eager to get help but you're not the only one, and we don't get paid to help you. Have some patience.
Reply
#7

well it seems like OnPlayerGiveDamage doesnt register explosion damage.
Reply
#8

OnPlayerTakeDamage Does register damage even if he is in the same team, but it restores automatically i guess. If you withdraw the damaged amount manually within the script it should work. So Roxor's theory probably works, thanks. +Rep.
Reply
#9

Well, yeah, it makes sense GiveDamage doesn't register it as the game is probably more of a deal forget system. The grenade is thrown and damage is dealt, who threw it is unknown. TakeDamage should indeed work, I forgot it gets called whenever the player takes damage no matter what the cause is. However it depends how the team system works in samp, the no damage to friendlies is native so it can very well be that the damage is just never processed instead of set to old health.
Reply
#10

There was no need to set all players to the same team, this snippet will disable gun damage, but nades will still kill people.

PHP код:
public OnPlayerTakeDamage(playeridissueridFloatamountweaponid)
{
    if(
issuerid != INVALID_PLAYER_ID && GetPlayerWeapon(playerid) != 16)
    {
            return 
0;//if they take damage from another player, and it is not from a nade the update isn't synced.
    
}
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)