// Rally: a custom car. The Rally is an orange Catamount with a stronger engine (top speed 90 instead of 71.5). // It is made from the game's car: same body, wheels and handling, its own name, color and speed. Cars stay in the world // and in the save; if this file is removed, the Rallies already out keep their color and speed, /rally stops. // Admins: /rally puts one in front of you. // Install: copy this file into the server's data folder, plugins/Rally.cs. // Script engine rules: test objects with != null, no static fields that change, callbacks with one parameter at most. using RustLegacy; public class Rally : RustPlugin { public override void OnLoaded() { DefineVehicle( new PluginVehicle { Name = "Rally", Base = "Catamount", TopSpeed = 90f, Tint = "#8a1408" } ); AddCommand( "rally", OnCommand, "A Rally car in front of you", true ); } void OnCommand( ChatCommand cmd ) { var p = cmd.Player; var yaw = p.Controller.EyeAngles.yaw; var at = p.WorldPosition + Rotation.FromYaw( yaw ).Forward * 200f; var ground = Scene.Trace.Ray( at + Vector3.Up * 400f, at + Vector3.Down * 2000f ).WithoutTags( "player", "trigger" ).Run(); if ( ground.Hit ) at = ground.EndPosition; // side on, its driver's door towards you, a little above the ground: it drops onto its wheels var car = SpawnVehicle( "Rally", at + Vector3.Up * 40f, yaw + 90f ); Reply( p, car != null ? "Rally spawned in front of you." : "Could not spawn it (see the console)." ); } }