Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Command("calculator", Alias = "calc")]
- public void Calculator_Command(Client player, int firstNum, string mathType, int secondNum)
- {
- //Add checks to see if they have a calculator here.
- float result = 0;
- switch (mathType)
- {
- case "*":
- {
- result = (firstNum * secondNum);
- break;
- }
- case "-":
- {
- result = (firstNum - secondNum);
- break;
- }
- case "+":
- {
- result = (firstNum + secondNum);
- break;
- }
- case "/":
- {
- result = (firstNum / secondNum);
- break;
- }
- }
- API.sendChatMessageToPlayer(player, "[CALCULATOR] " + Convert.ToInt32(firstNum).ToString() + " " + mathType + " " + Convert.ToInt32(secondNum.ToString()) + " = " + result.ToString());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement