mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-08 05:33:21 +00:00
Change debug prints
This commit is contained in:
parent
5449bc53b7
commit
1833775bb7
2 changed files with 9 additions and 4 deletions
Binary file not shown.
|
@ -138,7 +138,7 @@ stock bool IsActivationAllowed(float flowmax, float threshold) {
|
||||||
for(int i = 1; i <= MaxClients; i++) {
|
for(int i = 1; i <= MaxClients; i++) {
|
||||||
if(IsClientConnected(i) && IsClientInGame(i) && GetClientTeam(i) == 2 && IsPlayerAlive(i)) {
|
if(IsClientConnected(i) && IsClientInGame(i) && GetClientTeam(i) == 2 && IsPlayerAlive(i)) {
|
||||||
if(flowRate[i] < flowmax - threshold) {
|
if(flowRate[i] < flowmax - threshold) {
|
||||||
PrintDebug("Adding %N of flow %f to average", i, flowRate[i]);
|
PrintDebug("Adding %N with flow of %.2f to far survivors average", i, flowRate[i]);
|
||||||
farSurvivors++;
|
farSurvivors++;
|
||||||
totalFlow += flowRate[i];
|
totalFlow += flowRate[i];
|
||||||
}
|
}
|
||||||
|
@ -149,11 +149,16 @@ stock bool IsActivationAllowed(float flowmax, float threshold) {
|
||||||
float average = totalFlow / farSurvivors;
|
float average = totalFlow / farSurvivors;
|
||||||
float percentFar = float(farSurvivors) / float(totalSurvivors);
|
float percentFar = float(farSurvivors) / float(totalSurvivors);
|
||||||
|
|
||||||
PrintDebug("average %f - difference %f - % far %f%% ", average, flowmax - average, percentFar);
|
PrintDebug("Average Flow %f - Difference %f - Far % %f%% ", average, flowmax - average, percentFar * 100);
|
||||||
//If the average is in the range, allow
|
//If the average is in the range, allow
|
||||||
if(flowmax - average <= threshold) return true;
|
if(flowmax - average <= threshold) {
|
||||||
|
PrintDebug("Activation is allowed (in range)");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
//If not, check the ratio of players
|
//If not, check the ratio of players
|
||||||
return percentFar <= 0.30;
|
bool isAllowed = percentFar <= 0.30;
|
||||||
|
PrintDebug("Activation is %s", isAllowed ? "allowed" : "blocked");
|
||||||
|
return isAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
stock float GetAverageFlowBehind(float flowmax) {
|
stock float GetAverageFlowBehind(float flowmax) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue