AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Error CSTRIKE (https://forums.alliedmods.net/showthread.php?t=173578)

kramesa 12-07-2011 10:20

Error CSTRIKE
 
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);
    }



Devil259 12-07-2011 10:21

Re: Error CSTRIKE
 
Code:

[AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).

kramesa 12-07-2011 10:33

Re: Error CSTRIKE
 
Ok! But dont works the plugin only for CTs... This is Bad Camper

Devil259 12-07-2011 10:48

Re: Error CSTRIKE
 
function check_camping has no index. You have to loop throught all players and get his team.

kramesa 12-07-2011 11:03

Re: Error CSTRIKE
 
Quote:

Originally Posted by Devil259 (Post 1609198)
function check_camping has no index. You have to loop throught all players and get his team.

Can you make for me?

Devil259 12-07-2011 11:19

Re: Error CSTRIKE
 
Code:
/* don't check, if there is only one player on server */ new players[32], playerCnt, id get_players(players, playerCnt, "ch");    // don't include bots or hltv for( new i = 0; i < playerCnt; i++ ) {     id = players[ i ]     if( cs_get_user_team( id ) == CS_TEAM_T ) return; }

kramesa 12-07-2011 11:33

Re: Error CSTRIKE
 
Code:

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

a.sma(205) : error 001: expected token: ";", but found "-identifier-"
a.sma(210) : error 001: expected token: ";", but found "if"
a.sma(226) : error 021: symbol already defined: "id"
a.sma(386) : warning 217: loose indentation
a.sma(393) : warning 217: loose indentation
a.sma(466) : warning 217: loose indentation
a.sma(505) : warning 217: loose indentation
a.sma(827) : warning 204: symbol is assigned a value that is never used: "g_cvarDebug"

3 Errors.
Could not locate output file a.amx (compile failed).


ERROR: Your plugin failed to compile, see above.


fysiks 12-07-2011 20:46

Re: Error CSTRIKE
 
Perhaps you need to find a dictionary to find out what "full code" means. You've been here long enough to know what you post so just do it already. Help us help you.

Post the plugin as an attachment.


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

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