PDA

View Full Version : Disabling some weapon damages?


arakuta
26/07/2013, 10:04 PM
Hey guys, I did a system that calculate players armour and health with OnPlayerGiveDamage, and it's working, so we are talking about skin shooting system.

But the lag shooting, it still works, for example, if I shoot someone who is not moving, the damaged player gets a double damage, because he got both of the systems, lag and skin.

I was reading some topics, and i managed to disable that lag damage with SetPlayerTeam, but now Hydra, Hunter, helicopter blades, grenades and others explosive weapons, just don't deal any damage, 'cause them don't call OnPlayerGiveDamage.

So i've discarded SetPlayerTeam.

And here's finally my question: There is any way to disable OnPlayerTakeDamage with normal weapons?

I did a array like this: (I'm calling EnableDamages at OnGameModeInit)


new bool:EnableDamage[50];

stock EnableDamages()
{
EnableDamage[51] = true; // Explosion
EnableDamage[54] = true; // Splat
EnableDamage[50] = true; // Heli blades
}


Then OnPlayerTakeDamage I did this:

public OnPlayerTakeDamage(playerid,issuerid,Float:amount, weaponid)
{
if(EnableDamage[weaponid] == false)
amount = 0;
return 1;
}

And it still dealing lag damage.

I really hope you guys can help me :)

Thanks for now.

iggy1
27/07/2013, 07:53 AM
And here's finally my question: There is any way to disable OnPlayerTakeDamage with normal weapons?


Not sure if i fully understand you, but can't you just check if the weapon is a "normal" weapon and return if so?

public OnPlayerTakeDamage(playerid,issuerid,Float:amount, weaponid)
{
if( is_normal_weapon_check( weaponid ) )
return 1;

if(EnableDamage[weaponid] == false)
amount = 0;
return 1;
}

NotIntegrated
27/07/2013, 08:17 AM
Will setting the amount to 0 work properly? As far as I know that just tells you the amount of damage a player has taken, try adding;
new Float:hp;
GetPlayerHealth(playerid, hp);
SetPlayerHealth(playerid,hp+amount);

ReVo_
27/07/2013, 10:37 AM
When you're in OnPlayerTakeDamage life packets have not yet arrived to the server.

So you can get player health and armour and restore it.


public OnPlayerTakeDamage(playerid,issuerid,Float:amount, weaponid)
{
if(EnableDamage[weaponid] == false)
{
new Float:h, Float:a;
GetPlayerHealth (playerid, h);
GetPlayerArmour (playerid, a);

SetPlayerHealth (playerid, h);
SetPlayerArmour (playerid, a);

return 1; // stop it, he dont have the hit really
}
return 1;
}

JimmyCh
27/07/2013, 10:46 AM
Not sure if this is what you're asking for, but try the following:

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
new Float:HP;
GetPlayerHealth(playerid, HP);
if(weaponid == [ID of weapon you want no damage on]) SetPlayerHealth(playerid, HP);
return 1;
}

This will do no damage with a specific weapon ID, you can add more weapon IDs with the same format.
Hope this is what you're asking for.