Raised This Month: $12 Target: $400
 3% 

Camp meter


  
 
 
Thread Tools Display Modes
Author Message
Me!ster Jochen
Junior Member
Join Date: May 2008
Old 05-20-2008 , 18:20   Camp meter
#1

Hallo leute, ich suche jemanden der mir sagen kann wie ich was in der sms bei camp meter ändern kann wie ich es haben möchte.

Also wenn man camp geht mein camp meter bei 75% los, das bild flackert und bei 100% ist man Blind ich möchte es aber so haben das es bei 75% anfängt zu slepen und bei 100% jemanden tötet also das wenn jemand bei 100% angelangt ist das er stirbt.

Hoffe ihr könnt mir helfen.

Code:
/* AMXModX Script

   Title:    Bad Camper
   Author:   Brad Jones

   Current Version:   1.2
   Release Date:      2006-03-12

   This plugin will automatically punish players who camp for too long.

   There can be a combination of punishments that get applied to the player.  Punishments
   start when the player's camping meter reaches 80%.  They get worse at 90%.  They finally
   come to a crescendo at 100%.

   This plugin to be the successor to the great AntiCamping Advanced plugin.
   http://amxmodx.org/forums/viewtopic.php?t=751

   Original design inspiration, many concepts, and code came from "AntiCamping Advanced".
   http://amxmodx.org/forums/viewtopic.php?t=751


   INSTALLATION

      File Locations:
      
         .\addons\amxmodx\plugins\bad_camper.amxx
         
      Modules:
      
         fun (required)
         cstrike (required only if utilizing money reduction punishment)
         
   
   ADDITIONAL INSTALLATION
   Only needed if utilizing the "snark attack" punishment.
   
      File Locations:
      
         .\addons\monster\config\precache.cfg
         .\addons\monster\config\skill.cfg
         
         .\addons\monster\dlls\monster_mm.dll
         .\addons\monster\dlls\monster_mm_i386.so
         
      Metamod Edit:
      
         Add one of the following lines to your .\addons\metamod\plugins.ini file:
   
            win32 addons/monster/dlls/monster_mm.dll
            linux addons/amxmodx/dlls/amxmodx_mm_i386.so   

         
   OPTIONS (CVARs)

      badcamper_punish <iFlags>
   
         Specifies how a player is to be punished when they camp too long.
         A value of 0 will disable this plugin.

         The flags are additive.
          1: Slap
          2: Health Reduction
          4: Sound (set sound via "badcamper_sound" CVAR)
          8: Blind
         16: Money Reduction (requires CSTRIKE module)
         32: Snark Attack (requires Monster Mod)
         
         The default is 12 (snore and blind).

      badcamper_sound <iFlag>
      
         Specifies the sound to use as a punishment when the "badcamper_punish" flag includes
         the sound punishment.
         
         1: Snore
         2: Heartbeat
         
         The default is 1.

      badcamper_money <iPercentage>
      
         Specifies the percentage of money taken away when a player's meter reaches 100% when
         using the "money reduction" punishment.
         
         The default is 10 percent.

      badcamper_limit <iSeconds>
      
         Specifies the number of seconds a player can camp in one spot before their 
         camping meter will reach 100%.

         The default is 35 seconds.

      badcamper_display <iPercentage>
      
         Specifies the percentage at which the meter is displayed to the player.
         Valid values range from 0 (never show) to 100.

         The default is 1 percent.

      badcamper_check_all <0|1>
      
         Specifies whether only the team with the current primary objective should be
         checked for camping or if both teams should.
         
         0: only check the team with the current primary objective
         1: always check both teams
         
         The default is 1.
         
         The current primary objective is defined as follows:
         
            - if the map is not a "de" map, the CTs have the primary objective
            - if the map is a "de" map and the bomb hasn't been planted, the Ts have the primary objective
            - if the map is a "de" map and the bomb has been planted, the CTs have the primary objective
            
      badcamper_immunity <0|1>
      
         Specifies whether players with immunity can camp if they stand completely still
         and don't look around for approximately 6 seconds.  Their meter will still 
         increase until it reaches 65% or more at which time it'll stop until they move 
         or look around again.  If the meter is already at 80% or higher, the meter won't stop.
         
         0: nobody can camp
         1: players with the immunity flag can camp
         
         The default is 0.

         The immunity flag is set as ADMIN_IMMUNITY by default but can be changed in the script.

      badcamper_start <iSeconds>
      
         Specifies how many seconds after the freeze time ends each round that the 
         meter will start.

         The default is 4 seconds.

         Note that camping is checked every 2 seconds so any value you put in here will 
         effectively be rounded as such.

      badcamper_damage_reset <iResetType>
      
         Specifies if the attacker's or defender's meter gets reset when the player is
         injured by another.

         0: No meters are reset.
         1: The attacker's meter is reset.
         2: The defender's meter is reset.
         3: Both meters are reset.
         
         The default is 3.

      badcamper_damage_restart <iSeconds>
      
         Specifies how many seconds after a player either gives or receives damage that the 
         meter will restart.

         The default is 4 seconds.

         Note that camping is checked every 2 seconds so any value you put in here will 
         effectively be rounded up as such.

      badcamper_health <iHealthPoints>

         Specifies how many points of health to remove from the player every 2 seconds 
         once their meter reaches 100%.

         The default is 10 health points.

      badcamper_allow <iPlayerCount|iPlayerPercent%>
      
         Specifies when a team that is being checked for camping is allowed to camp.  
         A value of 0 doesn't allow a team to camp.

         The default is 0.

         The value can either be expressed as a straight count or as a percentage.
         If the value is being expressed as a percentage, "%" has to follow the value.  
         Examples below.  If the value is a count, players can camp when the number of 
         living players on their team falls to this value or lower.  If the value is a 
         percentage, players can camp when the percentage of living players on their team 
         is at this value or lower when compared to the living players on the other team.

         Examples:

            badcamper_allow 2

               Pretty straight-forward. Once there are 2 or fewer players left alive on 
               your team, you can camp.

            badcamper_allow 40%
            
               More powerful and complex. Once your team comprises of living players that 
               is 40% or less than the number of living players on the other team, you can 
               camp.  For instance (assume your team is listed first) the following match-ups 
               would allow your team to camp: 1v4, 2v5, 3v8, 4v12, 5v13, 6v15.

      badcamper_min_players <players>
      
         Specifies the minimum number of players that have to be connected to the server 
         before players are allowed to camp.

         The default is 0 players.

         This CVAR affects both "badcamper_check_all" and "badcamper_allow" functionality.
         
      badcamper_announce <announcementType>
      
         Specifies how to announce to the opposite team that a player is camping.
         
         0: Make no announcement.
         1: Announce via chat.
         2: Announce via HUD.
         3: Announce via chat and HUD.
         
         The default is 3.
         

   COMMANDS
   
      badcamper list
      
         Lists the punishments in the console and indicates which of them are active.


   CHANGE LOG
   
      2006-03-12   1.2   ! Compatible with AMXX 1.70 or higher only.
                         - Fixed issue where round end cleanup would not be performed if the round
                           was restarted as opposed to ending normally.
                         - Fixed "index out of bounds" error.
                         - Auto-detects if you're using the supplied "Monster" metamod. If you are using
                           a different version of "Monster", reverts to less fine control over snarks.
                         - Removed need to recompile if using this plugin in a game mod other than
                           Counter-Strike.
                         - Removed need to recompile if using the "Snark Attack" punishment. Now, if you
                           indicate to use "snark attack" as a punishment, but you don't have "Monster"
                           installed, you'll get errors in your log files.
                         - Disabled meter when there is only one person on the server. This is useful
                           for when you want to sit on your server while waiting for others to join.
                         - Implemented more accurate way of detecting if the map was a bomb map.
                         - Optimized the code to use less CPU usage.

      2005-12-10   1.1   - Added "Snark attack" punishment. Requires "Monster Mod" to be installed.
                         - Changed "Slap" punishment to increase in power as the meter gets higher.
                           Note that when slapped, the player may actually get slapped far enough 
                           that it would lower the player's meter.
                         - Added "badcamper_money" CVAR to specify what percentage of money to take
                           away at 100% when using the "money reduction" punishment. Defaults to 
                           10% as was the case before the option was introduced.
                         - Added "badcamper_damage_reset" CVAR flag that specifies the meter(s) to 
                           reset when a player is attacked. Defaults to both attacker and defender
                           having their meter reset as was the case before the option was introduced.
                         - Replaced "snore" punishment with "sound" punishment. The type of sound can
                           be defined by a new CVAR, "badcamper_sound". There are two types of
                           sounds, "snore" (default value) and "heartbeat".
                         - Fixed bug where if a player's meter was 100% and the blind punishment was
                           being used, when the player attacked or was attacked by another, the blind 
                           player would stay blind instead of regaining vision immediately.
                         - Added "badcamper list" command that lists available punishments and 
                           indicates which are currently active (active as per the badcamper_punish CVAR).
                         - Added "badcamper_announce" CVAR flag to indicate how to announce that a player
                           is camping and then when the player stops camping. Will announce the 
                           name of the camper at 90% and then again when the meter gets below 80%. 
                           Options are to print as chat, as a HUD message, both, or neither.
                         - Fixed bug where the CVAR 'badcamper_allow' had no effect, thus if set to a
                           value higher than 0 a team would still never be allowed to camp.

      2005-09-24   1.0   - Initial release.

*/


/*-----------------------------------------------------------
COMPILER OPTIONS
-----------------------------------------------------------*/
//-----------------------------------------------------------
// Set the flag that indicates if a player has immunity
// when standing completely still and immunity is allowed.
#define IMMUNITY ADMIN_IMMUNITY
//-----------------------------------------------------------


#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fun>
#include <cstrike>    // don't worry if you're not running cstrike, it's all good

#define TASKID_CHECK_CAMPING 85809473
#define TASKID_PLANTING      84278346

#define SND_STOP (1<<5)

#define TEAM_T     1
#define TEAM_CT    2

// Player Flags
#define METER_PAUSE       1
#define METER_IGNORE      2
#define PLAYER_BLIND      4
#define PLAYER_SOUND      8
#define CAMPER_ANNOUNCED 16

#define FADE_IN   (1<<0)
#define FADE_OUT    (1<<1)
#define FADE_HOLD (1<<2)

#define FADE_LENGTH_PERM (1<<0)

#define PUNISH_SLAP              1
#define PUNISH_HEALTH          2
#define PUNISH_SOUND          4
#define PUNISH_BLIND          8
#define PUNISH_MONEY       16
#define PUNISH_SNARKS    32

#define ANNOUNCE_CHAT 1
#define ANNOUNCE_HUD  2

#define SOUNDTYPE_SNORE     1
#define SOUNDTYPE_HEARTBEAT 2

