using GTA;
using GTA.Native;
using GTA.Math;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Reflection;
using System.Windows.Forms;
public class myFirstScript : Script  // объявление нашего класса
{
    public myFirstScript() // конструктор класса, функция которая срабатывает первой при создании класса
    {
    }	
}
public class myFirstScript : Script 
{
    public myFirstScript() 
    {
       KeyDown += onkeydown;  // указываем на то, что клавиатурой занимается наша функция
    }
    void onkeydown(object sender, KeyEventArgs e) // наш обработчик
    {
       if (e.KeyCode == Keys.K)
       {
          // если нажали на клавишу K
       }
       if (e.KeyCode == Keys.J)
       {
          // если нажали на клавишу J
       }
    }	
}
		var position = Game.Player.Character.GetOffsetInWorldCoords(new Vector3(0, 5, 0)); // берем координаты игрока и прибавляем смещение 5 игровых метров от него
		var heading = Game.Player.Character.Heading - 90; // берем поворот игрока
		var vehicle = World.CreateVehicle(VehicleHash.Dubsta, position, heading); // создаем машину под названием Dubsta
		vehicle.DirtLevel = 15f;   // указываем уровень грязи
		vehicle.CustomPrimaryColor = Color.White; // указываем первичный цвет
		vehicle.CustomSecondaryColor = Color.Black; // указываем вторичный цвет
		vehicle.PlaceOnGround(); // ставим машину на свои координаты
		Function.Call(Hash.SET_VEHICLE_MOD_KIT, vehicle.Handle, 0);  // включаем тюнинг
		vehicle.SetMod(VehicleMod.FrontBumper, 3, true); // ставим передний бампер
		vehicle.SetMod(VehicleMod.RearBumper, 1, true); // задний бампер
Game.Player.Character.IsVisible = !Game.Player.Character.IsVisible;
    public void PrintText(string text, int time)
    {
            GTA.Native.Function.Call(GTA.Native.Hash._0xB87A37EEB7FAA67D, "STRING");
            GTA.Native.Function.Call(GTA.Native.Hash._ADD_TEXT_COMPONENT_STRING, text);
            GTA.Native.Function.Call(GTA.Native.Hash._0x9D77056A530643F6, time, 1);
    }

using GTA;
using GTA.Native;
using GTA.Math;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Reflection;
using System.Windows.Forms;
public class myFirstScript : Script
{
    public myFirstScript()
    {
        KeyDown += onkeydown;
    }
	
public void PrintText(string text, int time)
    {
            GTA.Native.Function.Call(GTA.Native.Hash._0xB87A37EEB7FAA67D, "STRING");
            GTA.Native.Function.Call(GTA.Native.Hash._ADD_TEXT_COMPONENT_STRING, text);
            GTA.Native.Function.Call(GTA.Native.Hash._0x9D77056A530643F6, time, 1);
    }
    void onkeydown(object sender, KeyEventArgs e)
    {
        if (e.KeyCode == Keys.K)
        {
		var position = Game.Player.Character.GetOffsetInWorldCoords(new Vector3(0, 5, 0));
		var heading = Game.Player.Character.Heading - 90;
		var vehicle = World.CreateVehicle(VehicleHash.Dubsta, position, heading);
		vehicle.DirtLevel = 15f;
		vehicle.CustomPrimaryColor = Color.White;
		vehicle.CustomSecondaryColor = Color.Black;
		vehicle.NumberPlate = "GTA V";
		vehicle.PlaceOnGround();
		Function.Call(Hash.SET_VEHICLE_MOD_KIT, vehicle.Handle, 0);
		vehicle.SetMod(VehicleMod.FrontBumper, 3, true);
		vehicle.SetMod(VehicleMod.RearBumper, 1, true);
		vehicle.SetMod(VehicleMod.Hood, 2, true);
		PrintText("spawned Dubsta", 10000);
        }
	else if(e.KeyCode == Keys.J)
	{
		Game.Player.Character.IsVisible = !Game.Player.Character.IsVisible;
		PrintText("change visibility", 10000);
	}
    }
}

Published on 3 August 2016
© 2012-2024 GameModding.com All rights reserved.