SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 16/03/2012, 11:23 AM   #1
Captain_Mani
Huge Clucker
 
Join Date: Sep 2011
Location: Sri Lanka
Posts: 202
Reputation: 2
Default Disable Friendly Fire for ONLY their team?

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:
Code:
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..
Captain_Mani is offline   Reply With Quote
Old 16/03/2012, 11:51 AM   #2
Captain_Mani
Huge Clucker
 
Join Date: Sep 2011
Location: Sri Lanka
Posts: 202
Reputation: 2
Default Re: Disable Friendly Fire for ONLY their team?

So No one is interested in helping me out?
Captain_Mani is offline   Reply With Quote
Old 16/03/2012, 12:56 PM   #3
Babul
High-roller
 
Babul's Avatar
 
Join Date: Sep 2009
Location: in a cement block
Posts: 1,783
Reputation: 251
Default Re: Disable Friendly Fire for ONLY their team?

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 Code:
#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 Code:
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.
__________________
FireWorks

new sscanf2 custom specifiers available for Download, read the Release Topic
Babul is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
turning on/off friendly fire [with teams] is possible? Ex[C]uTivE Help Archive 1 30/12/2010 08:51 PM
Friendly fire marinov Help Archive 11 04/12/2010 09:55 PM
[Solved] Teams friendly fire ? Faith Help Archive 1 22/04/2010 03:55 AM
Fire friendly jamesbond007 Help Archive 3 04/04/2010 03:13 PM


All times are GMT. The time now is 09:10 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.