#define DMG_RESET_DEFENDER 1
#define DMG_RESET_ATTACKER 2

#define TOLERANCE_DEFENDING 180
#define TOLERANCE_ATTACKING 220

#define MAX_PLAYER_CNT    33    // really 32, but 32 is 0-31 and we want 1-32, so... 33
#define MAX_COORDTYPE_CNT  2
#define MAX_VECTOR_CNT     4
#define MAX_COORD_CNT      3

#define COORDTYPE_BODY 0
#define COORDTYPE_EYES 1

new g_coordsBody[MAX_PLAYER_CNT][MAX_VECTOR_CNT][MAX_COORD_CNT];
new g_coordsEyes[MAX_PLAYER_CNT][MAX_VECTOR_CNT][MAX_COORD_CNT];
new g_meter[MAX_PLAYER_CNT], g_playerFlags[MAX_PLAYER_CNT], g_snarkCnt[MAX_PLAYER_CNT];
new bool:g_bombPlanted;
new g_msgFade, bool:g_mapHasBomb;
new g_cstrike;
new bool:g_monsterBugblatterFork;

// declare CVAR pointers
new g_cvarPunish, g_cvarLimit, g_cvarDisplay, g_cvarCheckAll, g_cvarImmunity
new g_cvarStart, g_cvarDamageReset, g_cvarDamageRestart, g_cvarHealth, g_cvarMoney
new g_cvarMinPlayers, g_cvarAllow, g_cvarAnnounce, g_cvarSound 

public plugin_natives()
{
    set_module_filter("filter_module");
    set_native_filter("filter_native");
}

public filter_module(const module[])
{
    return (equali(module, "cstrike")) ? PLUGIN_HANDLED : PLUGIN_CONTINUE;
}

public filter_native(const name[], index, trap)
{
    return (!trap) ? PLUGIN_HANDLED : PLUGIN_CONTINUE;
} 

public plugin_precache()
{    
    if (get_cvar_num("badcamper_sound") & SOUNDTYPE_SNORE) precache_sound("misc/snore.wav");
    precache_sound("player/heartbeat1.wav");

    return PLUGIN_CONTINUE;
}

public plugin_init()
{    
    new pluginVersion[] = "1.2";
    
    register_plugin("Bad Camper", pluginVersion, "Brad Jones");

    register_cvar("badcamper_version", pluginVersion, FCVAR_SERVER|FCVAR_SPONLY);
    //register_cvar("badcamper_debug", "0");

    register_dictionary("bad_camper.txt");
    
    register_event("Damage", "event_damage", "b", "2!0");
    register_event("BarTime", "event_bartime", "b");
    register_event("SendAudio", "event_bomb_planted", "a", "2&%!MRAD_BOMBPL");
    
    register_logevent("event_round_start", 2, "1=Round_Start");

    register_logevent("event_round_end", 2, "1=Round_End");
    register_logevent("event_round_end", 2, "1&Restart_Round_");

    register_concmd("badcamper", "cmd_list", ADMIN_CVAR, "- lists available punishments and indicates which are active");
    
    g_cvarPunish         = register_cvar("badcamper_punish", "12");  // is camping to be punished and if so, how
    g_cvarLimit          = register_cvar("badcamper_limit", "35");  // seconds allowed to camp
    g_cvarDisplay        = register_cvar("badcamper_display", "1"); // at what percentage to display meter
    g_cvarCheckAll       = register_cvar("badcamper_check_all", "1"); // check both teams or just team with primary objective
    g_cvarImmunity       = register_cvar("badcamper_immunity", "0"); // can players with immunity be immune (when standing still)
    g_cvarStart          = register_cvar("badcamper_start", "4.0"); // number of seconds after the start of a round that the meter starts
    g_cvarDamageReset    = register_cvar("badcamper_damage_reset", "3"); // flag that indicates which meter(s) get reset upon a player attack
    g_cvarDamageRestart  = register_cvar("badcamper_damage_restart", "4.0"); // number of seconds after giving or taking damage that the meter restarts
    g_cvarHealth         = register_cvar("badcamper_health", "10");  // health taken if 'health reduction' punishment flag set (at 100% camp meter)
    g_cvarMoney          = register_cvar("badcamper_money", "10"); // percentage of player's money taken if 'money reduction' punishment flag set (at 100% camp meter)
    g_cvarMinPlayers     = register_cvar("badcamper_min_players", "0"); // minimum players before camping is allowed
    g_cvarAllow          = register_cvar("badcamper_allow", "0"); // when is camping allowed
    g_cvarAnnounce       = register_cvar("badcamper_announce", "0"); // announce a player's camping status
    g_cvarSound          = register_cvar("badcamper_sound", "1"); // type of sound to play when "badcamper_punish" includes the sound punishment

    return PLUGIN_CONTINUE;
}

public plugin_cfg()
{
    g_cstrike = module_exists("cstrike");
    g_msgFade = get_user_msgid("ScreenFade");
    g_mapHasBomb = (engfunc(EngFunc_FindEntityByString, -1, "classname", "func_bomb_target") > 0);

    if (cvar_exists("monster_version"))
    {
        new monsterVersion[16]
        get_cvar_string("monster_version", monsterVersion, 15);
        
        if (equali(monsterVersion, "3.01.04"))
            g_monsterBugblatterFork = true;
    }
    
    return PLUGIN_CONTINUE;
}

