Permalink
Browse files

Merge pull request #7 from cartman-2000/master

Handle empty input stings and fix getting vehicle names in buy using id.
  • Loading branch information...
2 parents 0b997ba + 61fbf85 commit 0b38d301bd161bb13b0bdf13f7e93b7c58faca5e @Zamirathe Zamirathe committed Aug 18, 2015
Showing with 8 additions and 8 deletions.
  1. +2 −2 Properties/AssemblyInfo.cs
  2. +6 −6 ZaupShop.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.3.0.1")]
-[assembly: AssemblyFileVersion("1.3.0.1")]
+[assembly: AssemblyVersion("1.3.0.2")]
+[assembly: AssemblyFileVersion("1.3.0.2")]
View
@@ -222,7 +222,7 @@ public void Buy(UnturnedPlayer playerid, string[] components0)
}
}
string[] components = Parser.getComponentsFromSerial(components0[0], '.');
- if (components.Length == 2 && components[0] != "v")
+ if ((components.Length == 2 && components[0].Trim() != "v") || (components.Length == 1 && components[0].Trim() == "v") || components.Length > 2 || components0[0].Trim() == string.Empty)
{
message = ZaupShop.Instance.Translate("buy_command_usage", new object[] { });
// We are going to print how to use
@@ -239,7 +239,7 @@ public void Buy(UnturnedPlayer playerid, string[] components0)
UnturnedChat.Say(playerid, message);
return;
}
- string name = "";
+ string name = null;
if (!ushort.TryParse(components[1], out id))
{
Asset[] array = Assets.find(EAssetType.VEHICLE);
@@ -275,7 +275,7 @@ public void Buy(UnturnedPlayer playerid, string[] components0)
}
if (balance < cost)
{
- message = ZaupShop.Instance.Translate("not_enough_currency_msg", new object[] {Uconomy.Instance.Configuration.Instance.MoneyName, name});
+ message = ZaupShop.Instance.Translate("not_enough_currency_msg", new object[] {Uconomy.Instance.Configuration.Instance.MoneyName, "1", name});
UnturnedChat.Say(playerid, message);
return;
}
@@ -352,14 +352,14 @@ public void Buy(UnturnedPlayer playerid, string[] components0)
public void Cost(UnturnedPlayer playerid, string[] components)
{
string message;
- if (components.Length == 0)
+ if (components.Length == 0 || (components.Length == 1 && (components[0].Trim() == string.Empty || components[0].Trim() == "v")))
{
message = ZaupShop.Instance.Translate("cost_command_usage", new object[] { });
// We are going to print how to use
UnturnedChat.Say(playerid, message);
return;
}
- if (components.Length == 2 && components[0] != "v")
+ if (components.Length == 2 && (components[0] != "v" || components[1].Trim() == string.Empty))
{
message = ZaupShop.Instance.Translate("cost_command_usage", new object[] { });
// We are going to print how to use
@@ -445,7 +445,7 @@ public void Cost(UnturnedPlayer playerid, string[] components)
public void Sell(UnturnedPlayer playerid, string[] components)
{
string message;
- if (components.Length == 0)
+ if (components.Length == 0 || (components.Length > 0 && components[0].Trim() == string.Empty))
{
message = ZaupShop.Instance.Translate("sell_command_usage", new object[] { });
// We are going to print how to use

0 comments on commit 0b38d30

Please sign in to comment.