Anti-Team Kill
#1

Hey guys I cant create a Anti-Team Kill this is my "OnPlayerDeath" Script

be aware it has some of the turf war script in it. I need the SetPlayerTeam in it for it wont make any damage to a player. Thanks,



pawn Код:
public OnPlayerDeath( playerid, killerid, reason )
{
    new killedplayer[ MAX_PLAYER_NAME ];
    new Float:x, Float:y, Float:z;
    new string[ 256 ];

    Spawned[ playerid ] =0;
    SetPlayerArmour( playerid, 0 );

    SendClientMessage(playerid,0xFF0000C8,"You have died.");
    GivePlayerMoney(playerid,-500);
    GameTextForPlayer( killerid, "~G~Killed a Player +1500", 2000, 3 );
    //--------------------------------//

    if (killerid == INVALID_PLAYER_ID)
    {
        SendDeathMessage( INVALID_PLAYER_ID, playerid, reason );
        SetPlayerWantedLevel( playerid, 0 );
        TeamInfo[ gTeam[playerid] ][ HomiesDied ]++;
        TeamInfo[ gTeam[playerid] ][ TeamScore ]--;
    }
    else
    {
        SendDeathMessage( killerid, playerid, reason );
       
       

        //#if DROP_WEAPONS
        //if (!GetPlayerInterior(playerid) && !IsPlayerInAnyVehicle(playerid)) DropPlayerWeapons(playerid);
        //#endif

        if (gTeam[ killerid ] != gTeam[ playerid ]) // Valid kill
        {
          SetPlayerScore( killerid, GetPlayerScore( killerid ) +1 );
          GivePlayerMoney( killerid, 5000 );
          SetPlayerWantedLevel( killerid, GetPlayerWantedLevel( killerid )+1 );
          TeamInfo[ gTeam[killerid] ][ RivalsKilled ]++;
          TeamInfo[ gTeam[playerid] ][ HomiesDied ]++;
          TeamInfo[ gTeam[killerid] ][ TeamScore ]++;
          TeamInfo[ gTeam[playerid] ][ TeamScore ]--;
//----------------------------- player was killed in a turf? -------------------
          GetPlayerPos(playerid, x, y, z);
          GetPlayerPos(killerid, x, y, z);
          for (new i = 0; i < MAX_TURFS; i++)
          {
               if (IsPlayerInTurf(playerid, turfs[i][zMinX], turfs[i][zMinY], turfs[i][zMaxX], turfs[i][zMaxY]) &&
                   IsPlayerInTurf(killerid, turfs[i][zMinX], turfs[i][zMinY], turfs[i][zMaxX], turfs[i][zMaxY])  )
               {
                   if (turfs[ i ][ TurfWarStarted ] != 1 && !IsPlayerInAnyVehicle(killerid))
                   {
                       TurfInfo[ i ][ gTeam[killerid] ][ TurfKills ]++;
                       if (TurfInfo[ i ][ gTeam[killerid] ][ TurfKills ] == ATTACK_KILLS)
                       {
                           if (turfs[ i ][ TurfOwner ] == gTeam[killerid]) {
                               for (new a=0; a<MAX_TEAMS; a++) { TurfInfo[ i ][ a ][ TurfKills ] =0; }
                               return 1;
                           }

                           turfs[ i ][ TurfAttacker ] = gTeam[killerid];
                           for (new b=0; b<SLOTS; b++)
                           {
                                if (gTeam[ b ] == turfs[ i ][ TurfAttacker ]) {
                                      new msg1[ 256 ];
                                      format(msg1,sizeof(msg1), "~w~We have provoked a turfwar ~w~in ~y~%s ~w~against the ~r~%s",
                                      turfs[ i ][ turfName ], TeamInfo[ turfs[ i ][ TurfOwner ] ][ TeamName ]);
                                      new Text:txt1 = TextDrawCreate( 200.0, 385.0, msg1 );
                                      TextDrawFont( txt1, 0 );
                                      TextDrawSetShadow( txt1, 0 );
                                      TextDrawSetOutline( txt1, 1 );
                                      TextDrawColor( txt1, 0xDFDFDFFF );
                                      TimeTextForPlayer( b, txt1, 6000 );
                                      GangZoneFlashForPlayer( b, turfs[ i ][turfID], COLOR_FLASH );
                                }
                                else if (gTeam[b] == turfs[ i ][ TurfOwner ]) {
                                      new msg2[ 256 ];
                                      format(msg2,sizeof(msg2), "~r~The ~y~%s ~r~have attacked our turf in ~y~%s!",
                                      TeamInfo[ turfs[ i ][ TurfAttacker ] ][ TeamName ], turfs[ i ][ turfName ]);
                                      new Text:txt2 = TextDrawCreate( 200.0, 370.0, msg2 );
                                      TextDrawFont( txt2, 0 );
                                      TextDrawSetShadow( txt2, 0 );
                                      TextDrawSetOutline( txt2, 1 );
                                      TextDrawColor( txt2, COLOR_RED );
                                      TimeTextForPlayer( b, txt2, 6000 );
                                      GangZoneFlashForPlayer( b, turfs[ i ][turfID], COLOR_FLASH );
                                }
                                else { GangZoneFlashForPlayer( b, turfs[ i ][turfID], COLOR_FLASH2 ); }
                           }
                           SetTimerEx("EndWar", ATTACK_TIME, false ,"iii", i, turfs[ i ][ TurfAttacker ], turfs[ i ][ TurfOwner ] );
                           turfs[ i ][ TurfWarStarted ] =1;
                           for(new c=0; c<MAX_TEAMS; c++) { TurfInfo[ i ][ c ][ TurfKills ] =0; TurfInfo[ i ][ c ][ TurfAttackKills ] =0; }
                           return 1;
                       }
                   }
                   else if (turfs[ i ][ TurfWarStarted ] == 1 && !IsPlayerInAnyVehicle(killerid) &&
                           (turfs[ i ][ TurfAttacker ] == gTeam[killerid]) || turfs[ i ][ TurfOwner ] == gTeam[killerid])
                   {
                       TurfInfo[ i ][ gTeam[killerid] ][ TurfAttackKills ]++;
                       return 1;
                   }
               }
          }
//------------------------ Was there a bounty on players head -------------------
          if (bounty[ playerid ] > 0) {
              GetPlayerName( playerid, killedplayer, sizeof( killedplayer ) );
              format(string, sizeof(string), "* Bounty reward: %d for killing %s.", bounty[playerid], killedplayer);
              SendClientMessage( killerid, COLOR_YELLOW, string );

              GivePlayerMoney( killerid, bounty[ playerid ] );
              bounty[ playerid ] = 0;
          }
          if(gTeam[killerid] == gTeam[playerid]) {
          SendClientMessage(playerid,COLOR_BLUE1,"die Asshole");
        }
//------------------------ Did player had a wanted level -----------------------
          if (GetPlayerWantedLevel( playerid ) > 0) {
              switch( GetPlayerWantedLevel( playerid ) ) {
                      case 1: {
                           SendClientMessage( killerid, 0x3EBA14FF, "* Bonus for killing a player with a wanted level: $2000 + 2 point." );
                           GivePlayerMoney( killerid, 2500 );
                           SetPlayerScore( killerid, GetPlayerScore( killerid ) +1 );
                           SetPlayerWantedLevel( playerid, 0 );
                      }
                      case 2: {
                           SendClientMessage( killerid, 0x3EBA14FF, "* Bonus for killing a player with a wanted level: $3000 + 3 points." );
                           GivePlayerMoney( killerid, 3000);
                           SetPlayerScore( killerid, GetPlayerScore( killerid ) +1 );
                           SetPlayerWantedLevel( playerid, 0 );
                      }
                      case 3: {
                           SendClientMessage( killerid, 0x3EBA14FF, "* Bonus for killing a player with a wanted level: $4000 + 4 points." );
                           GivePlayerMoney( killerid, 4000 );
                           SetPlayerScore( killerid, GetPlayerScore( killerid ) +1 );
                           SetPlayerWantedLevel( playerid, 0 );
                      }
                      case 4: {
                           SendClientMessage( killerid, 0x3EBA14FF, "* Bonus for killing a player with a wanted level: $5000 + 5 points." );
                           GivePlayerMoney( killerid, 5000 );
                           SetPlayerScore( killerid, GetPlayerScore( killerid ) +1 );
                           SetPlayerWantedLevel( playerid, 0 );
                      }
                      case 5: {
                           SendClientMessage( killerid, 0x3EBA14FF, "* Bonus for killing a player with a wanted level: $6000 + 6 points." );
                           GivePlayerMoney( killerid, 6000 );
                           SetPlayerScore( killerid, GetPlayerScore( killerid ) +1 );
                           SetPlayerWantedLevel( playerid, 0 );
                      }
                      case 6..200: {
                           SendClientMessage( killerid, 0x3EBA14FF, "* Bonus for killing a player with a wanted level: $7000 + 7 points." );
                           GivePlayerMoney( killerid, 7000 );
                           SetPlayerScore( killerid, GetPlayerScore( killerid ) +6 );
                           SetPlayerWantedLevel( playerid, 0 );
                      }
              }
          }
//------------------------------------------------------------------------------
        }
         else //Team Killer!
        {
            //ShowMenuForPlayer(TKMenu, playerid);
            SendClientMessage(killerid,0xFF0000C8,"Hey! Bitch DDNT FUCKING TEAMKILL!!");
            new warning[ 256 ];
            GivePlayerMoney( killerid, GetPlayerMoney ( killerid ) -1000 );
            SetPlayerScore( killerid, GetPlayerScore( killerid ) -2 );
            GameTextForPlayer(killerid,"~w~DONT ~r~TeamKill!~n~~w~Lost ~R~$1000~n~~w~and -1 score",3,3000);
            format( warning, sizeof( warning ), "* No teamkilling!" );
            SendClientMessage( killerid, COLOR_RED, warning );
            if (IsPlayerConnected(killerid)) return TheKiller[ playerid ] = killerid;
        }
    }

    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)