@@ -172,6 +172,8 @@ protected override void LoadDefaultMessages()
172
172
{ "CodeRemoved" , "You're code has been removed." } ,
173
173
{ "GuestCodeRemoved" , "You're guest code has been removed." } ,
174
174
{ "InvalidArgsTooMany" , "No additional arguments expected." } ,
175
+ { "Info" , "Code: {0}\n Guest Code: {1}\n \n Usage: {2}" } ,
176
+ { "NotSet" , "Not set." } ,
175
177
{ "SyntaxError" , "Syntax Error: expected command in the form:\n {0}" } ,
176
178
{ "SpamPrevention" , "Too many recent code sets. Please wait {0} and try again." } ,
177
179
{ "InvalidArguments" , "Invalid arguments supplied." } ,
@@ -852,9 +854,9 @@ private void HandleUse(BasePlayer player, string label, string[] args)
852
854
return ;
853
855
}
854
856
855
- if ( args . Length < 1 )
857
+ if ( args . Length == 0 )
856
858
{
857
- SyntaxError ( player , label , args ) ;
859
+ ShowInfo ( player , label , args ) ;
858
860
return ;
859
861
}
860
862
@@ -936,6 +938,38 @@ private void HandleUse(BasePlayer player, string label, string[] args)
936
938
SyntaxError ( player , label , args ) ;
937
939
}
938
940
941
+ /// <summary>
942
+ /// Show the player their info.
943
+ /// </summary>
944
+ private void ShowInfo ( BasePlayer player , string label , string [ ] args )
945
+ {
946
+ string code = null ;
947
+ string guestCode = null ;
948
+
949
+ if ( plugin . data . Inst . playerSettings . ContainsKey ( player . userID ) )
950
+ {
951
+ Data . Structure . PlayerSettings settings = plugin . data . Inst . playerSettings [ player . userID ] ;
952
+ code = settings . code ;
953
+ guestCode = settings . guestCode ;
954
+
955
+ // Hide codes for those in streamer mode.
956
+ if ( player . net . connection . info . GetBool ( "global.streamermode" ) )
957
+ {
958
+ code = code == null ? null : "****" ;
959
+ guestCode = guestCode == null ? null : "****" ;
960
+ }
961
+ }
962
+
963
+ player . ChatMessage (
964
+ string . Format (
965
+ plugin . lang . GetMessage ( "Info" , plugin , player . UserIDString ) ,
966
+ code ?? plugin . lang . GetMessage ( "NotSet" , plugin , player . UserIDString ) ,
967
+ guestCode ?? plugin . lang . GetMessage ( "NotSet" , plugin , player . UserIDString ) ,
968
+ UsageInfo ( label )
969
+ )
970
+ ) ;
971
+ }
972
+
939
973
/// <summary>
940
974
/// Notify the player that they entered a syntax error in their "use" chat command.
941
975
/// </summary>
@@ -944,11 +978,20 @@ private void SyntaxError(BasePlayer player, string label, string[] args)
944
978
player . ChatMessage (
945
979
string . Format (
946
980
plugin . lang . GetMessage ( "SyntaxError" , plugin , player . UserIDString ) ,
947
- string . Format ( "/{0} {1}" , label , HelpGetAllUseCommandArguments ( ) )
981
+ UsageInfo ( label )
948
982
)
949
983
) ;
950
984
}
951
985
986
+ /// <summary>
987
+ /// Show how to use the "use" command.
988
+ /// </summary>
989
+ /// <returns></returns>
990
+ private string UsageInfo ( string label )
991
+ {
992
+ return string . Format ( "/{0} {1}" , label , HelpGetAllUseCommandArguments ( ) ) ;
993
+ }
994
+
952
995
/// <summary>
953
996
/// Get all the arguments that can be supplied to the "use" command.
954
997
/// </summary>
0 commit comments