team attack help
#1

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;
}
Reply
#2

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

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 -_-
Reply
#4

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.
Reply
#5

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;
}
Reply
#6

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)