public cmd_list(id, level, cid)
{
    if (!cmd_access(id, level, cid, 1)) return PLUGIN_HANDLED;
    
    new punishmentFlags = get_pcvar_num(g_cvarPunish);
    new punishSlap[32], punishHealth[32], punishSound[32], punishBlind[32], punishMoney[32], punishSnarks[32];

    // List each of the punishments available and indicate which of them are currently active.
    format(punishSlap,   31, "%5i %-1.1s%L",  1, (punishmentFlags & PUNISH_SLAP) ? "*" : "",   LANG_SERVER, "PUNISH_SLAP") ;
    format(punishHealth, 31, "%5i %-1.1s%L",  2, (punishmentFlags & PUNISH_HEALTH) ? "*" : "", LANG_SERVER, "PUNISH_HEALTH");
    format(punishSound,  31, "%5i %-1.1s%L (%L)",  4, (punishmentFlags & PUNISH_SOUND) ? "*" : "",  LANG_SERVER, "PUNISH_SOUND", LANG_SERVER, (get_pcvar_num(g_cvarSound) & SOUNDTYPE_SNORE) ? "SOUND_SNORE" : "SOUND_HEART");
    format(punishBlind,  31, "%5i %-1.1s%L",  8, (punishmentFlags & PUNISH_BLIND) ? "*" : "",  LANG_SERVER, "PUNISH_BLIND");
    format(punishMoney,  31, "%5i %-1.1s%L", 16, (punishmentFlags & PUNISH_MONEY) ? "*" : "",  LANG_SERVER, "PUNISH_MONEY");
    format(punishSnarks, 31, "%5i %-1.1s%L", 32, (punishmentFlags & PUNISH_SNARKS) ? "*" : "", LANG_SERVER, "PUNISH_SNARKS");
    
    if (id)
    {
        client_print(id, print_console, "%s", punishSlap);
        client_print(id, print_console, "%s", punishHealth);
        client_print(id, print_console, "%s", punishSound);
        client_print(id, print_console, "%s", punishBlind);
        client_print(id, print_console, "%s", punishMoney);
        client_print(id, print_console, "%s", punishSnarks);
    }
    else
    {
        server_print("%s", punishSlap);
        server_print("%s", punishHealth);
        server_print("%s", punishSound);
        server_print("%s", punishBlind);
        server_print("%s", punishMoney);
        server_print("%s", punishSnarks);
    }
    return PLUGIN_HANDLED;
}

public check_camping()
{    
    /* don't check, if the plugin is disabled */
    new punishmentFlags = get_pcvar_num(g_cvarPunish);
    if (punishmentFlags == 0) return;
    
    /* don't check, if there is only one player on server */
    if (get_playersnum() == 1) return;

    /* determine acceptable camping values */
    new allowCampValue = get_pcvar_num(g_cvarAllow);
    new s_allowCampValue[8];
    new bool:allowCampByRatio;

    if (allowCampValue > 0)
    {
        get_pcvar_string(g_cvarAllow, s_allowCampValue, 7);
        allowCampByRatio = (contain(s_allowCampValue, "%") == -1) ? false : true;
        allowCampValue = (allowCampByRatio) ? clamp(allowCampValue, 1, 100) : clamp(allowCampValue, 1, 32);
    }

    /* determine if either team is allowed to camp */
    new bool:allowTeamCamp[3] = {false, ...}; // using elements 1 and 2 to correspond to the values for TEAM_T and TEAM_CT
    new players[32], playerCnt_T, playerCnt_CT;

    if (get_playersnum() >= get_pcvar_num(g_cvarMinPlayers))
    {
        // based on their objective ...
        if (!get_pcvar_num(g_cvarCheckAll))
        {
            if (!g_mapHasBomb)
                allowTeamCamp[TEAM_T] = true;
            else if (g_bombPlanted)
                allowTeamCamp[TEAM_T] = true;
            else
                allowTeamCamp[TEAM_CT] = true;
        }
        
        // ... and based on calculated camp allowance
        if (allowCampValue > 0)
        {
            // get living player counts for each team (as opposed to including dead teammates)
            get_players(players, playerCnt_T, "ae", "TERRORIST");
            get_players(players, playerCnt_CT, "ae", "CT");

            if (allowCampByRatio)
            {
                // allow camp per ratio of players on player's team to players on other team
                if (!allowTeamCamp[TEAM_T])  allowTeamCamp[TEAM_T]  = allowCampValue >= percent(playerCnt_T, playerCnt_CT);
                if (!allowTeamCamp[TEAM_CT]) allowTeamCamp[TEAM_CT] = allowCampValue >= percent(playerCnt_CT, playerCnt_T);
            }
            else
            {
                // allow camp per straight player count
                if (!allowTeamCamp[TEAM_T])  allowTeamCamp[TEAM_T]  = (allowCampValue >= playerCnt_T);
                if (!allowTeamCamp[TEAM_CT]) allowTeamCamp[TEAM_CT] = (allowCampValue >= playerCnt_CT);
            }
        }
    }
    
    /* handle each player's camping needs */
    new playerCnt;
    new id, teamID;
    new stdDev, campTolerance;
    new prevMeter, bool:punishCamper, Float:punishPercentage;
    new immunityAllowed = get_pcvar_num(g_cvarImmunity);
    new announceCampStatus = get_pcvar_num(g_cvarAnnounce);

    get_players(players, playerCnt, "ac");

    for (new iPlayerIdx = 0; iPlayerIdx < playerCnt; ++iPlayerIdx)
    {
        id = players[iPlayerIdx];
        
        // ignore this player if is hltv
        if (is_user_hltv(id)) continue;
        
        // pause the meter (don't cycle coords) if needed
        if (g_playerFlags[id] & METER_PAUSE) continue;

        // insert the current location of the player
        coords_insert(id, COORDTYPE_BODY);
        
        // ignore the meter if the player can legally camp or the player's meter is being ignored
        if (allowTeamCamp[teamID] || g_playerFlags[id] & METER_IGNORE) continue;

        // ignore if this player meets the immunity requirements
        if (immunityAllowed && get_user_flags(id) & IMMUNITY)
        {
            // insert the current coords of where the player's shot would hit, i.e. where the player is looking
            coords_insert(id, COORDTYPE_EYES);

            if (standing_still(id) && !looking_around(id) && g_meter[id] >= 65 && g_meter[id] < 80) continue;
        }

        // grab the standard deviation from the player coords
        stdDev = coords_stdv(id);

        // grab the camping tolerance based on current objective
        campTolerance = (g_mapHasBomb == false || g_bombPlanted) ? TOLERANCE_ATTACKING : TOLERANCE_DEFENDING;
        
        // grab the current meter percentage
        prevMeter = g_meter[id];
        
        // add new percentage points to the meter
        g_meter[id] += (campTolerance - stdDev) / get_pcvar_num(g_cvarLimit);

        // ensure the meter falls within bounds        
        g_meter[id] = clamp(g_meter[id], 0, 100);

        // if the meter is trending down, give the player some love
        if (g_meter[id] < prevMeter)
        {
            if (g_meter[id] < 80)
            {
                // help the meter find it's way down
                g_meter[id] -= (prevMeter - g_meter[id]) / 3;
                
                if (prevMeter >= 80)
                {
                    // ensure player isn't still being punished
                    punish_stop_all(id);
                    
                    // announce that the player is no longer camping
                    if (announceCampStatus && g_playerFlags[id] & CAMPER_ANNOUNCED) camper_announcement(id, false);
                }
            }
        }

        // determine how severe the punishment should be, if at all
        punishCamper = true; // now prove me wrong
        if (g_meter[id] == 100)        punishPercentage = 1.00;
        else if (g_meter[id] >= 90) punishPercentage = 0.50;
        else if (g_meter[id] >= 80) punishPercentage = 0.10;
        else punishCamper = false;
        
        // punish the vile camper
        if (punishCamper)
        {
            if (punishmentFlags & PUNISH_SLAP)   punish_slap(id, punishPercentage);
            if (punishmentFlags & PUNISH_HEALTH) set_user_health(id, get_user_health(id) - floatround(get_pcvar_float(g_cvarHealth) * punishPercentage));
            if (punishmentFlags & PUNISH_BLIND)  punish_blind(id, punishPercentage);
            if (punishmentFlags & PUNISH_SOUND)  punish_sound(id, punishPercentage);
            if (punishmentFlags & PUNISH_MONEY)  punish_money_reduction(id, punishPercentage);
            if (punishmentFlags & PUNISH_SNARKS) punish_snark_attack(id, punishPercentage);

            // announce that the player is camping
            if (g_meter[id] >= 90 && !(g_playerFlags[id] & CAMPER_ANNOUNCED)) camper_announcement(id, true);
        }

        // let them know how long they've camped
        meter_display(id);
    }
}

camper_announcement(id, bool:isCamping)
{
    // announce to the opposite team this player's camping status
    new camperName[32];
    get_user_name(id, camperName, 31);
    
    new otherTeam[16];
    format(otherTeam, 15, "%s", (get_user_team(id) == TEAM_T) ? "CT" : "TERRORIST");
    
    new players[32], playerCnt;
    get_players(players, playerCnt, "ae", otherTeam);

    new announcementType = get_pcvar_num(g_cvarAnnounce);    
        
    if (announcementType)
    {
        new msgAnnouncement[16];
        copy(msgAnnouncement, 15, (isCamping) ? "CAMPING_STARTED" : "CAMPING_STOPPED");

        new playerIdx, announcement[64];
    
        for (playerIdx = 0; playerIdx < playerCnt; playerIdx++)
        {
            format(announcement, 63, "%L", players[playerIdx], msgAnnouncement, camperName);
            
            if (announcementType & ANNOUNCE_CHAT)
                client_print(players[playerIdx], print_chat, "[BADCAMPER] %s", announcement);

            if (announcementType & ANNOUNCE_HUD)
            {
                set_hudmessage(100, 100, 255, -1.0, 0.88, 0, 1.0, 6.0, 0.1, 0.1, -1);
                show_hudmessage(players[playerIdx], "%s", announcement);
            }
        }            
        g_playerFlags[id] += (isCamping) ? CAMPER_ANNOUNCED : -CAMPER_ANNOUNCED;
    }
}

punish_sound(id, Float:punishPercentage)
{
    new soundFile[32];
    format(soundFile, 31, (get_pcvar_num(g_cvarSound) & SOUNDTYPE_SNORE) ? "misc/snore.wav" : "player/heartbeat1.wav");
    
    emit_sound(id, CHAN_VOICE, soundFile, punishPercentage, ATTN_NORM, 0, PITCH_NORM);
    if (!(g_playerFlags[id] & PLAYER_SOUND)) g_playerFlags[id] += PLAYER_SOUND;
}

