diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_items.nut b/Northstar.CustomServers/mod/scripts/vscripts/_items.nut index 96623086..dbfa2e92 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/_items.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/_items.nut @@ -4914,8 +4914,10 @@ string function GetRefFromItem( item ) function SubitemDefined( string parentRef, string childRef ) { - Assert( parentRef in file.itemData ) - return (childRef in file.itemData[parentRef].subitems) + if ( !( parentRef in file.itemData ) ) + return false + + return ( childRef in file.itemData[parentRef].subitems ) } ItemDisplayData function GetSubitemDisplayData( string parentRef, string childRef ) @@ -7971,7 +7973,7 @@ bool function ClientCommand_BuyTicket( entity player, array args ) int numTickets = 1 - if ( args.len() > 0 ) + if ( args.len() && int( args[0] ) > 0 ) numTickets = int( args[0] ) int cost = GetItemCost( ref ) * numTickets diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_loadouts_mp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_loadouts_mp.gnut index 141cfe15..97d8cf02 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/_loadouts_mp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/_loadouts_mp.gnut @@ -212,14 +212,22 @@ bool function ClientCommandCallback_SwapSecondaryAndWeapon3PersistentLoadoutData bool function ClientCommandCallback_SetBurnCardPersistenceSlot( entity player, array args ) { if ( args.len() != 1 || GetGameState() >= eGameState.Playing ) - return true + return false print( player + " SetBurnCardPersistenceSlot " + args[0] ) if ( IsRefValidAndOfType( args[0], eItemTypes.BURN_METER_REWARD ) ) - player.SetPersistentVar( "burnmeterSlot", BurnReward_GetByRef( args[0] ).id ) + { + if ( !IsItemLocked( player, args[0] ) ) + player.SetPersistentVar( "burnmeterSlot", BurnReward_GetByRef( args[0] ).id ) + else + return false + } else + { print( player + " invalid ref " + args[0] ) + return false + } return true } @@ -227,34 +235,69 @@ bool function ClientCommandCallback_SetBurnCardPersistenceSlot( entity player, a // lobby clientcommands bool function ClientCommandCallback_SetCallsignIcon( entity player, array args ) { + if ( !args.len() ) + args.append( "" ) + print( player + " SetCallsignIcon " + args[0] ) if ( IsRefValidAndOfType( args[0], eItemTypes.CALLSIGN_ICON ) ) - PlayerCallsignIcon_SetActiveByRef( player, args[0] ) + { + if ( !IsItemLocked( player, args[0] ) ) + PlayerCallsignIcon_SetActiveByRef( player, args[0] ) + else + return false + } else + { print( player + " invalid ref " + args[0] ) + return false + } return true } bool function ClientCommandCallback_SetCallsignCard( entity player, array args ) { - print( player + " SetCallsignIcon " + args[0] ) + if ( !args.len() ) + args.append( "" ) + + print( player + " SetCallsignCard " + args[0] ) if ( IsRefValidAndOfType( args[0], eItemTypes.CALLING_CARD ) ) - PlayerCallingCard_SetActiveByRef( player, args[0] ) + { + if ( !IsItemLocked( player, args[0] ) ) + PlayerCallingCard_SetActiveByRef( player, args[0] ) + else + return false + } else + { print( player + " invalid ref " + args[0] ) + return false + } return true } bool function ClientCommandCallback_SetFactionChoicePersistenceSlot( entity player, array args ) { + if ( !args.len() ) + args.append( "" ) + print( player + " SetFactionChoicePersistenceSlot " + args[0] ) if ( IsRefValidAndOfType( args[0], eItemTypes.FACTION ) ) - player.SetPersistentVar( "factionChoice", args[0] ) // no function for this so gotta set directly lol + { + if ( !IsItemLocked( player, args[0] ) ) + player.SetPersistentVar( "factionChoice", args[0] ) + else + return false + } + else + { + print( player + " invalid ref " + args[0] ) + return false + } return true } diff --git a/Northstar.CustomServers/mod/scripts/vscripts/ai/_ai_soldiers.gnut b/Northstar.CustomServers/mod/scripts/vscripts/ai/_ai_soldiers.gnut index 89fb7a82..adf0e1b4 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/ai/_ai_soldiers.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/ai/_ai_soldiers.gnut @@ -101,6 +101,9 @@ function AiSoldiers_Init() bool function ClientCommand_SpawnViewGrunt( entity player, array args ) { + if ( !args.len() ) + return true + int team = args[0].tointeger() if ( GetDeveloperLevel() < 1 ) return true diff --git a/Northstar.CustomServers/mod/scripts/vscripts/lobby/_private_lobby.gnut b/Northstar.CustomServers/mod/scripts/vscripts/lobby/_private_lobby.gnut index 0a28031a..e6da1437 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/lobby/_private_lobby.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/lobby/_private_lobby.gnut @@ -76,9 +76,16 @@ bool function ClientCommandCallback_PrivateMatchSetMode( entity player, array a if ( GetConVarInt( "ns_private_match_only_host_can_change_settings" ) == 2 ) if ( !NSIsPlayerLocalPlayer( player ) ) return true - - LogPrivateMatchChange( player , " changed the map to " , args ) - // todo: need to verify this value + if ( GetPrivateMatchMapsForMode( file.mode ).contains( args[0] ) ) + { + LogPrivateMatchChange( player , " changed the map to " , args ) + } + else + { + args[0] += " for mode: " + file.mode + LogPrivateMatchChange( player , " attempted to set an invalid map: " , args ) + return true + } + file.map = args[0] // todo: this should NOT be necessary, private matches should use an api to register maps in the future rather than hardcoded ids @@ -213,6 +228,9 @@ void function RefreshPlayerTeams() bool function ClientCommandCallback_PrivateMatchSetPlaylistVarOverride( entity player, array args ) { + if ( file.startState == ePrivateMatchStartState.STARTING ) + return true + if ( args.len() < 2 ) return true @@ -243,6 +261,9 @@ bool function ClientCommandCallback_PrivateMatchSetPlaylistVarOverride( entity p bool function ClientCommandCallback_ResetMatchSettingsToDefault( entity player, array args ) { + if ( file.startState == ePrivateMatchStartState.STARTING ) + return true + if ( GetConVarInt( "ns_private_match_only_host_can_change_settings" ) >= 1 ) if ( !NSIsPlayerLocalPlayer( player ) ) return true diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_model_viewer.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_model_viewer.nut index c33f4ef0..8a619d77 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_model_viewer.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_model_viewer.nut @@ -96,6 +96,9 @@ function ControlsInit() bool function ClientCommand_ModelViewer( entity player, array args ) { + if ( !args.len() ) + return true + string command = args[ 0 ] switch ( command ) { diff --git a/Northstar.CustomServers/mod/scripts/vscripts/titan/_titan_commands.gnut b/Northstar.CustomServers/mod/scripts/vscripts/titan/_titan_commands.gnut index 06232c08..b59f1549 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/titan/_titan_commands.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/titan/_titan_commands.gnut @@ -14,7 +14,9 @@ function TitanCommands_Init() bool function Prototype_OrderTitanMove( entity player, array args ) { - Assert( args.len() == 3 ) + if ( args.len() != 3 ) + return true + vector pos = Vector( args[0].tofloat(), args[1].tofloat(), args[2].tofloat() ) DebugDrawLine( pos, pos + Vector(0,0,500), 255, 0, 0, true, 5.0 )