File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -298,5 +298,31 @@ public void ListMute()
298298 var ms = new DialogMessage ( "Muted Users" , content : sb . ToString ( ) ) ;
299299 ModCommunication . SendMessageTo ( ms , Context . Player . SteamUserId ) ;
300300 }
301+
302+ [ Command ( "give" , "Insert an item with a specific quanity into a players inventory" ) ]
303+ [ Permission ( MyPromoteLevel . Admin ) ]
304+ public void give ( string playerName , string type , string item , int quantity ) {
305+ type = "MyObjectBuilder_" + type ;
306+ VRage . Game . MyDefinitionId . TryParse ( type , item , out VRage . Game . MyDefinitionId defID ) ;
307+ if ( defID . ToString ( ) . Contains ( "null" ) ) {
308+ Context . Respond ( "Invalid item type" ) ;
309+ return ;
310+ }
311+ if ( playerName != "*" ) {
312+ var p = Utilities . GetPlayerByNameOrId ( playerName ) ;
313+ if ( p == null ) {
314+ Context . Respond ( "Player not found" ) ;
315+ return ;
316+ }
317+ Sandbox . Game . MyVisualScriptLogicProvider . AddToPlayersInventory ( p . IdentityId , defID , quantity ) ;
318+ }
319+
320+ else {
321+ foreach ( var p in MySession . Static . Players . GetOnlinePlayers ( ) ) {
322+ Sandbox . Game . MyVisualScriptLogicProvider . AddToPlayersInventory ( p . Identity . IdentityId , defID , quantity ) ;
323+ }
324+ }
325+ Context . Respond ( "Item(s) given!" ) ;
326+ }
301327 }
302328}
You can’t perform that action at this time.
0 commit comments