punish_sound_stop(id)
{
    new soundFile[32];
    format(soundFile, 31, (get_pcvar_num(g_cvarSound) & SOUNDTYPE_SNORE) ? "misc/snore.wav" : "player/heartbeat1.wav");

    emit_sound(id, CHAN_VOICE, soundFile, 0.0, ATTN_NORM, 0, PITCH_NORM);
    if (g_playerFlags[id] & PLAYER_SOUND) g_playerFlags[id] -= PLAYER_SOUND;
}

punish_slap(id, Float:punishPercentage)
{
    for (new slapCnt = 1; slapCnt <= floatround(3.0 * punishPercentage, floatround_ceil); slapCnt++)
        user_slap(id, 0);
}

punish_money_reduction(id, Float:punishPercentage)
{
    if (g_cstrike)
    {
        new Float:lossPercentage = (get_pcvar_float(g_cvarMoney) / 100.0) * punishPercentage;
        new Float:currentMoney = float(cs_get_user_money(id));
        new reducedMoney = floatround(currentMoney - (currentMoney * lossPercentage));
        cs_set_user_money(id, reducedMoney);
    }
}

public meter_display(id)
{
    new displayMeter = get_pcvar_num(g_cvarDisplay);
    if (displayMeter > 0 && g_meter[id] >= displayMeter)
    {
        new r, g, b;
        
        if (g_meter[id] > 90)
            r = 255;
        else if (g_meter[id] > 80)
        {
            r = 255; 
            g = 100;
        }
        else if (g_meter[id] > 50) 
        {
            r = 255;
            g = 255;
        }
        else if (g_meter[id] > 20) 
            g = 255; 
        else 
            b = 255;

        set_hudmessage(r, g, b, -1.0, 0.85, 0, 1.0, 2.0, 0.1, 0.1, -1);
        show_hudmessage(id, "%L", id, "CAMP_METER", g_meter[id]);
    }
}

public standing_still(id)
{
    return vectors_same(id, COORDTYPE_BODY);
}

public looking_around(id)
{
    return !vectors_same(id, COORDTYPE_EYES);
}

public vectors_same(id, coordType)
{
    new curCoords[MAX_COORD_CNT], coordIdx;

    // grab the current coordinates
    for (coordIdx = 0; coordIdx < MAX_COORD_CNT; ++coordIdx)
        curCoords[coordIdx] = (coordType == COORDTYPE_BODY) ? g_coordsBody[id][0][coordIdx] : g_coordsEyes[id][0][coordIdx];

    for (new vectorIdx = 1; vectorIdx < MAX_VECTOR_CNT; ++vectorIdx)
        for (coordIdx = 0; coordIdx < MAX_COORD_CNT; ++coordIdx)
            if (curCoords[coordIdx] != ((coordType == COORDTYPE_BODY) ? g_coordsBody[id][vectorIdx][coordIdx] : g_coordsEyes[id][vectorIdx][coordIdx])) 
                return false;
    
    return true;
}

public coords_stdv(id)
{
    // get the total variance of all the coords
    new sum, avg, variance, varianceTot;
    new coordIdx, vectorIdx;

    for (coordIdx = 0; coordIdx < MAX_COORD_CNT; ++coordIdx)
    {
        // initialize our working variables
        sum = 0;
        variance = 0;
        
        // get the average of the coordinate
        for (vectorIdx = 0; vectorIdx < MAX_VECTOR_CNT; ++vectorIdx)
            sum += g_coordsBody[id][vectorIdx][coordIdx];
    
        avg = sum / MAX_VECTOR_CNT;
        
        // get the variance of the coordinate
        for (vectorIdx = 0; vectorIdx < MAX_VECTOR_CNT; ++vectorIdx)
            variance += power(g_coordsBody[id][vectorIdx][coordIdx] - avg, 2);
    
        variance = variance / (MAX_VECTOR_CNT - 1);
        
        // increment the total variance of all coordinates
        varianceTot += variance;
    }

    // return the standard deviation (std dev = the square root of the variance)
    return sqroot(varianceTot);
}

public coords_insert(id, coordType)
{
    // move each vector up one level, making room at the bottom for the new coords
    for (new vectorIdx = MAX_VECTOR_CNT - 1; vectorIdx > 0; --vectorIdx)
    {    
        for (new coordIdx = 0; coordIdx < MAX_COORD_CNT; ++coordIdx)
        {
            if (coordType == COORDTYPE_BODY)
                g_coordsBody[id][vectorIdx][coordIdx] = g_coordsBody[id][vectorIdx - 1][coordIdx];
            else
                g_coordsEyes[id][vectorIdx][coordIdx] = g_coordsEyes[id][vectorIdx - 1][coordIdx];
        }
    }
    
    // now that space is cleared for them, insert the current coords into the lowest vector
    if (is_user_connected(id))
    {
        if (coordType == COORDTYPE_BODY)
            get_user_origin(id, g_coordsBody[id][0], 0);
        else
            get_user_origin(id, g_coordsEyes[id][0], 3);
    }
}

public punish_snark_attack(id, Float:punishPercentage)
{
    new maxSnarkCnt = floatround(punishPercentage * 16.0);

    if (g_snarkCnt[id] < maxSnarkCnt)
    {
        // send the snarks out, two at a time
        if (g_monsterBugblatterFork)
        {
            server_cmd("monster model snark player #%i targetplayer #%i", id, id);
            server_cmd("monster model snark player #%i targetplayer #%i", id, id);
        }
        else
        {
            server_cmd("monster snark #%i", id);
            server_cmd("monster snark #%i", id);
        }
        
        g_snarkCnt[id] += 2;
    }
}

