SetPlayerTeam irritating for long time ! - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SetPlayerTeam irritating for long time ! (
/showthread.php?tid=221973)
SetPlayerTeam irritating for long time ! -
gereter - 06.02.2011
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!
Re: SetPlayerTeam irritating for long time ! -
Zack9764 - 06.02.2011
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.
Re: SetPlayerTeam irritating for long time ! -
gereter - 06.02.2011
Thanks for answered I'll try it
But why I need IsPlayerAming function ?
Re: SetPlayerTeam irritating for long time ! -
Zack9764 - 06.02.2011
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.