Disable Friendly Fire for ONLY their team?
#1

Okay so I am working on a script. So it is about a gang gamemode. And I have made different spawns and names for the gangs. But I want to Disable friendly fire for their own team mates, but they can shoot on other gang members.. For Example think that there are 3 gangs: Ballas, Groves, Vegaz... And I am a member of the Ballas gang, and when I shoot my Ballas members their health won't loose. But when I shoot a Groves or a Vegaz member, their health loose.. I want a script for that, please help me...

I already tried SetPlayerTeam on OnPlayerSpawn(playerid).. Here is that earlier script:
Код:
public OnPlayerSpawn(playerid)
{
      SetPlayerTeam(playerid,0);
      SetPlayerTeam(playerid,1);
      SetPlayerTeam(playerid,2);
      return 1;
}
But when I try with that script, when I shoot anyone with any of the skins, their health won't loose. I used 'AddPlayerClassEx' and put the Team number as in the SetPlayerTeam.... But please help me, I need that to Disable Fire only for their team mates..
Reply
#2

So No one is interested in helping me out?
Reply
#3

you are seting the team of the same player 3 times, to a different value. at the end each playerid will be in team 2, thats one team for all players atm.
you need some variable assigned to each player, containing the team the player belongs to.
may we see how you declare/define the teams, depending on the skin?
one easy way to set up basic teams are defines, so you can use the "written" team definition:
pawn Код:
#define TEAM_GROVE 1
#define TEAM_BALLAS 2
#define TEAM_VEGAZ 3
these defines are constant. you can check a players skin at spawn, and set the team accordingly using one of the defined values:
pawn Код:
public OnPlayerSpawn(playerid)
{
    new Skin=GetPlayerSkin(playerid);
    switch(Skin)
    {
        case 1,2,3:
        {
            SetPlayerTeam(playerid,TEAM_GROVE);
        }
        case 4,5,6:
        {
            SetPlayerTeam(playerid,TEAM_BALLAS);
        }
        case 7,8,9:
        {
            SetPlayerTeam(playerid,TEAM_VEGAZ);
        }
    }
    return 1;
}
indeed you need to know which skins belong to a team, and put them (skin ids) to the case statementsm like skin 1,2 and 3 will spawn as TEAM_GROVE member.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)