SetPlayerTeam irritating for long time !
#1

Hello,

I explain my problem,

I have 4 teams cops , terrorist ,fan etc ...
I'd like the cops can't kill each other but can kill terro and fan so I put SetPlayerTeam(playerid,1) for cops
SetPlayerTeam(playerid,2) for terrorists this working fine.
Now the fan I'd like they kill each other ! so I don't put setplayerteam but this is not working.
So I've put SetPlayerTeam(playerid,playerid). that works they can kill each other But sometimes there is friendly fire with terrorists or cops etc ... But They normally have to kill everybody even each other.
Sometimes works Sometimes it's not ...
Have I to put a timer or something ?
Thanks for helping If this problem solved It will be very fine. I try solve this for long time now.
Is SetPlyerTeam(playerid,playerid) is that for kill each other ?
I'm not sure.
Thanks!
Reply
#2

So, you want it so there's no friendly fire? You can use OnPlayerShootPlayer:
http://forum.sa-mp.com/showthread.ph...highlight=OPSP

And make it so like:
Код:
public OnPlayerShootPlayer(shooter,target,Float:damage)
{
    if(Team[target] == Team[shooter])
    {
         SetPlayerHealth(target,health);
         return 1;
    }
}
And then, find the 'IsPlayerAiming' function and make it so it checks the target's health when the player aims at him. You need to make a new float called health too.
Reply
#3

Thanks for answered I'll try it
But why I need IsPlayerAming function ?
Reply
#4

Because, when the shooter is aiming at him it prepares the script by getting his HP. Then if he actually shoots the player (OnPlayerShootPlayer) it can set their HP back.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)