SA-MP Forums Archive
Teammate getting back his HP - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Teammate getting back his HP (/showthread.php?tid=381502)



Teammate getting back his HP - SKAzini - 29.09.2012

Basically I check if a team A is shooting team A, if is, give back HP to victim player. However, if team B shoot team A victim and he loose lets say 60 hp, having 40 hp left, if a team A member shoots the other team A member now, he gets back his HP.. How do I solve this?

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(gTeam[issuerid] == TEAM_COP && gTeam[playerid] == TEAM_COP && weaponid >= 0 && weaponid <= 42)
    {
        new Float:hp;
        GetPlayerHealth(playerid, hp);
        SetPlayerHealth(playerid, hp + amount);
        GameTextForPlayer(issuerid, "~r~Dont attack teammates", 5000, 1);
    }
    else
    {
        format(pHitDamage, sizeof(pHitDamage), "-%.0f HP", amount);
        SetPlayerChatBubble(playerid, pHitDamage, 0x09D33FAA, 150.0,2500);
    }
    return 1;
}



Re: Teammate getting back his HP - EV007 - 29.09.2012

Why not just setting teams ?


Re: Teammate getting back his HP - SKAzini - 29.09.2012

SetPlayerTeam?


Re: Teammate getting back his HP - SKAzini - 09.10.2012

Now im stuck with this:
Criminal - Team 1
Cop - Team 2
Agent - Team 3
Army - Team 4

Cop cannot attack cop, but cop can attack agent and army.. agent can attack cop and so on going..
How to solve this?


Re: Teammate getting back his HP - TheDeadlyDutchi - 09.10.2012

You should script the factions, and keep the teams.

as in, team 1 being 'good' and team 2 being 'bad'