Raised This Month: $ Target: $400
 0% 

Error CSTRIKE


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
kramesa
Veteran Member
Join Date: Feb 2011
Location: Brazil
Old 12-07-2011 , 10:20   Error CSTRIKE
Reply With Quote #1

Code:
L 12/07/2011 - 13:19:46: [CSTRIKE] Player out of range (85809473)
L 12/07/2011 - 13:19:46: [AMXX] Run time error 10 (plugin "bad_camper.amxx") (native "cs_get_user_team") - debug not enabled!
L 12/07/2011 - 13:19:46: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
Because have this errors in this code:

PHP Code:
public check_camping(id)
{    
    
/* don't check, if the plugin is disabled */
    
if(cs_get_user_team(id) == CS_TEAM_T) return; 
Full code:
PHP Code:
public check_camping(id)
{    
    
/* don't check, if the plugin is disabled */
    
if(cs_get_user_team(id) == CS_TEAM_T) return;    
    new 
punishmentFlags get_pcvar_num(g_cvarPunish);
    if (
punishmentFlags == 0) return;
    
    
/* don't check, if there is only one player on server */
    
new players[32], playerCnt;
    
get_players(playersplayerCnt"ch");    // don't include bots or hltv
    
if (playerCnt == && !(get_pcvar_num(g_cvarDebug) && DBG_METER_ON_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_cvarAllows_allowCampValue7);
        
allowCampByRatio = (contain(s_allowCampValue"%") ==-1) ? false true;
        
allowCampValue = (allowCampByRatio) ? clamp(allowCampValue1100) : clamp(allowCampValue132);
    }

    
/* determine if either team is allowed to camp */
    
new bool:allowTeamCamp[3] = {false, ...}; // using elements 1 and 2 to correspond to the values for TEAM1 and TEAM2
    
new playerCnt_team1playerCnt_team2teamIDid;

    
get_players(playersplayerCnt"h"); // don't include hltv
    
if (playerCnt >= get_pcvar_num(g_cvarMinPlayers))
    {
        
// based on their objective ...
        
if (!get_pcvar_num(g_cvarCheckAll) && g_cstrike)
        {
            if (!
g_mapHasBomb)
                
allowTeamCamp[TEAM1] = true;
            else if (
g_bombPlanted)
                
allowTeamCamp[TEAM1] = true;
            else
                
allowTeamCamp[TEAM2] = true;
        }

        
// ... and based on calculated camp allowance
        
if (allowCampValue 0)
        {
            
// get living player counts for each team
            
get_players(playersplayerCnt"ah");    // skip dead players and hltv
            
for (new playerIdx 0playerIdx playerCnt; ++playerIdx)
            {
                
id players[playerIdx];
                
teamID get_user_team(id);
                if (
teamID == TEAM1)
                    
playerCnt_team1++;
                else if (
teamID == TEAM2)
                    
playerCnt_team2++;
            }

            if (
allowCampByRatio)
            {
                
// allow camp per ratio of players on player's team to players on other team
                
if (!allowTeamCamp[TEAM1]) allowTeamCamp[TEAM1] = allowCampValue >= percent(playerCnt_team1playerCnt_team2);
                if (!
allowTeamCamp[TEAM2]) allowTeamCamp[TEAM2] = allowCampValue >= percent(playerCnt_team2playerCnt_team1);
            }
            else
            {
                
// allow camp per straight player count
                
if (!allowTeamCamp[TEAM1]) allowTeamCamp[TEAM1] = (allowCampValue >= playerCnt_team1);
                if (!
allowTeamCamp[TEAM2]) allowTeamCamp[TEAM2] = (allowCampValue >= playerCnt_team2);
            }
        }
    }

    
/* handle each player's camping needs */
    
new stdDevcampTolerance;
    new 
prevMeterbool:punishCamperFloat:punishPercentage;
    new 
announceCampStatus get_pcvar_num(g_cvarAnnounce);

    
get_players(playersplayerCnt"ah");    // skip dead players and hltv
    
for (new playerIdx 0playerIdx playerCnt; ++playerIdx)
    {
        
id players[playerIdx];
        
        
// 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(idCOORDTYPE_BODY);
        
        
// ignore the meter if the player can legally camp or the player's meter is being ignored
        
teamID get_user_team(id);
        if (
allowTeamCamp[teamID] || g_playerFlags[id] & METER_IGNORE) continue;

        
// ignore if this player meets the immunity requirements
        
if (has_flag(idg_immunityFlags))
        {
            
// insert the current coords of where the player's shot would hit, i.e. where the player is looking
            
coords_insert(idCOORDTYPE_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 || 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] += (campTolerancestdDev) / get_pcvar_num(g_cvarLimit);

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

        
// 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]-= (prevMeterg_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_ANNOUNCEDcamper_announcement(idfalse);
                }
            }
        }

        
// 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] >= 90punishPercentage 0.50;
        else if (
g_meter[id] >= 80punishPercentage 0.10;
        else 
punishCamper false;
        
        
// punish the vile camper
        
if (punishCamper)
        {
            if (
punishmentFlags PUNISH_SLAP)     punish_slap(idpunishPercentage);
            if (
punishmentFlags PUNISH_HEALTHpunish_health_reduction(idpunishPercentage);
            if (
punishmentFlags PUNISH_BLIND)  punish_blind(idpunishPercentage);
            if (
punishmentFlags PUNISH_SOUND)  punish_sound(idpunishPercentage);
            if (
punishmentFlags PUNISH_MONEY)  punish_money_reduction(idpunishPercentage);
            if (
punishmentFlags PUNISH_SNARKSpunish_snark_attack(idpunishPercentage);

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

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

__________________

Last edited by kramesa; 12-07-2011 at 10:25.
kramesa is offline
 


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

Forum Jump


All times are GMT -4. The time now is 12:01.


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