summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornavewindre <nw@moneybot.cc>2023-11-21 08:27:13 +0100
committernavewindre <nw@moneybot.cc>2023-11-21 08:27:13 +0100
commit8fa5a23370c82437eb3cfcadf62fb05a43846ac6 (patch)
tree37c1566f9ac88f664ca84446f0a618ee42d5b764
parent5484eec6124316381391695d8d06fc78d12cf3ce (diff)
big (huge)
-rw-r--r--cfg/server.cfg156
-rw-r--r--sourcemod-1.5-dev/scripting/ljstats.sp112
-rw-r--r--sourcemod/scripting/bot2player_public.sp8
-rw-r--r--sourcemod/scripting/game_manager.sp379
4 files changed, 486 insertions, 169 deletions
diff --git a/cfg/server.cfg b/cfg/server.cfg
new file mode 100644
index 0000000..f40642a
--- /dev/null
+++ b/cfg/server.cfg
@@ -0,0 +1,156 @@
+// dodbits SRCDS Counter-Strike:Source cfg file generator Ver 1.
+// Original php code by antipatrul (slideR). Translated and updated for orangebox by INsane August 2012
+
+// General server name, passwords and contact details
+hostname "=[ networkheaven.net ]= | no bhop cap | tournament maps"
+rcon_password "ad1dasw4re"
+sv_password ""
+sv_contact ""
+sv_tags "vanilla, networkheaven, nuke, inferno, dust2, tuscan, cbble, cpl_strike, mirage"
+sv_region "0"
+sv_lan "0"
+
+// Server bans and server logs
+sv_rcon_banpenalty "15"
+sv_rcon_minfailures "5"
+sv_rcon_maxfailures "10"
+sv_rcon_minfailuretime "30"
+sv_rcon_maxpacketsize "1024"
+sv_rcon_maxpacketbans "1"
+log "on"
+sv_logbans "1"
+sv_logecho "1"
+sv_logfile "1"
+sv_log_onefile "0"
+mp_logdetail "3"
+
+// Server downloads and files
+// No fast download maximum file size. 16 is def. 64 (max) recommended if you do not have a fast download server.
+net_maxfilesize "64"
+//Fast download url. Leave blank if you dont have one but set the above to max.
+sv_downloadurl "https://networkheaven.net/fastdl/"
+sv_allowdownload "1"
+sv_allowupload "1"
+sv_consistency "1"
+sv_pure "1"
+sv_pure_kick_clients "1"
+sv_pure_trace "1"
+
+
+// Bandwidth Rates
+sv_maxrate "100000"
+sv_minrate "7500"
+sv_maxupdaterate "66"
+sv_minupdaterate "30"
+sv_maxcmdrate "66"
+sv_mincmdrate "30"
+
+// General server settings
+mp_friendlyfire "0"
+sv_alltalk "1"
+mp_chattime "10"
+sv_use_steam_voice "1"
+sv_allow_voice_from_file "0"
+sv_voiceenable "1"
+mp_allowspectators "1"
+mp_timelimit "120"
+decalfrequency "10"
+mp_flashlight "1"
+mp_footsteps "1"
+sv_footsteps "1"
+mp_autoteambalance "1"
+mp_autokick "1"
+mp_tkpunish "0"
+mp_limitteams "2"
+sv_restrict_aspect_ratio_fov "0"
+mp_forcecamera "1"
+sv_cheats "0"
+sv_pausable "0"
+sv_gravity "800"
+sv_allow_wait_command "0"
+sv_hudhint_sound "0"
+mp_winlimit "0"
+mp_forceautoteam "0"
+mp_falldamage "1"
+mp_fadetoblack "0"
+bot_defer_to_human "0"
+bot_allow_rogues "0"
+
+
+//Round specific cvars
+mp_roundtime "2"
+mp_spawnprotectiontime "5"
+mp_freezetime "6"
+
+sv_allowminmodels "1"
+mp_hostagepenalty "13"
+sv_enablebunnyhopping "1"
+sv_competitive_minspec "1"
+sv_legacy_grenade_damage "0"
+sv_enableboost "1"
+mp_c4timer "45"
+mp_startmoney "800"
+mp_buytime "0.5"
+
+bot2player_enabled "1"
+bot2player_price "0"
+bot2player_increase "0"
+
+bot_quota 10
+bot_quota_mode fill
+bot_chatter off
+
+// Achievements, Statistics, Freeze Cam, Nemesis and MVP
+//(Note ONLY found in CSS)
+sv_nomvp "0"
+sv_disablefreezecam "0"
+sv_nonemesis "0"
+sv_nowinpanel "0"
+sv_nostats "0"
+
+// Execute ban files
+exec banned_user.cfg
+exec banned_ip.cfg
+writeid
+writeip
+
+ljstats_lj_min 245
+ljstats_lj_max 260
+ljstats_nonlj_max 260
+ljstats_lj_noduck_min 242
+ljstats_verbosity 2
+ljstats_bj_min 250
+ljstats_bj_max 265
+ljstats_color_max "FF00FF"
+
+ljstats_lj_sound1 245
+ljstats_lj_sound2 250
+ljstats_lj_sound3 255
+ljstats_lj_sound4 260
+
+ljstats_bj_sound1 250
+ljstats_bj_sound2 255
+ljstats_bj_sound3 260
+ljstats_bj_sound4 265
+
+ljstats_lj_sound1_file "quake/standard/impressive.wav"
+ljstats_lj_sound2_file "quake/standard/perfect.mp3"
+ljstats_lj_sound3_file "quake/standard/godlike.mp3"
+ljstats_lj_sound4_file "quake/standard/ownage.mp3"
+
+ljstats_lj_sound1_to_all 0
+ljstats_lj_sound2_to_all 0
+ljstats_lj_sound3_to_all 0
+ljstats_lj_sound4_to_all 1
+
+sm_speedometer_method -1
+sm_speedometer_area 1
+sm_speedometer_fastest 0
+
+tv_enable 1
+
+exec movement_css.cfg
+exec mr30.cfg
+
+nh_warmup 60
+nh_teamlimit 5 \ No newline at end of file
diff --git a/sourcemod-1.5-dev/scripting/ljstats.sp b/sourcemod-1.5-dev/scripting/ljstats.sp
index 7ede154..30df4ee 100644
--- a/sourcemod-1.5-dev/scripting/ljstats.sp
+++ b/sourcemod-1.5-dev/scripting/ljstats.sp
@@ -943,6 +943,8 @@ public OnClientPutInServer(client)
//#endif
g_PlayerStates[client][nVerbosity] = g_nVerbosity;
*/
+
+ g_PlayerStates[client][bLJEnabled] = true;
g_PlayerStates[client][bOnGround] = true;
g_PlayerStates[client][fBlockDistance] = -1.0;
g_PlayerStates[client][IllegalJumpFlags] = IJF_NONE;
@@ -1042,18 +1044,14 @@ public OnClientCookiesCached(client)
if(StringToInt(strCookie) == 0)
{
- #if defined LJSERV
SetCookie(client, g_hCookieLJEnabled, true);
- SetCookie(client, g_hCookieBlockMode, true);
- #endif
-
SetCookie(client, g_hCookieSound, g_bLJSound);
SetCookie(client, g_hCookieShowBhopStats, g_bShowBhopStats);
SetCookie(client, g_hCookieVerbosity, g_nVerbosity);
- SetCookie(client, g_hCookieShowAllJumps, false);
+ SetCookie(client, g_hCookieShowAllJumps, true);
#if defined LJSERV
SetCookie(client, g_hCookieShowPrestrafeHint, true);
@@ -3085,60 +3083,7 @@ PlayerLand(client)
decl String:buf[1024];
g_PlayerStates[client][strHUDHint][0] = 0;
-
- if(g_PlayerStates[client][bBlockMode])
- {
- if(g_PlayerStates[client][fBlockDistance] != -1.0)
- {
- Format(buf, sizeof(buf), "%.1f block %s\n",
- g_PlayerStates[client][fBlockDistance],
- g_PlayerStates[client][bFailedBlock] ? "(failed)" : "");
-
- StrCat(g_PlayerStates[client][strHUDHint], HUD_HINT_SIZE, buf);
- }
- else
- {
- Format(buf, sizeof(buf), "??? block %s\n",
- g_PlayerStates[client][bFailedBlock] ? "(failed) " : "");
-
- StrCat(g_PlayerStates[client][strHUDHint], HUD_HINT_SIZE, buf);
- }
-
- if(g_PlayerStates[client][fBlockDistance] != -1.0 && g_PlayerStates[client][vBlockNormal][0] != 0.0 && g_PlayerStates[client][vBlockNormal][1] != 0.0 && g_PlayerStates[client][nVerbosity] > 2)
- {
- new Float:f = 32.0 * (FloatAbs(g_PlayerStates[client][vBlockNormal][0]) + FloatAbs(g_PlayerStates[client][vBlockNormal][1]) - 1.0);
- new Float:fAngle = FloatAbs(RadToDeg(ArcSine(g_PlayerStates[client][vBlockNormal][0])));
- fAngle = fAngle <= 45.0 ? fAngle : 90 - fAngle;
-
- Format(buf, sizeof(buf), "(%.1f rotated by %.1fÂș)\n",
- g_PlayerStates[client][fBlockDistance] + f,
- fAngle);
-
- StrCat(g_PlayerStates[client][strHUDHint], HUD_HINT_SIZE, buf);
- }
-
- if(g_PlayerStates[client][fBlockDistance] != -1.0 && g_PlayerStates[client][nVerbosity] > 1)
- {
- new Float:vJumpAngle[3], Float:vJumpOrig[3], Float:vBlockN[3];
-
- vJumpAngle = vCurOrigin;
- Array_Copy(g_PlayerStates[client][vJumpOrigin], vJumpOrig, 3);
-
- vBlockN[0] = g_PlayerStates[client][vBlockNormal][0];
- vBlockN[1] = g_PlayerStates[client][vBlockNormal][1];
-
- vJumpAngle[2] = 0.0;
- vJumpOrig[2] = 0.0;
-
- SubtractVectors(vJumpAngle, vJumpOrig, vJumpAngle);
- NormalizeVector(vJumpAngle, vJumpAngle);
-
- Format(buf, sizeof(buf), "%.2f degrees off block\n",
- RadToDeg(ArcCosine(GetVectorDotProduct(vJumpAngle, vBlockN))));
-
- StrCat(g_PlayerStates[client][strHUDHint], HUD_HINT_SIZE, buf);
- }
- }
+
decl String:strJump[32];
@@ -3230,54 +3175,7 @@ PlayerLand(client)
buf[0] = 0;
Append(buf, sizeof(buf), "\n");
-
- if(g_PlayerStates[client][bBlockMode])
- {
- if(g_PlayerStates[client][fBlockDistance] != -1.0)
- {
- Append(buf, sizeof(buf), "%.01f block%s",
- g_PlayerStates[client][fBlockDistance],
- g_PlayerStates[client][bFailedBlock] ? " (failed)" : "");
- }
- else
- {
- Append(buf, sizeof(buf), "??? block%s",
- g_PlayerStates[client][bFailedBlock] ? " (failed)" : "");
- }
-
- if(g_PlayerStates[client][fBlockDistance] != -1.0 && g_PlayerStates[client][vBlockNormal][0] != 0.0 && g_PlayerStates[client][vBlockNormal][1] != 0.0)
- {
- new Float:f = 32.0 * (FloatAbs(g_PlayerStates[client][vBlockNormal][0]) + FloatAbs(g_PlayerStates[client][vBlockNormal][1]) - 1.0);
- new Float:fAngle = FloatAbs(RadToDeg(ArcSine(g_PlayerStates[client][vBlockNormal][0])));
- fAngle = fAngle <= 45.0 ? fAngle : 90 - fAngle;
-
- Append(buf, sizeof(buf), " (%.1f rotated by %.1f)",
- g_PlayerStates[client][fBlockDistance] + f,
- fAngle);
- }
-
- if(g_PlayerStates[client][fBlockDistance] != -1.0)
- {
- new Float:vJumpAngle[3], Float:vJumpOrig[3], Float:vBlockN[3];
-
- vJumpAngle = vCurOrigin;
- Array_Copy(g_PlayerStates[client][vJumpOrigin], vJumpOrig, 3);
-
- vBlockN[0] = g_PlayerStates[client][vBlockNormal][0];
- vBlockN[1] = g_PlayerStates[client][vBlockNormal][1];
-
- vJumpAngle[2] = 0.0;
- vJumpOrig[2] = 0.0;
-
- SubtractVectors(vJumpAngle, vJumpOrig, vJumpAngle);
- NormalizeVector(vJumpAngle, vJumpAngle);
-
- Append(buf, sizeof(buf), " - %.2f degrees off block",
- RadToDeg(ArcCosine(GetVectorDotProduct(vJumpAngle, vBlockN))));
- }
-
- Append(buf, sizeof(buf), "\n");
- }
+
Append(buf, sizeof(buf), "%s%s%s\nDistance: %.2f",
strJump, strJumpDir,
diff --git a/sourcemod/scripting/bot2player_public.sp b/sourcemod/scripting/bot2player_public.sp
index c646c84..a295d92 100644
--- a/sourcemod/scripting/bot2player_public.sp
+++ b/sourcemod/scripting/bot2player_public.sp
@@ -450,10 +450,10 @@ public Action:Give_iTargetWeaponsTo_iClient(Handle:timer, any:iClient)
}
Client_SetActiveWeapon(iClient, iTargetActiveWeapon)
}
- if (Nades[iClient][0] > 0) Client_GiveWeapon(iClient, "weapon_hegrenade", false)
- if (Nades[iClient][1] > 0) Client_GiveWeapon(iClient, "weapon_flashbang", false)
- if (Nades[iClient][1] > 1) Client_GiveWeapon(iClient, "weapon_flashbang", false)
- if (Nades[iClient][2] > 0) Client_GiveWeapon(iClient, "weapon_smokegrenade", false)
+ if (Nades[iClient][0] > 0) GivePlayerItem(iClient, "weapon_hegrenade")
+ if (Nades[iClient][1] > 0) GivePlayerItem(iClient, "weapon_flashbang")
+ if (Nades[iClient][1] > 1) GivePlayerItem(iClient, "weapon_flashbang")
+ if (Nades[iClient][2] > 0) GivePlayerItem(iClient, "weapon_smokegrenade")
}
public cvar_b2p_enabledChange(Handle:convar, const String:oldValue[], const String:newValue[])
{
diff --git a/sourcemod/scripting/game_manager.sp b/sourcemod/scripting/game_manager.sp
index ec6d198..90c83e9 100644
--- a/sourcemod/scripting/game_manager.sp
+++ b/sourcemod/scripting/game_manager.sp
@@ -23,9 +23,17 @@ new g_roundCount;
new bool:halftime;
new Handle:g_h_mp_startmoney = INVALID_HANDLE;
new Handle:g_h_mp_maxrounds = INVALID_HANDLE;
+new Handle:g_h_mp_buytime = INVALID_HANDLE;
+new Handle:g_h_nh_warmup = INVALID_HANDLE;
+new Handle:g_h_nh_teamlimit = INVALID_HANDLE;
+new Handle:g_h_mp_ignoreconditions = INVALID_HANDLE;
new g_mp_startmoney;
new bool:g_doReset = false;
new g_CtScore, g_TScore;
+new Handle:g_h_roundExtentTimer = INVALID_HANDLE;
+new Handle:g_h_execServerCfgTimer = INVALID_HANDLE;
+new Float:g_buytime = 0.5;
+new g_lastDmMode = 0;
/* forwards */
new Handle:g_f_on_ht = INVALID_HANDLE;
@@ -34,29 +42,42 @@ new Handle:g_f_on_ht = INVALID_HANDLE;
new g_iAccount = -1;
-// Setting halftime to false
public OnMapStart(){
halftime = false;
g_roundCount = 0;
- g_mp_startmoney = GetConVarInt(g_h_mp_startmoney);
- g_maxrounds = GetConVarInt(g_h_mp_maxrounds);
+ g_mp_startmoney = GetConVarInt( g_h_mp_startmoney );
+ g_maxrounds = GetConVarInt( g_h_mp_maxrounds );
+ g_buytime = GetConVarFloat( g_h_mp_buytime );
+
+ g_lastDmMode = 0;
+ OnDmModeChanged( g_h_nh_warmup, "", "" );
}
-public OnConfigsExecuted(){
+public OnConfigsExecuted() {
halftime = false;
}
-// Hooking events at plugin start
public OnPluginStart() {
HookEvent("round_start", Event_RoundStart);
HookEvent("round_end", Event_RoundEnd);
HookEvent("player_death", Event_PlayerDeath);
+ HookEvent("player_spawn", Event_PlayerSpawn);
+ HookEvent("player_team", Event_PlayerTeam);
+ AddCommandListener( Listener_JoinTeam, "jointeam" );
- g_h_mp_startmoney = FindConVar("mp_startmoney");
- g_h_mp_maxrounds = FindConVar("mp_maxrounds");
+ g_h_mp_startmoney = FindConVar( "mp_startmoney" );
+ g_h_mp_maxrounds = FindConVar( "mp_maxrounds" );
+ g_h_mp_buytime = FindConVar( "mp_buytime");
+ g_h_mp_ignoreconditions = FindConVar( "mp_ignore_round_win_conditions" );
+ g_h_nh_warmup = CreateConVar( "nh_warmup", "0", "set warmup time. -1 for infinite.", 0 );
+ g_h_nh_teamlimit = CreateConVar( "nh_teamlimit", "5", "player limit per team", 0 );
+ if( g_h_nh_warmup != INVALID_HANDLE ) {
+ HookConVarChange( g_h_nh_warmup, OnDmModeChanged );
+ }
+
+ g_f_on_ht = CreateGlobalForward( "nthvnHalftime", ET_Ignore );
- g_f_on_ht = CreateGlobalForward("nthvnHalftime", ET_Ignore);
// Finding offset for CS cash
g_iAccount = FindSendPropOffs("CCSPlayer", "m_iAccount");
@@ -64,8 +85,241 @@ public OnPluginStart() {
SetFailState("m_iAccount offset not found");
}
-public Event_PlayerDeath( Handle:event, const String:name[], bool dontBroadcast ) {
+public OnDmModeChanged( Handle:cvar, const String:oldVal[], const String:newVal[]) {
+ new dm = GetConVarInt( cvar );
+
+ if( !!dm != !!g_lastDmMode ) {
+ SetConVarInt( g_h_mp_ignoreconditions, dm );
+ for( new i = 1; i < MaxClients; ++i ) {
+ if( IsClientConnected( i ) && IsClientInGame( i ) )
+ ForcePlayerSuicide( i );
+ }
+
+ ServerCommand( "mp_restartgame 1" );
+
+ g_CtScore = g_TScore = g_roundCount = 0;
+ SetTeamScore( CS_TEAM_CT, g_CtScore );
+ SetTeamScore( CS_TEAM_T, g_TScore );
+ }
+
+ if( !dm ) {
+ SetConVarFloat( g_h_mp_buytime, g_buytime );
+ if( g_h_roundExtentTimer ) {
+ KillTimer( g_h_roundExtentTimer );
+ g_h_roundExtentTimer = INVALID_HANDLE;
+ }
+
+ PrintToChatAll( "\x04===========[ game live ]===========" );
+ }
+ else {
+ if( g_h_roundExtentTimer == INVALID_HANDLE ) {
+ g_buytime = GetConVarFloat( g_h_mp_buytime );
+ g_h_roundExtentTimer = CreateTimer( 1.0, WarmupTimer, 0, TIMER_REPEAT );
+ SetConVarFloat( g_h_mp_buytime, 420.0 );
+ }
+ }
+
+ g_lastDmMode = dm;
+}
+
+public Action:WarmupTimer( Handle:timer, any:userid ) {
+ new dm = GetConVarInt( g_h_nh_warmup );
+ if( dm > 0 ) {
+ if( dm <= 5 ) {
+ PrintToChatAll( "\x04========[ warmup ending in %d ]========", dm );
+ }
+
+ SetConVarInt( g_h_nh_warmup, dm - 1 );
+ }
+
+ new time = GameRules_GetProp( "m_iRoundTime" );
+ if( time < 420 * 60 )
+ time = 420 * 60 + 1;
+ GameRules_SetProp( "m_iRoundTime", time + 1, 4, 0, true );
+
+ new String:name[65];
+ for( new i = 1; i < GetMaxEntities(); ++i ) {
+ if( !IsValidEdict(i) || !IsValidEntity(i) )
+ continue;
+
+ if( i < MaxClients && IsClientConnected( i ) && IsClientInGame( i ) ) {
+ if( dm > 0 ) {
+ new secs = dm % 60;
+ new mins = (dm - secs) / 60;
+ PrintHintText( i, "---[ WARMUP %d:%02d ]---", mins, secs );
+ }
+ else {
+ PrintHintText( i, "---[ WARMUP ]---" );
+ }
+
+ continue;
+ }
+
+ GetEdictClassname( i, name, sizeof(name) );
+ if( StrContains( name, "weapon_c4" ) != -1 ) {
+ RemoveEdict( i );
+ }
+ }
+}
+
+public OnClientPutInServer( client ) {
+ if( g_h_execServerCfgTimer != INVALID_HANDLE ) {
+ KillTimer( g_h_execServerCfgTimer );
+ g_h_execServerCfgTimer = INVALID_HANDLE;
+ }
+
+ SDKHook( client, SDKHook_PostThinkPost, Hook_PostThinkPost );
+}
+
+
+public Hook_PostThinkPost( entity ) {
+ new dm = GetConVarInt( g_h_nh_warmup );
+
+ if( dm )
+ SetEntProp( entity, Prop_Send, "m_bInBuyZone", 1 );
+}
+
+public OnClientDisconnect( client ) {
+ if( IsFakeClient( client ) )
+ return;
+
+ for( new i = 1; i < MaxClients; ++i ) {
+ if( i == client )
+ continue;
+ if( IsClientConnected( i ) && IsClientInGame( i ) && !IsFakeClient( i ) )
+ return;
+ }
+
+ SetConVarInt( g_h_nh_warmup, 0 );
+ if( g_h_execServerCfgTimer != INVALID_HANDLE )
+ KillTimer( g_h_execServerCfgTimer );
+
+ g_h_execServerCfgTimer = CreateTimer( 30.0, ExecServerCfg, _ );
+}
+
+public Action:ExecServerCfg( Handle:timer, any:unused ) {
+ ServerCommand( "exec server.cfg" );
+ g_h_execServerCfgTimer = INVALID_HANDLE;
+}
+
+public Event_PlayerSpawn( Handle:event, const String:name[], bool dontBroadcast ) {
+ new dmmode = GetConVarInt( g_h_nh_warmup );
+ new uid = GetEventInt( event, "userid" );
+ new id = GetClientOfUserId( uid );
+
+ if( dmmode )
+ SetEntData( id, g_iAccount, 16000, 4, true );
+}
+
+public Event_PlayerDeath( Handle:event, const String:name[], bool dontBroadcast ) {
CreateTimer( 0.15, OneChance, 0 );
+ CreateTimer( 1.5, RespawnPlayerDeathmatch, GetEventInt( event, "userid" ) );
+}
+
+public Action:RespawnPlayerDeathmatch( Handle:timer, any:userid ) {
+ new dmmode = GetConVarInt( g_h_nh_warmup );
+ if( !dmmode )
+ return;
+
+ new id = GetClientOfUserId( userid );
+ if( !id )
+ return;
+ CS_RespawnPlayer( id );
+}
+
+public VerifyTeamCounts() {
+ new entToKickT = 0;
+ new entToKickCT = 0;
+ new countCT = 0;
+ new countT = 0;
+ new maxTeam = GetConVarInt( g_h_nh_teamlimit );
+
+ for( new i = 1; i < MaxClients; ++i ) {
+ if( !IsClientConnected( i ) || !IsClientInGame( i ) )
+ continue;
+
+
+ new playerTeam = GetClientTeam(i);
+ if( playerTeam == CS_TEAM_T ) {
+ ++countT;
+ if( IsFakeClient( i ) && (!entToKickCT || !IsPlayerAlive( i )) ) {
+ entToKickT = i;
+ }
+ }
+ if( playerTeam == CS_TEAM_CT ) {
+ ++countCT;
+ if( IsFakeClient( i ) && (!entToKickCT || !IsPlayerAlive( i )) ) {
+ entToKickCT = i;
+ }
+ }
+ }
+
+ if( countCT > maxTeam && entToKickCT ) {
+ KickClient( entToKickCT, "kicked for game balance" );
+ }
+ if( countT > maxTeam && entToKickT ) {
+ KickClient( entToKickT, "kicked for game balance" );
+ }
+}
+
+public bool:CanJoinTeam( id, oldTeam, newTeam ) {
+ new countT = 0;
+ new countCT = 0;
+ new maxTeam = GetConVarInt( g_h_nh_teamlimit );
+
+ for( new i = 1; i < MaxClients; ++i ) {
+ if( i == id )
+ continue;
+ if( !IsClientConnected( i ) || !IsClientInGame( i ) || IsFakeClient( i ) )
+ continue;
+
+ new playerTeam = GetClientTeam(i);
+ if( playerTeam == CS_TEAM_T )
+ ++countT;
+ if( playerTeam == CS_TEAM_CT )
+ ++countCT;
+ }
+
+ if( (newTeam == CS_TEAM_T && countT >= maxTeam)
+ || (newTeam == CS_TEAM_CT && countCT >= maxTeam)
+ ) {
+ return false;
+ }
+
+ return true;
+}
+
+public Action:Listener_JoinTeam( id, const String: command[], args ) {
+ new String:sArg1[3];
+ GetCmdArg(1, sArg1, sizeof(sArg1));
+ new newTeam = StringToInt(sArg1);
+ new oldTeam = GetClientTeam( id );
+
+ if( !CanJoinTeam( id, oldTeam, newTeam ) ) {
+ ChangeClientTeam( id, oldTeam );
+ PrintHintText( id, "team is full" );
+ return Plugin_Handled;
+ }
+
+ VerifyTeamCounts();
+ return Plugin_Continue;
+}
+
+public Action:Event_PlayerTeam( Handle:event, const String:name[], bool dontBroadcast ) {
+ new uid = GetEventInt( event, "userid" );
+ new id = GetClientOfUserId( uid );
+ new oldTeam = GetEventInt( event, "oldteam" );
+ new newTeam = GetEventInt( event, "team" );
+
+ if( !CanJoinTeam( id, oldTeam, newTeam ) ) {
+ PrintCenterText( id, "team is full" );
+ SetEventBroadcast( event, true );
+
+ return Plugin_Handled;
+ }
+
+ VerifyTeamCounts();
+ return Plugin_Continue;
}
public Action:OneChance(Handle:timer, any:unused) {
@@ -74,6 +328,10 @@ public Action:OneChance(Handle:timer, any:unused) {
if( g_oneChanceDone )
return;
+
+ new dm = GetConVarInt( g_h_nh_warmup );
+ if( dm )
+ return;
new ctAlive = 0;
new tAlive = 0;
@@ -107,27 +365,24 @@ public Action:OneChance(Handle:timer, any:unused) {
new clutcher = clutcherT ? clutcherT : clutcherCT;
decl String:clutcherName[64];
- GetClientName(clutcher, clutcherName, sizeof(clutcherName));
+ GetClientName( clutcher, clutcherName, sizeof(clutcherName) );
PrintToChatAll( "\x01%s \x04has one chance, one opportunity. will they seize it, or will they let it slip?", clutcherName );
Client_RemoveAllWeapons( clutcher );
- Client_GiveWeapon( clutcher, "weapon_knife", true);
- Client_GiveWeapon( clutcher, "weapon_awp", false);
- Client_GiveWeapon( clutcher, "weapon_deagle", false);
- GivePlayerItem( clutcher, "weapon_flashbang");
- GivePlayerItem( clutcher, "weapon_flashbang");
-
- SetEntityHealth( clutcher, 100);
- Client_SetArmor( clutcher, 100);
+ Client_GiveWeapon( clutcher, "weapon_awp", false );
+ Client_GiveWeapon( clutcher, "weapon_deagle", false );
+ Client_GiveWeapon( clutcher, "weapon_knife", true );
+ GivePlayerItem( clutcher, "weapon_flashbang" );
+ GivePlayerItem( clutcher, "weapon_flashbang" );
+ GivePlayerItem( clutcher, "weapon_hegrenade" );
+
+ SetEntityHealth( clutcher, 100 );
+ Client_SetArmor( clutcher, 100 );
SetEntProp( clutcher, Prop_Send, "m_bHasHelmet", 1, 1);
g_oneChanceDone = true;
}
-// RoundStart gets the maptime
-// Checks to see if halftime has passed, if not then make sure halftime is 0
-// Setting halftime false here as well since in some occasions when extending map
-// team switch can occur again.
public Event_RoundStart( Handle:event, const String:name[], bool:dontBroadcast )
{
new wepIdx;
@@ -135,40 +390,55 @@ public Event_RoundStart( Handle:event, const String:name[], bool:dontBroadcast )
g_oneChanceDone = false;
- g_CtScore = GetTeamScore(CS_TEAM_CT);
- g_TScore = GetTeamScore(CS_TEAM_T);
-
- g_roundCount = g_CtScore + g_TScore + 1;
-
- if( g_doReset ) {
- for( new client = 1; client <= GetMaxClients(); client++ ) {
- if (IsClientInGame (client) && IsClientConnected(client)) {
- for( new w = 0; w < 6; w++ ) {
- if( w != 2 && w != 4 )
- while( ( wepIdx = GetPlayerWeaponSlot(client, w) ) != -1 )
- RemovePlayerItem(client, wepIdx);
- }
-
- playerTeam = GetClientTeam( client );
- if( playerTeam == CS_TEAM_T ) {
- GivePlayerItem( client, "weapon_glock" );
- }
- else if( playerTeam == CS_TEAM_CT ) {
- GivePlayerItem( client, "weapon_usp" );
- if ((wepIdx = GetPlayerWeaponSlot( client, 6 ) ) != -1)
- RemovePlayerItem(client, wepIdx);
- }
- SetEntProp(client, Prop_Send, "m_ArmorValue", 0, 1);
- SetEntProp(client, Prop_Send, "m_bHasHelmet", 0, 1);
-
- SetEntData(client, g_iAccount, g_mp_startmoney, 4, true);
+ g_CtScore = GetTeamScore( CS_TEAM_CT );
+ g_TScore = GetTeamScore( CS_TEAM_T );
+
+ new newRoundCount = g_CtScore = g_TScore + 1;
+ if( newRoundCount < g_roundCount ) {
+ halftime = false;
+ g_CtScore = 0;
+ g_TScore = 0;
+ g_roundCount = 0;
+ g_doReset = true;
+ }
+ else {
+ g_roundCount = newRoundCount;
+ }
+
+ for( new client = 1; client <= MaxClients; client++ ) {
+ if( !IsClientConnected( client ) || !IsClientInGame( client ) )
+ continue;
+
+ else if( g_doReset ) {
+ for( new w = 0; w < 6; w++ ) {
+ if( w != 2 && w != 4 )
+ while( ( wepIdx = GetPlayerWeaponSlot(client, w) ) != -1 )
+ RemovePlayerItem(client, wepIdx);
+ }
+
+ playerTeam = GetClientTeam( client );
+ if( playerTeam == CS_TEAM_T ) {
+ GivePlayerItem( client, "weapon_glock" );
+ }
+ else if( playerTeam == CS_TEAM_CT ) {
+ GivePlayerItem( client, "weapon_usp" );
+ if ((wepIdx = GetPlayerWeaponSlot( client, 6 ) ) != -1)
+ RemovePlayerItem(client, wepIdx);
}
+ SetEntProp(client, Prop_Send, "m_ArmorValue", 0, 1);
+ SetEntProp(client, Prop_Send, "m_bHasHelmet", 0, 1);
+
+ SetEntData(client, g_iAccount, g_mp_startmoney, 4, true);
}
}
+
g_doReset = false;
}
-public Event_RoundEnd (Handle:event, const String:name[], bool:dontBroadcast)
+public OnGameFrame() {
+}
+
+public Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
new reason = GetEventInt(event, "reason");
new winner = GetEventInt(event, "winner");
@@ -201,7 +471,6 @@ public Event_RoundEnd (Handle:event, const String:name[], bool:dontBroadcast)
}
}
- LogMessage( "roundEnd: ct: %d t: %d rounds: %d max: %d", g_CtScore, g_TScore, g_roundCount, g_maxrounds/2 );
if( halftime || g_roundCount < g_maxrounds/2 ) {
SetTeamScore( CS_TEAM_CT, g_CtScore );
SetTeamScore( CS_TEAM_T, g_TScore );
@@ -214,14 +483,8 @@ public Event_RoundEnd (Handle:event, const String:name[], bool:dontBroadcast)
Call_Finish();
halftime = true;
- for( new i = 1; i <= GetMaxClients(); i++ ) {
+ for( new i = 1; i <= MaxClients; i++ ) {
if( IsClientInGame( i ) && IsClientConnected( i ) ) {
-
- // kill bots
- if( IsFakeClient( i ) ) {
- ForcePlayerSuicide( i );
- }
-
g_doReset = true;
playerTeam = GetClientTeam(i);