public punish_blind(id, Float:punishPercentage)
{
    new duration = (punishPercentage == 1.0) ? FADE_LENGTH_PERM : 1<<12;
    new holdTime = (punishPercentage == 1.0) ? FADE_LENGTH_PERM : 1<<8;
    new fadeType = (punishPercentage == 1.0) ? FADE_HOLD : FADE_IN;
    new blindness = 127 + floatround(128.0 * punishPercentage);
    
    if (is_user_alive(id))
    {
        if (!(g_playerFlags[id] & PLAYER_BLIND)) g_playerFlags[id] += PLAYER_BLIND;
            
        message_begin(MSG_ONE, g_msgFade, {0,0,0}, id); // use the magic #1 for "one client" 
        write_short(duration); // fade lasts this long duration 
        write_short(holdTime); // fade lasts this long hold time 
        write_short(fadeType); // fade type 
        write_byte(0); // fade red 
        write_byte(0); // fade green 
        write_byte(0); // fade blue  
        write_byte(blindness); // fade alpha  
        message_end(); 
    }    
}

public punish_blind_stop(id)
{
    if (g_playerFlags[id] & PLAYER_BLIND) g_playerFlags[id] -= PLAYER_BLIND;

    message_begin(MSG_ONE, g_msgFade, {0,0,0}, id); // use the magic #1 for "one client"  
    write_short(1<<12); // fade lasts this long duration  
    write_short(1<<8); // fade lasts this long hold time  
    write_short(FADE_OUT); // fade type
    write_byte(0); // fade red  
    write_byte(0); // fade green  
    write_byte(0); // fade blue    
    write_byte(255); // fade alpha    
    message_end();    
}

public meter_dmg_reset(id)
{
    // forgive previous camping transgressions
    punish_stop_all(id);
    g_meter[id] = 0;
    g_playerFlags[id] = 0;
    
    // the player has been through enough trauma (getting or giving damage)
    // so let's just ignore the camp meter for awhile
    meter_ignore(id);
    
    remove_task(id);
    set_task(get_pcvar_float(g_cvarDamageRestart), "meter_unignore", id);
}

public meter_pause(id)
{
    if (!(g_playerFlags[id] & METER_PAUSE)) g_playerFlags[id] += METER_PAUSE;
}

public meter_ignore(id)
{
    if (!(g_playerFlags[id] & METER_IGNORE)) g_playerFlags[id] += METER_IGNORE;
}

public meter_unpause(id)
{
    if (id > 32) id -= TASKID_PLANTING;
    if (g_playerFlags[id] & METER_PAUSE) g_playerFlags[id] -= METER_PAUSE;
}

public meter_unignore(id)
{
    if (g_playerFlags[id] & METER_IGNORE) g_playerFlags[id] -= METER_IGNORE;
}

public start_checking()
{
    for (new id = 1; id <= 32; id++)
        meter_unignore(id);
}

public event_bartime(id)
{
    if (get_pcvar_num(g_cvarPunish))
    {
        remove_task(TASKID_PLANTING + id);
        
        new timeLength = read_data(1);

        if (timeLength == 0)
        {
            meter_unpause(id);
        }
        else
        {
            meter_pause(id);
            set_task(float(timeLength), "meter_unpause", TASKID_PLANTING + id);
        }
    }        
}

public event_bomb_planted()
{
    g_bombPlanted = true;
}

public event_damage(id)
{
    if (get_pcvar_num(g_cvarPunish) && id > 0) // if a player is damaged
    {
        new enemyID = get_user_attacker(id);

        if(enemyID && get_user_team(id) != get_user_team(enemyID)) // if the player was damaged by an enemy
        {
            new damageResetFlag = get_pcvar_num(g_cvarDamageReset);
            if (damageResetFlag & DMG_RESET_DEFENDER) 
                meter_dmg_reset(id);
            if (damageResetFlag & DMG_RESET_ATTACKER && enemyID && enemyID <= 32) 
                meter_dmg_reset(enemyID);
        }
    }
}

public event_round_end()
{
    // stop checking for camping
    remove_task(TASKID_CHECK_CAMPING);
    // make sure any straggling snarks are sent away to a better place
    if (get_pcvar_num(g_cvarPunish) & PUNISH_SNARKS && g_monsterBugblatterFork) server_cmd("slaymonsters force");
}

public event_round_start()
{    
    g_bombPlanted = false;

    if (get_pcvar_num(g_cvarPunish))
    {
        // reset all the flags
        for (new id = 1; id <= 32; id++)
        {
            g_meter[id] = 0;
            g_playerFlags[id] = 0;
            g_snarkCnt[id] = 0;
            meter_ignore(id);
            coords_reset(id);
        }

        set_task(get_pcvar_float(g_cvarStart), "start_checking");
        set_task(2.0, "check_camping", TASKID_CHECK_CAMPING, _, _, "b");
    }
}

public coords_reset(id)
{
    for (new vectorIdx = 0; vectorIdx < MAX_VECTOR_CNT; vectorIdx++)
        coords_insert(id, COORDTYPE_BODY);
}

public punish_stop_all(id)
{
    if (g_playerFlags[id] & PLAYER_BLIND) punish_blind_stop(id);
    if (g_playerFlags[id] & PLAYER_SOUND) punish_sound_stop(id);
    g_snarkCnt[id] = 0;
}

