SA-MP Forums Archive
head shot - 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: head shot (/showthread.php?tid=599340)



head shot - GeneralAref - 24.01.2016

when my teammate shoot in my head or i shoot him we are dead and we are in 1 team and i set team.how to fix it?


Re: head shot - BiosMarcel - 24.01.2016

Dude, we are no wizards, we dont have your code so we cant fix anything


Re: head shot - FreAkeD - 24.01.2016

Under OnPlayerTakeDamage:

Код:
if(GetPlayerTeam(issuerid) != GetPlayerTeam(playerid))
{
    // If the player giving damage isn't on the players team he's giving damage to..
}
else
{
    GameTextForPlayer(issuerid, "~r~DO NOT ATTACK TEAMMATES", 3000, 3);
}



Re: head shot - Lumineux - 24.01.2016

When the damage from headshot is giving to player, you put a condition for player who shoots and the other one to not be in the same team.


Re: head shot - KillerDVX - 25.01.2016

You aren't clear enough... Do you wan't to create a Headshot system? Or, you already have one and you wan't to delete it?


Re: head shot - TwinkiDaBoss - 25.01.2016

Here you go. Team mates wont be able to headsshot eachother

PHP код:
public OnPlayerTakeDamage(playeridissueridFloat:amountweaponidbodypart)
{
    if(
issuerid != INVALID_PLAYER_ID) { //if there is a shooter, probably not needed since besides another player, no one can shoot you in the head, but just in case
        
if(GetPlayerTeam(issuerid) != GetPlayerTeam(playerid)) { //if their teams dont match aka if they are not same team
            
switch(bodypart) {
                case 
9: { //if they got shot in the head
                    
SetPlayerHealth(playerid,0);
                    
Msg(playerid,COLOR_GREEN,"You have been headshotted");
                }
            }
        }
    }
    return 
true;