У некоторых на сборке не работает создание нового т/с для аренды.
C#:
[Command("newrentveh")]
public static void newrentveh(Client player, string model, string number, int price, int c1, int c2) {
try {
if (!Group.CanUseCmd(player, "newrentveh")) return;
VehicleHash vh = NAPI.Util.VehicleNameToModel(model);
if (vh == 0) throw null;
var veh = NAPI.Vehicle.CreateVehicle(vh, player.Position, player.Rotation.Z, 0, 0);
VehicleStreaming.SetEngineState(veh, true);
veh.Dimension = player.Dimension;
MySqlCommand cmd = new MySqlCommand {
CommandText = "INSERT INTO othervehicles(type, number, model, position, rotation, color1, color2, price) VALUES (@type, @number, @model, @pos, @rot, @c1, @c2, @price);"
};
cmd.Parameters.AddWithValue("@type", 0);
cmd.Parameters.AddWithValue("@price", price);
cmd.Parameters.AddWithValue("@model", model);
cmd.Parameters.AddWithValue("@number", number);
cmd.Parameters.AddWithValue("@c1", c1);
cmd.Parameters.AddWithValue("@c2", c2);
cmd.Parameters.AddWithValue("@pos", JsonConvert.SerializeObject(player.Position));
cmd.Parameters.AddWithValue("@rot", JsonConvert.SerializeObject(player.Rotation));
MySQL.Query(cmd);
veh.PrimaryColor = c1;
veh.SecondaryColor = c2;
veh.NumberPlate = number;
player.SendChatMessage("Вы добавили машину для аренды.");
} catch (Exception e) {
Log.Write("EXCEPTION AT "
newrentveh ":\n" + e.ToString(), nLog.Type.Error);
}
}