percent(is, of)
{
    return (of != 0) ? floatround(floatmul(float(is)/float(of), 100.0)) : 0;
}
Ich sag schon ma danke

mfg

Jochen
Me!ster Jochen is offline
Send a message via ICQ to Me!ster Jochen
schlumpf2005
Veteran Member
Join Date: Dec 2005
Location: Eckernförde (Germany)
Old 05-20-2008 , 18:42   Re: Camp meter
#2

nach meinesm wissennach gibs ein Cmapometer Plugin wo man dies einstellen kann. Wenn man Camp das z.b. kleine Monster kommen etc die einen immer hinterher laufen. Auch die Funktion Slappen müsste dabei sein

Dies ist es glaub ich
http://forums.alliedmods.net/showpost.php?p=156560&postcount=1

Hat die Funktion
  • 1: Slap
  • 2: Health Reduction
  • 4: Sound (set sound via badcamper_sound)
  • 8: Blind
  • 16: Money Reduction (requires CSTRIKE module)
  • 32: Snark Attack (requires Monster Mod with Snarks enabled)
__________________


Wir Bieten Ihnen Gameserver ohne Vertragsbindung an. (Prepaid Gameserver) Überzeugen Sie sich selbst
schlumpf2005 is offline
Send a message via ICQ to schlumpf2005
Me!ster Jochen
Junior Member
Join Date: May 2008
Old 05-20-2008 , 18:46   Re: Camp meter
#3

Hey das kann man auch irgendwie einstellen aber ich habe nix gefunden es gibt keine config dafür nix also müsste man es doch in der sma umstellen könn oder nich? von der seite habe ich das plugin da steht auch was beschrieben aber ich bin echt nen null in sowas. http://www.amxx-plugins.de/plugins/gameplay/bad-camper/
__________________
Me!ster Jochen is offline
Send a message via ICQ to Me!ster Jochen
schlumpf2005
Veteran Member
Join Date: Dec 2005
Location: Eckernförde (Germany)
Old 05-20-2008 , 18:49   Re: Camp meter
#4

Das was ich gepostet habe kannst du alles einstellen an den CVARS einfach mal genau durchlesen ist nicht so schwer wie es aussieht. Von der Seite amxx-plugins.de halte ich leider nicht viel sorry. Habe bisher teilweise immer welchen mal geholfen die da plugins hatten die nicht gehen etc.

Wer hier sucht bekommt welche die Originalsind und die auch laufen.
__________________


Wir Bieten Ihnen Gameserver ohne Vertragsbindung an. (Prepaid Gameserver) Überzeugen Sie sich selbst
schlumpf2005 is offline
Send a message via ICQ to schlumpf2005
Me!ster Jochen
Junior Member
Join Date: May 2008
Old 05-20-2008 , 18:53   Re: Camp meter
#5

mhhh ja ich nix englisch könn.

also ich versteh das so das ich das
badcamper_punish "1" in meine config.ini eintragen muss oder?
__________________
Me!ster Jochen is offline
Send a message via ICQ to Me!ster Jochen
|PJ| Shorty
Veteran Member
Join Date: Aug 2005
Location: Bavaria, Germany
Old 05-21-2008 , 04:00   Re: Camp meter
#6

nicht in die config.ini, in die amxx.cfg
__________________
There are only 10 types of people in the world:
Those who understand binary, and those who don´t.
|PJ| Shorty is offline
Send a message via ICQ to |PJ| Shorty Send a message via AIM to |PJ| Shorty Send a message via MSN to |PJ| Shorty Send a message via Yahoo to |PJ| Shorty Send a message via Skype™ to |PJ| Shorty
Me!ster Jochen
Junior Member
Join Date: May 2008
Old 05-21-2008 , 04:18   Re: Camp meter
#7

thx ich meinte auch die server.ini aber wenn du sagst in die amxx.cfg dann probier ich das mal später aus
__________________

Last edited by Me!ster Jochen; 05-21-2008 at 04:23.
Me!ster Jochen is offline
Send a message via ICQ to Me!ster Jochen
|PJ| Shorty
Veteran Member
Join Date: Aug 2005
Location: Bavaria, Germany
Old 05-21-2008 , 06:29   Re: Camp meter
#8

meinst wohl die server.cfg ^^

würde auch gehen, musst aber ein bischen was beachten.
in die amxx.cfg und gut is.
__________________
There are only 10 types of people in the world:
Those who understand binary, and those who don´t.
|PJ| Shorty is offline
Send a message via ICQ to |PJ| Shorty Send a message via AIM to |PJ| Shorty Send a message via MSN to |PJ| Shorty Send a message via Yahoo to |PJ| Shorty Send a message via Skype™ to |PJ| Shorty
Me!ster Jochen
Junior Member
Join Date: May 2008
Old 05-21-2008 , 17:29   Re: Camp meter
#9

das geht auch nich wenn ich das so eintrage in die amxx.cfg
__________________
Me!ster Jochen is offline
Send a message via ICQ to Me!ster Jochen
Me!ster Jochen
Junior Member
Join Date: May 2008
Old 05-22-2008 , 17:11   Re: Camp meter
#10

Hey es geht mit dem slapen aber man verliert dabei keine kp man wird einfach nur so geslept wo und wie muss ich das umstellen? eine rnen plan?
__________________
Me!ster Jochen is offline
Send a message via ICQ to Me!ster Jochen
 



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

Forum Jump


All times are GMT -4. The time now is 17:56.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode