Advertisement
moseechev

Untitled

Aug 28th, 2020
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.21 KB | None | 0 0
  1. public string[] OnCall(ICommandSender sender, string[] args)
  2. {
  3. if (!int.TryParse(args[0], out int playerid))
  4. {
  5. return new string[] { "\n<color=red><b>CRITICAL ERROR!</b> \nInvalid playerid:" + args[0] + "</color>" };
  6. }
  7. args.Add(" ");
  8. Player target = PluginManager.Manager.Server.GetPlayer(playerid);
  9. ReferenceHub targetRef = ReferenceHub.GetHub(target.PlayerId);
  10. GameObject gameObject;
  11.  
  12. if (args.Length > 0)
  13. {
  14. if (args.Length > 4)
  15. {
  16. return new string[] { "\n<color=red><b>CRITICAL ERROR!</b> Invalid number of arguments.</color>" };
  17. }
  18.  
  19. if (!float.TryParse(args[1], out float x))
  20. {
  21. Plugin.SpawnWorkbench(targetRef.gameObject.transform.position + (gameObject = targetRef.gameObject).GetComponent<Scp049_2PlayerScript>().plyCam.transform.forward * 2, gameObject.transform.rotation.eulerAngles, new Vector3(1, 1, 1));
  22. return new string[] { "\n<color=red>Invalid X size</color>:" + args[1] + ", using default value 1. \n<color=#00FF44>Successfully created workbench near " + target.Name + ", at " + target.GetPosition().ToString() + ", with sizes: <b>X = 1, Y = 1, Z = 1</b></color>" };
  23. }
  24.  
  25. if (!float.TryParse(args[2], out float y))
  26. {
  27. Plugin.SpawnWorkbench(targetRef.gameObject.transform.position + (gameObject = targetRef.gameObject).GetComponent<Scp049_2PlayerScript>().plyCam.transform.forward * 2, gameObject.transform.rotation.eulerAngles, new Vector3(x, 1, 1));
  28. return new string[] { "\n<color=red>Invalid Y size</color>:" + args[2] + ", using default value 1.</color> \n<color=#00FF44>Successfully created workbench near " + target.Name + ", at " + target.GetPosition().ToString() + ", with sizes: <b>X = " + x + ", Y = 1, Z = 1</b></color>" };
  29. }
  30.  
  31. if (!float.TryParse(args[3], out float z))
  32. {
  33. Plugin.SpawnWorkbench(targetRef.gameObject.transform.position + (gameObject = targetRef.gameObject).GetComponent<Scp049_2PlayerScript>().plyCam.transform.forward * 2, gameObject.transform.rotation.eulerAngles, new Vector3(x, y, 1));
  34. return new string[] { "\n</color>Invalid Z size</color>:" + args[3] + ", using default value 1. \n<color=#00FF44>Successfully created workbench near " + target.Name + ", at " + target.GetPosition().ToString() + ", with sizes: <b>X = " + x + ", Y = " + y + ", Z = 1</b></color>" };
  35. }
  36. Plugin.SpawnWorkbench(targetRef.gameObject.transform.position + (gameObject = targetRef.gameObject).GetComponent<Scp049_2PlayerScript>().plyCam.transform.forward * 2, gameObject.transform.rotation.eulerAngles, new Vector3(x, y, z));
  37. return new string[] { "\n<color=#00FF44>Successfully created workbench near " + target.Name + ", at " + target.GetPosition().ToString() + ", with sizes: <b>X = " + x + ", Y = " + y + ", Z = " + z + "</b></color>" };
  38.  
  39. }
  40. return new string[] { GetUsage() };
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement