Im trying to make gamble plugin that uses scrap you have in your inventory. Im not sure how i could add it that you would need to type amount of scrap to gamble. Something like int amount = 1; <- command changes amount of scrap somehow.
Amount for command /gamble "amount"
Chat command hook have 3 parameters - BasePlayer, string and string array, third is arguments (all whats typed after the command itself, separated by spaces), you need to parse arguments by int.TryParse.
[ChatCommand("gamble")]
private void CmdGamble(BasePlayer player, string command, string[] args)
{
if(args.Length < 1)
{
player.ChatMessage("Wrong command usage");
return;
}
var amount = default(int);
if(!int.TryParse(args[0], out amount))
{
player.ChatMessage("Wrong command usage");
return;
}
//at this moment amount is parsed, do whatever you want with it.
}