15.02.2014, 20:00
Is it possible to half the damage that you do on teammembers? I don't want to completely disable team damage, though, so don't say I can do that, cause I know how to
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
new Float:health;
new Float:sum = GetPlayerHealth(damagedid,health) + amount / 2;
if(pInfo[damagedid][Team] == pInfo[playerid][Team]) //Switch to your team variables
{
SetPlayerHealth(damagedid,sum); //Setting the damaged teammate's health to whatever he had plus half the damage he took
}
return 1;
}
Try adding this:
pawn Код:
|
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if (GodMode[playerid] == 1)
{
SetPlayerHealth(playerid, 0x7F800000);
}
else
{
if(issuerid != INVALID_PLAYER_ID)
{
if (gTeam[playerid] == gTeam[issuerid])
{
new Float:Health;
new Float:NewHealth = GetPlayerHealth(playerid,Health) + (0.5 * amount);
SetPlayerHealth(playerid, NewHealth);
}
}
}
return 1;
}
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if (GodMode[playerid] == 1)
{
SetPlayerHealth(playerid, 0x7F800000);
}
else
{
if(issuerid != INVALID_PLAYER_ID)
{
if (gTeam[playerid] == gTeam[issuerid])
{
new Float:Health,Float:Armour;
GetPlayerHealth(playerid,Health);
GetPlayerArmour(playerid,Armour);
if(amount < Health+Armour) //avoid double kill for playerid
{
if(Armour>0.0) {
Armour -= amount/2.0;
if(Armour < 0.0) Health += Armour;
}
else {
Health -= amount/2.0;
}
SetPlayerArmour(playerid,(Armour>0)?(Armour):(0.0));
SetPlayerHealth(playerid, Health);
}
}
}
}
return 1;
}