SA-MP Forums Archive
team attack help - 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: team attack help (/showthread.php?tid=501888)



team attack help - iThePunisher - 20.03.2014

i have this code about anti team attack but isn't working...
does anyone know how to fix this?
i want to do it when a player attacks hes team he will be like in god mode and dont get damage...


and about the setplayerwantedlevel is working but when a cop attacks a cop he gets wanted .. how do i make it to not get wanted when cop attacks a cop
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(GetPlayerTeam(playerid) == Team_Cop)
    {
        GameTextForPlayer(issuerid,"~r~Don't attack your team mates!", 3000, 3);
    }
    if(GetPlayerTeam(playerid) == Team_grove)
    {
        GameTextForPlayer(issuerid,"~r~Don't attack your Grove Street Family !", 3000, 3);
    }
    if(GetPlayerTeam(playerid) == Team_ballas)
    {
        GameTextForPlayer(issuerid,"~r~Don't attack Ballas OG's they are your team mates !", 3000, 3);
    }
    if (GetPlayerWantedLevel(issuerid) == 0)
    {
        SetPlayerWantedLevel(issuerid, 3);
        WantedLevelColor(issuerid);
    }
    if(issuerid != INVALID_PLAYER_ID)
    {
        new str[26];
        format(str, sizeof(str),"-%.0f", amount);
        SetPlayerChatBubble(playerid, str, 0xFF0000FF, 100.0, 2000);
        PlayerPlaySound(issuerid,17802,0.0,0.0,0.0);
    }
    return 1;
}



AW: team attack help - Macronix - 20.03.2014

Just use SetPlayerTeam(playerid, YOUR_DESIRED_TEAM_ID);
This will make everyone in the same team invincible


Re: team attack help - iThePunisher - 20.03.2014

hmm ok i will try it when i upload the gamemode
so what about the wanted level you have any idea?
when cop attacks another cop he gets wantedlevel -_-


Re: team attack help - Abagail - 20.03.2014

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(GetPlayerTeam(playerid) == Team_Cop && GetPlayerTeam(issuerid) == Team_Cop)
    {
        GameTextForPlayer(issuerid,"~r~Don't attack your team mates!", 3000, 3);
    }
    if(GetPlayerTeam(playerid) == Team_grove && GetPlayerTeam(issuerid) == Team_grove)
    {
        GameTextForPlayer(issuerid,"~r~Don't attack your Grove Street Family !", 3000, 3);
    }
    if(GetPlayerTeam(playerid) == Team_ballas && GetPlayerTeam(issuerid) == Team_ballas)
    {
        GameTextForPlayer(issuerid,"~r~Don't attack Ballas OG's they are your team mates !", 3000, 3);
    }
    if (GetPlayerWantedLevel(issuerid) == 0 && GetPlayerTeam(playerid) != Team_cop)
    {
        SetPlayerWantedLevel(issuerid, 3);
        WantedLevelColor(issuerid);
    }
    if(issuerid != INVALID_PLAYER_ID)
    {
        new str[26];
        format(str, sizeof(str),"-%.0f", amount);
        SetPlayerChatBubble(playerid, str, 0xFF0000FF, 100.0, 2000);
        PlayerPlaySound(issuerid,17802,0.0,0.0,0.0);
    }
    return 1;
}
Untested.


AW: team attack help - Macronix - 20.03.2014

Try this:
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(GetPlayerTeam(playerid) == Team_Cop && GetPlayerTeam(issuerid) == Team_Cop)
    {
        GameTextForPlayer(issuerid,"~r~Don't attack your team mates!", 3000, 3);
        SetPlayerWantedLevel(issuerid, GetPlayerWantedLevel(playerid)+1);
        WantedLevelColor(issuerid);
    }
    if(GetPlayerTeam(playerid) == Team_grove && GetPlayerTeam(issuerid) == Team_grove)
    {
        GameTextForPlayer(issuerid,"~r~Don't attack your Grove Street Family !", 3000, 3);
    }
    if(GetPlayerTeam(playerid) == Team_ballas && GetPlayerTeam(issuerid) == Team_ballas)
    {
        GameTextForPlayer(issuerid,"~r~Don't attack Ballas OG's they are your team mates !", 3000, 3);
    }
    if(issuerid != INVALID_PLAYER_ID)
    {
        new str[26];
        format(str, sizeof(str),"-%.0f", amount);
        SetPlayerChatBubble(playerid, str, 0xFF0000FF, 100.0, 2000);
        PlayerPlaySound(issuerid,17802,0.0,0.0,0.0);
    }
    return 1;
}



Re: team attack help - iThePunisher - 21.03.2014

i tried those cods and they doesnt work. when cop attacks another cop the message do not team kill doesnt show.
and cop gets wanted again when he attack someone