Advertisement
Guest User

Untitled

a guest
Jan 11th, 2017
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.30 KB | None | 0 0
  1.         [Command("debug", Description = "Shows a list of debugging commands")]
  2.         public void Command_Debug(Client sender)
  3.         {
  4.             sender.sendChatMessage("~b~Debug commands:");
  5.             var list = API.getResourceCommands(Global.currentResource);
  6.             string cmdLine = string.Empty;
  7.             byte c = 0;
  8.             foreach (var cmd in list)
  9.             {
  10.                 var info = API.getResourceCommandInfo(Global.currentResource, cmd);
  11.                 sender.sendChatMessage((++c) + ") ~b~" + info.Command + (info.Usage.Length > 0 ? (" " + info.Usage) : "") + (info.Description.Length > 0 ? ("~w~ - " + info.Description) : ""));
  12.             }
  13.         }
  14.         [Command("v", Description = "Spawns a vehicle", GreedyArg = true)]
  15.         public void Command_Vehicle(Client player, string name)
  16.         {
  17.             if (!Utils.IsValidVehicle(name))
  18.             {
  19.                 player.sendChatMessage("~r~Error:~w~ Not a valid vehicle.");
  20.                 return;
  21.             }
  22.             var v = API.createVehicle(API.vehicleNameToModel(name), API.getEntityPosition(player), new Vector3(), 0, 0, player.dimension);
  23.             API.setPlayerIntoVehicle(player, v.handle, 1);
  24.             API.sendNotificationToPlayer(player, "Spawned ~b~" + v.displayName);
  25.         }
  26.         [Command("w", Description = "Get a weapon", GreedyArg = true)]
  27.         public void Command_Weapon(Client player, int ammo, string name)
  28.         {
  29.             if (!Utils.IsValidWeapon(name))
  30.             {
  31.                 player.sendChatMessage("~r~Error:~w~ Not a valid wepaon.");
  32.                 return;
  33.             }
  34.             var w = API.weaponNameToModel(name);
  35.             API.givePlayerWeapon(player, w, ammo, true, true);
  36.             API.sendNotificationToPlayer(player, "Weapon: ~b~" + w.ToString());
  37.         }
  38.         [Command("s", Description = "Set a skin", GreedyArg = true)]
  39.         public void Command_Skin(Client player, string name)
  40.         {
  41.             if (!Utils.IsValidSkin(name))
  42.             {
  43.                 player.sendChatMessage("~r~Error:~w~ Not a valid skin.");
  44.                 return;
  45.             }
  46.             var s = API.pedNameToModel(name);
  47.             API.setPlayerSkin(player, s);
  48.             API.sendNotificationToPlayer(player, "Skin set to ~b~" + s.ToString());
  49.         }
  50.         [Command("godmod", Description = "Toggle invincibility")]
  51.         public void Command_Godmod(Client player)
  52.         {
  53.             bool toggle = !API.getEntityInvincible(player.handle);
  54.             API.setEntityInvincible(player.handle, toggle);
  55.             API.sendNotificationToPlayer(player, "Godmod ~b~" + (toggle ? "ON" : "OFF"));
  56.         }
  57.         [Command("alpha", Description = "Sets your transparency", GreedyArg = true)]
  58.         public void Command_Alpha(Client player, string al)
  59.         {
  60.             int alpha = Convert.ToInt32(al);
  61.             if (alpha < 0) alpha = 0;
  62.             if (alpha > 255) alpha = 255;
  63.             API.setEntityTransparency(player.handle, alpha);
  64.             API.sendNotificationToPlayer(player, "Alpha set to ~b~" + alpha);
  65.         }
  66.         [Command("weather", Description = "Sets the world weather", GreedyArg = true)]
  67.         public void Command_Weather(Client player, string wea)
  68.         {
  69.             int weather = -1;
  70.             bool flag = int.TryParse(wea, out weather);
  71.             if (!flag || weather < 0 || weather > 13)
  72.                 player.sendChatMessage("~r~Invalid weather ID.");
  73.             else
  74.             {
  75.                 API.setWeather(weather);
  76.                 API.sendNotificationToAll("Weather set to ~b~" + Utils.GetWeatherName(weather) + "~w~ by ~b~" + player.name);
  77.             }
  78.         }
  79.         [Command("time", Description = "Sets the world time", GreedyArg = true)]
  80.         public void Command_Time(Client player, string hour, string minute)
  81.         {
  82.             int h = -1, m = -1;
  83.             bool flag = int.TryParse(hour, out h),
  84.                 flag2 = int.TryParse(minute, out m);
  85.             if (!flag || !flag2 || h < 0 || h > 23 || m < 0 || m > 59)
  86.                 player.sendChatMessage("~r~Invalid time.");
  87.             else
  88.             {
  89.                 API.setTime(h, m);
  90.                 API.sendNotificationToAll("Time set to ~b~" + h + ":" + m + "~w~ by ~b~" + player.name);
  91.             }
  92.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement