Advertisement
daleNGU

GTA5 PC vehicle spawner script example

May 29th, 2015
952
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.17 KB | None | 0 0
  1. /* made by skyrocket*/
  2. /*please leave credit if used!*/
  3.  
  4.  
  5. using System;
  6. using System.Collections.Generic;
  7. using System.ComponentModel;
  8. using System.Data;
  9. using System.Drawing;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. using System.Windows.Forms;
  14. using GTA.Native;
  15. using GTA;  //scripthook
  16. using GTA.Math;
  17.  
  18. namespace script
  19. {
  20.     public class spawnerTUT : Script
  21.     {
  22.         public spawnerTUT()
  23.         {
  24.             KeyUp += keyval;
  25.         }
  26.         public void PrintText(string text, int time) //displays text on screen
  27.         {
  28.             GTA.Native.Function.Call(GTA.Native.Hash._0xB87A37EEB7FAA67D, "STRING");
  29.             GTA.Native.Function.Call(GTA.Native.Hash._ADD_TEXT_COMPONENT_STRING, text);
  30.             GTA.Native.Function.Call(GTA.Native.Hash._0x9D77056A530643F6, time, 1);
  31.         }
  32.  
  33.         void keyval(object sender, KeyEventArgs e)
  34.         {
  35.             if (e.KeyCode == Keys.O) //spawns an adder when the "O" key is pressed
  36.             {
  37.                 World.CreateVehicle(VehicleHash.Adder, Game.Player.Character.Position);
  38.                 PrintText("adder spawned", 2000);
  39.             }
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement