SA-MP Forums Archive
If player shoots same team, he gets a textdraw warning (which callback do i use) - 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: If player shoots same team, he gets a textdraw warning (which callback do i use) (/showthread.php?tid=374356)



If player shoots same team, he gets a textdraw warning (which callback do i use) - Ghost100 - 02.09.2012

Hiya, so i want a textdraw to pop up if a player from team A shoots another player from team A.

Im not sure which callback i should use it for.

Any help is appreciated, thanks


Re: If player shoots same team, he gets a textdraw warning (which callback do i use) - [HK]Ryder[AN] - 02.09.2012

In the
pawn Код:
OnPlayerGiveDamage
call back check if the playerid and damageid are of same team..if they are same show textdraw or do nothing.
OR
You can use this custom callback https://sampforum.blast.hk/showthread.php?pid=937824#pid937824


Re: If player shoots same team, he gets a textdraw warning (which callback do i use) - SAMPHacker - 02.09.2012

pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
    return 1;
}
https://sampwiki.blast.hk/wiki/OnPlayerGiveDamage


Re: If player shoots same team, he gets a textdraw warning (which callback do i use) - ZoMDE_KJ - 02.09.2012

warn the guy


Re: If player shoots same team, he gets a textdraw warning (which callback do i use) - Ghost100 - 02.09.2012

Hiya, i use:

static gTeam[MAX_PLAYERS];

gTeam[playerid] = TEAM_POL;

gTeam[playerid] = TEAM_TER;


Re: If player shoots same team, he gets a textdraw warning (which callback do i use) - SAMPHacker - 02.09.2012

pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
    if(gTeam[playerid] == gTeam[damageid])
    {
        new Float:Health, Float:Armour;
        GetPlayerHealth(damagedid,Health);
        GetPlayerArmour(damagedid, Armour);
        GameTextForPlayer(playerid,"~r~Team-Kill ~w~is ~r~NOT ~w~Allowed",2000,3); // Show the player message for 2 mins.
        if(Armour > 0)
        {
            SetPlayerArmour(damagedid,Armour+amount); // Restore the lost Armour amount.
        }
        else
        {
            SetPlayerHealth(damagedid,Health+amount); // Restore the lost Health amount.
        }
    }
    return 1;
}



Re: If player shoots same team, he gets a textdraw warning (which callback do i use) - Ghost100 - 06.09.2012

thank you..much appreciated i would rep you if i could xD


Re: If player shoots same team, he gets a textdraw warning (which callback do i use) - [ABK]Antonio - 06.09.2012

SetPlayerTeam or OnPlayerTakeDamage instead of give. give = shoot skin, take = dude gets shot on his screen