diff --git a/GameFiles/IW4x/userraw/scripts/_integration.gsc b/GameFiles/IW4x/userraw/scripts/_integration.gsc index 6674a36e1..0686b9c7e 100644 --- a/GameFiles/IW4x/userraw/scripts/_integration.gsc +++ b/GameFiles/IW4x/userraw/scripts/_integration.gsc @@ -501,7 +501,7 @@ OnExecuteCommand( event ) } else { - response = self GotoImpl( event.data ); + response = self GotoImpl( data ); } break; case "Kill": @@ -510,6 +510,9 @@ OnExecuteCommand( event ) case "NightMode": NightModeImpl(); break; + case "SetSpectator": + response = event.target SetSpectatorImpl(); + break; } // send back the response to the origin, but only if they're not the target @@ -712,3 +715,16 @@ ToggleNightMode() self SetClientDvar( "fx_draw", fxDraw ); self SetClientDvar( "sv_cheats", 0 ); } + +SetSpectatorImpl() +{ + if ( self.pers["team"] == "spectator" ) + { + return self.name + " is already spectating"; + } + + self [[level.spectator]](); + self IPrintLnBold( "You have been moved to spectator" ); + + return self.name + " has been moved to spectator"; +} diff --git a/Plugins/ScriptPlugins/GameInterface.js b/Plugins/ScriptPlugins/GameInterface.js index 719bf9ba6..bb0d8da4e 100644 --- a/Plugins/ScriptPlugins/GameInterface.js +++ b/Plugins/ScriptPlugins/GameInterface.js @@ -271,6 +271,24 @@ let commands = [{ } sendScriptCommand(gameEvent.Owner, 'NightMode', gameEvent.Origin, undefined, undefined); } +}, +{ + name: 'setspectator', + description: 'sets a player as spectator', + alias: 'spec', + permission: 'Administrator', + targetRequired: true, + arguments: [{ + name: 'player', + required: true + }], + supportedGames: ['IW4'], + execute: (gameEvent) => { + if (!validateEnabled(gameEvent.Owner, gameEvent.Origin)) { + return; + } + sendScriptCommand(gameEvent.Owner, 'SetSpectator', gameEvent.Origin, gameEvent.Target, undefined); + } }]; const sendScriptCommand = (server, command, origin, target, data) => {