summaryrefslogtreecommitdiff
path: root/sourcemod/scripting
diff options
context:
space:
mode:
Diffstat (limited to 'sourcemod/scripting')
-rw-r--r--sourcemod/scripting/css-kztimer.sp57
-rw-r--r--sourcemod/scripting/game_manager.sp4
2 files changed, 44 insertions, 17 deletions
diff --git a/sourcemod/scripting/css-kztimer.sp b/sourcemod/scripting/css-kztimer.sp
index 9a978ad..5070985 100644
--- a/sourcemod/scripting/css-kztimer.sp
+++ b/sourcemod/scripting/css-kztimer.sp
@@ -32,7 +32,7 @@ enum struct PlayerData {
int nTeleports;
bool bShowingMenu;
- bool bHideViewmodel;
+ bool bShowViewmodel;
float vStartPoint[3];
float vStartAngle[3];
@@ -85,6 +85,7 @@ public void OnPluginStart() {
RegConsoleCmd( "sm_viewmodel", Command_HideViewmodel, "Toggle viewmodel." );
RegConsoleCmd( "sm_vm", Command_HideViewmodel, "Toggle viewmodel." );
RegConsoleCmd( "sm_hideweapon", Command_HideViewmodel, "Toggle viewmodel." );
+ RegConsoleCmd( "sm_noclip", Command_Noclip, "Toggle noclip." );
HookEvent( "player_spawn", Event_PlayerSpawn, EventHookMode_Post );
HookEvent( "player_jump", Event_PlayerJump, EventHookMode_Post );
@@ -111,6 +112,7 @@ public void ClearPlayerData( int i ) {
g_playerData[i].bPausedRun = false;
g_playerData[i].bShowingMenu = false;
g_playerData[i].nDuckTicks = 0;
+ g_playerData[i].bShowViewmodel = true;
}
public void ClearAllPlayers() {
@@ -245,7 +247,7 @@ public void ClearRecords() {
}
public Action CommandTimer( Handle timer, any unused ) {
- ServerCommand( "bot_kick; bot_quota 0; nh_warmup 0; sv_airaccelerate 12; mp_falldamage 0; sv_enablebunnyhopping 1" );
+ ServerCommand( "bot_kick; bot_quota 0; nh_warmup 0; sv_airaccelerate 12; mp_falldamage 0; sv_enablebunnyhopping 1; mp_ignore_round_win_conditions 1" );
if( !g_nhWarmup )
g_nhWarmup = FindConVar( "nh_warmup" );
else
@@ -283,6 +285,14 @@ public void OnMapEnd() {
}
public void StartRun( int client ) {
+ MoveType mv = GetEntityMoveType( client );
+ if( mv == MOVETYPE_NOCLIP ) {
+ EmitSoundToClient( client, "buttons/button10.wav" );
+ CPrintToChat( client, "[{green}kz{default}] {red}You cannot use noclip during a run." );
+
+ return;
+ }
+
EmitSoundToClient( client, "buttons/button17.wav" );
CPrintToChat( client, "[{green}kz{default}] {white}run started." );
g_playerData[client].bIsInRun = true;
@@ -335,7 +345,6 @@ public void EndRun( int client ) {
char clientSteamId[32];
GetClientAuthId( client, AuthId_Engine, clientSteamId, sizeof(clientSteamId) );
for( int i = 0; i < g_topTime; i++ ) {
- PrintToChatAll( "%d : %s", i, g_times[i].sSteamid );
if( prevRunTime < 0 && !strcmp( clientSteamId, g_times[i].sSteamid ) ) {
prevRunTime = g_times[i].fFinalTime;
}
@@ -357,7 +366,7 @@ public void EndRun( int client ) {
} else {
Format( chatStr, sizeof(chatStr), "%s%d:%02d.%03d", chatStr, minutes, seconds, milliseconds );
}
-
+
if( prevRunTime > 0.0 ) {
float diff = prevRunTime - time;
float absDiff = FloatAbs( diff );
@@ -384,7 +393,6 @@ public void EndRun( int client ) {
);
}
- CPrintToChatAll( clientSteamId );
CPrintToChatAll( chatStr );
if( prevRunTime < 0.0 || time < prevRunTime ) {
@@ -732,7 +740,7 @@ public Action OnPlayerRunCmd(int client, int& buttons, int& impulse, float vel[3
SetEntityRenderMode( client, RENDER_TRANSCOLOR );
SetEntityRenderColor( client, 255, 255, 255, 100 );
- if( GetEntityMoveType( client ) == MOVETYPE_NOCLIP ) {
+ if( GetEntityMoveType( client ) == MOVETYPE_NOCLIP && g_playerData[client].bIsInRun ) {
g_playerData[client].bIsInRun = false;
CPrintToChat( client, "[{green}kz{default}] {red}You cannot use noclip during a run." );
EmitSoundToClient( client, "buttons/button10.wav" );
@@ -769,9 +777,13 @@ public Action Event_PlayerJump( Event e, const char[] name, bool dontBroadcast )
public Action OnTakeDamage( int client, int& attacker, int& inflictor, float& damage, int& damagetype ) {
if( !g_isKZ ) return Plugin_Continue;
- if( damagetype & DMG_FALL )
+ if( damagetype & DMG_FALL || damagetype & DMG_BULLET )
return Plugin_Handled;
+ if( attacker > 0 && attacker < MaxClients ) {
+ damage = 0.0;
+ }
+
return Plugin_Continue;
}
@@ -798,17 +810,15 @@ public Action Event_PlayerSpawn( Event e, const char[] name, bool dontBroadcast
char cookie[32];
g_hideWeaponCookie.Get( client, cookie, sizeof(cookie) );
- bool hide = !!StringToInt( cookie );
- g_playerData[client].bHideViewmodel = hide;
- SetEntProp( client, Prop_Send, "m_bDrawViewmodel", hide );
+ bool draw = !StringToInt( cookie );
+ g_playerData[client].bShowViewmodel = draw;
+ SetEntProp( client, Prop_Send, "m_bDrawViewmodel", draw );
}
return Plugin_Continue;
}
public int TopTimesMenuHandler( Menu menu, MenuAction ma, int client, int nItem ) {
- LogMessage( "TopTimesMenuHandler %d %d %d", client, ma, nItem );
-
if( ma == MenuAction_Cancel ) {
if( g_playerData[client].bShowingMenu ) {
ShowCheckpointMenu( client, g_isKZ );
@@ -838,7 +848,7 @@ public void ShowTopNubTimes( int client ) {
else
Format( buf, sizeof(buf), "%s%d:%02d.%03d", buf, minutes, seconds, milliseconds );
- Format( buf, sizeof(buf), "%s (%d TP, %d jumps)", buf, g_times[i].nJumps, g_times[i].nTeleports );
+ Format( buf, sizeof(buf), "%s (%d TP, %d jumps)", buf, g_times[i].nTeleports, g_times[i].nJumps );
menu.AddItem( "button", buf, ITEMDRAW_DISABLED );
}
@@ -865,6 +875,8 @@ public void ShowTopProTimes( int client ) {
Format( buf, sizeof(buf), "%s%d:%02d:%02d.%03d", buf, hours, minutes, seconds, milliseconds );
else
Format( buf, sizeof(buf), "%s%d:%02d.%03d", buf, minutes, seconds, milliseconds );
+ Format( buf, sizeof(buf), "%s (%d TP, %d jumps)", buf, g_times[i].nTeleports, g_times[i].nJumps );
+
menu.AddItem( "button", buf, ITEMDRAW_DISABLED );
++it;
@@ -947,11 +959,26 @@ public Action Command_HideViewmodel( int client, int args ) {
SetEntProp( client, Prop_Send, "m_bDrawViewmodel", !draw );
char cookieStr[32];
- IntToString( !draw, cookieStr, sizeof(cookieStr) );
+ IntToString( draw, cookieStr, sizeof(cookieStr) );
g_hideWeaponCookie.Set( client, cookieStr );
- g_playerData[client].bHideViewmodel = !draw;
+ g_playerData[client].bShowViewmodel = !draw;
CPrintToChat( client, "[{green}kz{default}] viewmodel is now %s", !draw ? "shown" : "hidden" );
return Plugin_Handled;
+}
+
+public Action Command_Noclip( int client, int args ) {
+ if( !g_isKZ ) return Plugin_Handled;
+
+ MoveType mv = GetEntityMoveType( client );
+ if( mv != MOVETYPE_NOCLIP ) {
+ SetEntityMoveType( client, MOVETYPE_NOCLIP );
+ CPrintToChat( client, "[{green}kz{default}] noclip enabled." );
+ } else {
+ SetEntityMoveType( client, MOVETYPE_WALK );
+ CPrintToChat( client, "[{green}kz{default}] noclip disabled." );
+ }
+
+ return Plugin_Handled;
} \ No newline at end of file
diff --git a/sourcemod/scripting/game_manager.sp b/sourcemod/scripting/game_manager.sp
index 7959880..f182205 100644
--- a/sourcemod/scripting/game_manager.sp
+++ b/sourcemod/scripting/game_manager.sp
@@ -414,7 +414,7 @@ public Event_PlayerDeath( Handle:event, const String:name[], bool dontBroadcast
public Action:RespawnPlayerDeathmatch( Handle:timer, any:userid ) {
new dmmode = GetConVarInt( g_h_nh_warmup );
- if( !dmmode )
+ if( !dmmode && !g_isKZ )
return;
new id = GetClientOfUserId( userid );
@@ -523,7 +523,7 @@ public Action:Event_PlayerTeam( Handle:event, const String:name[], bool dontBroa
CreateTimer( 0.2, VerifyTeamCounts, 0, 0 );
new uid = GetEventInt( event, "userid" );
- if( GetConVarInt( g_h_nh_warmup ) != 0 ) {
+ if( GetConVarInt( g_h_nh_warmup ) != 0 || g_isKZ ) {
CreateTimer( 0.5, RespawnPlayerDelay, uid );
}