GTAScript

Project Description
GTAScript.Net is a collection on CLI wrapper classes & services to provide an object oriented scripting structure in .Net CLR languages for GTA IV.



Example Script: Press F5 to spawn a vehicle:
namespace TestScript
{
    public class TestScript : ScriptBase
    {
        public TestScript()
        {
            GTA.Events.KeyDown.Handler += OnKeyDown;
        }

        public void OnKeyDown(Object sender, GTA.Events.KeyEventArgs args)
        {
            if (args.KeyCode == GTA.Keys.F5) SpawnVehicle(GTA.eModel.MODEL_BANSHEE);
        }

        public void SpawnVehicle(GTA.eModel model)
        {
            Log.Debug("TestScript Spawn Vehicle");
            GTA.Screen.PrintString("Spawn vehicle", 1000);
            GTA.Player pl = new Player();
            GTA.Vehicle v = GTA.World.CreateVehicle(model, pl.Coordinates);
            if (!Vehicle.Exists(v)) return;
            ScriptApi.WarpCharIntoCar(pl.GetPlayerPed(), v);
        }
}

Last edited Feb 7, 2010 at 11:10 PM by JimmyMcJimbo, version 7