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(players, playerCnt, "ch"); // don't include bots or hltv if (playerCnt == 1 && !(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_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 TEAM1 and TEAM2 new playerCnt_team1, playerCnt_team2, teamID, id;
get_players(players, playerCnt, "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(players, playerCnt, "ah"); // skip dead players and hltv for (new playerIdx = 0; playerIdx < 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_team1, playerCnt_team2); if (!allowTeamCamp[TEAM2]) allowTeamCamp[TEAM2] = allowCampValue >= percent(playerCnt_team2, playerCnt_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 stdDev, campTolerance; new prevMeter, bool:punishCamper, Float:punishPercentage; new announceCampStatus = get_pcvar_num(g_cvarAnnounce);
get_players(players, playerCnt, "ah"); // skip dead players and hltv for (new playerIdx = 0; playerIdx < 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(id, COORDTYPE_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(id, g_immunityFlags)) { // 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 || 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) punish_health_reduction(id, 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); } }
|