-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInsuranceCommand.cs
More file actions
38 lines (34 loc) · 1.79 KB
/
Copy pathInsuranceCommand.cs
File metadata and controls
38 lines (34 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using SDG.Unturned;
using Rocket.API;
using Rocket.Unturned.Chat;
using Rocket.Unturned.Player;
using System.Collections.Generic;
namespace CarInsurance
{
public class InsuranceCommand : IRocketCommand
{
public AllowedCaller AllowedCaller => AllowedCaller.Both;
public string Name => "insurance";
public string Help => "This command will allow you to bring back your damaged car!";
public string Syntax => "";
public List<string> Aliases => new List<string>();
public List<string> Permissions => new List<string>();
public void Execute(IRocketPlayer caller, string[] command)
{
UnturnedPlayer client = caller as UnturnedPlayer;
Info vehicle = CarInsurance.Instance.PlayerGetInsurance(client.CSteamID);
if(vehicle != null && client.Experience >= CarInsurance.Instance.Configuration.Instance.Cost)
{
VehicleAsset va = (VehicleAsset) Assets.FindBaseVehicleAssetByGuidOrLegacyId(vehicle.vehicleGuid, vehicle.vehicleId);
if(va != null) {
VehicleTool.SpawnVehicleForPlayer(client.Player, va);
// VehicleManager.SpawnVehicleV3((VehicleAsset)Assets.FindBaseVehicleAssetByGuidOrLegacyId(vehicle.vehicleGuid, vehicle.vehicleId), 0, 0, 0, client.Position, client.Player.transform.rotation, false, false, false, false, 100, 100, 100, client.CSteamID, client.SteamGroupID, false, new byte[0][], byte.MaxValue);
UnturnedChat.Say(caller, CarInsurance.Instance.Translate("success"));
client.Experience -= CarInsurance.Instance.Configuration.Instance.Cost;
return;
}
}
UnturnedChat.Say(caller, CarInsurance.Instance.Translate("fail"));
}
}
}