local szaboautotheft = {}

--configs
local wantedlevelforstealing = 1
local disablemodkey = 107
local modenabled = true

--		KEY CODES
--
--	Space = 32            D4 = 52       O = 79             NumPad4 = 100         F9 = 120
--  PageUp = 33           D5 = 53       P = 80             NumPad5 = 101         F10 = 121
--	Next = 34             D6 = 54       Q = 81             NumPad6 = 102         F11 = 122
--  End = 35              D7 = 55       R = 82             NumPad7 = 103         F12 = 123
--	Home = 36             D8 = 56       S = 83             NumPad8 = 104         F13 = 124
--  Left = 37             D9 = 57       T = 84             NumPad9 = 105         F14 = 125
--	Up = 38               A = 65        U = 85             Multiply = 106        F15 = 126
--  Right = 39            B = 66        V = 86             Add = 107             F16 = 127
--	Down = 40             C = 67        W = 87             Separator = 108       F17 = 128
--  Select = 41           D = 68        X = 88             Subtract = 109        F18 = 129
--  Print = 42            E = 69        Y = 89             Decimal = 110         F19 = 130
--	Execute = 43          F = 70        Z = 90             Divide = 111          F20 = 131
--  PrintScreen = 44      G = 71        LWin = 91          F1 = 112              F21 = 132
--	Insert = 45           H = 72        RWin = 92          F2 = 113              F22 = 133
--  Delete = 46           I = 73        Apps = 93          F3 = 114              F23 = 134
--	Help = 47             J = 74        Sleep = 95         F4 = 115              F24 = 135
--  D0 = 48               K = 75        NumPad0 = 96       F5 = 116            
--	D1 = 49               L = 76        NumPad1 = 97       F6 = 117            
--  D2 = 50               M = 77        NumPad2 = 98       F7 = 118            
--	D3 = 51               N = 78        NumPad3 = 99       F8 = 119   
--end configs

local texttimer = 100
local texttoshow = "Auto Theft Mod"
local function showtext5(str)
	texttimer = 300
	texttoshow = str
end

local function drawtext5()
	UI.SET_TEXT_FONT(0)
	UI.SET_TEXT_SCALE(0.5, 0.6)
	UI.SET_TEXT_COLOUR(255, 0, 0, 255)
	UI.SET_TEXT_WRAP(0, 1)
	UI.SET_TEXT_CENTRE(true)
	UI.SET_TEXT_DROPSHADOW(15, 15, 0, 0, 0)
	UI.SET_TEXT_EDGE(5, 0, 0, 0, 255)
	UI._SET_TEXT_ENTRY("STRING")
	UI._ADD_TEXT_COMPONENT_STRING(texttoshow)
	UI._DRAW_TEXT(0.5, 0.1)
	texttimer = texttimer-1
end

local function szclamp(val, xmin, xmax)
	if (val < xmin) then
		return xmin
	elseif (val > xmax) then
		return xmax
	else
		return val
	end
end

local function addmoneytoplayer(val)

	mhash = GAMEPLAY.GET_HASH_KEY("SP0_TOTAL_CASH")
	if (PED.IS_PED_MODEL(PLAYER.PLAYER_PED_ID(), GAMEPLAY.GET_HASH_KEY("player_one"))) then                                
		mhash = GAMEPLAY.GET_HASH_KEY("SP1_TOTAL_CASH")                                     
	elseif (PED.IS_PED_MODEL(PLAYER.PLAYER_PED_ID(), GAMEPLAY.GET_HASH_KEY("player_two"))) then
		mhash = GAMEPLAY.GET_HASH_KEY("SP2_TOTAL_CASH")  
	end
	
	local _, curval = STATS.STAT_GET_INT(mhash, 0, -1)
	STATS.STAT_SET_INT(mhash, curval+val, true)
		
end

local carslist = {

{0xB779A091,	10000		},--adder							
--{0x4C80EB0E,	25000		},--airbus							
--{0x5D0AAC8F,	500			},--airtug							
{0x63ABADE7,	900			},--akuma							
--{0x45D56ADA,	40000		},--ambulance							
--{0x31F0B376,	250000	 	},--annihilator							
--{0xB8081009,	500 		},--armytanker							
--{0xA7FF33F5,	500 		},--armytrailer	(army flatbed trailer)				
--{0x9E6B14D6,	500 		},--armytrailer2 (flatbed with cutter trailer)			
{0x94204D89,	4500		},--asea							
--{0x9441D8D5,	4500	 	},--asea2 (snowy asea)					
{0x8E9254FB,	3500	 	},--asterope							
{0x806B9CC3,	700	 		},--bagger							
--{0xE82AE656,	500 		},--baletrailer							
{0xCFCA3668,	7000	 	},--baller							
{0x08852855,	9000	 	},--baller2	(RangeRover	Evoque)					
{0xC1E908D2,	9000		},--banshee							
--{0xCEEA3F4B,	45000	 	},--barracks (barracks with backcover)				
--{0x4008EABB,	45000		},--barracks2 (barracks semi)					
{0xF9300CC5,	1000	 	},--bati							
{0xCADD5D2D,	1200	 	},--bati2 (bati	livery)					
{0x7A61B330,	12500	 	},--benson							
{0x432AA566,	1600	 	},--bfinjection							
{0x32B91AE8,	8500	 	},--biff							
{0xFEFD644F,	3000	 	},--bison							
--{0x7B8297C5,	3000	 	},--bison2 (cowboy	construction bison)				
--{0x67B3F020,	3000	 	},--bison3 (landscapeing bison)					
{0x32B29A4B,	9500	 	},--bjxl							
{0x8125BCF9,	800	 		},--blazer							
--{0xFD231729,	900	 		},--blazer2 (lifeguard blazer)					
--{0xB44F0582,	1200	 	},--blazer3 (trevor's hotrod blazer)				
--{0xF7004C86,	500 		},--blimp							
{0xEB70965F,	2500		},--blista							
--{0x43779C54,	50	 		},--bmx							
--{0x1F3D44B5,	500 		},--boattrailer (trailer for boats)				
{0x3FC5D440,	2300	 	},--bobcatxl							
--{0xAA699BB6,	2500	 	},--bodhi2 (trevor's truck)					
--{0x898ECCEA,	4500	 	},--boxville (water&power boxville)					
--{0xF21B33BE,	4500	 	},--boxville2 (postal boxville)					
--{0x07405E08,	4500	 	},--boxville3 (humane boxville)					
{0xD756460C,	3500	 	},--buccaneer							
{0xEDD516C6,	3500	 	},--buffalo							
{0x2BEC3CBE,	3500		},--buffalo2 (franklin's buffalo)					
--{0x7074F39D,	12500	 	},--bulldozer							
{0x9AE6DDA1,	15500		},--bullet							
--{0xAFBB2CA4,	1500		},--burrito	(cowboy	construction phartegas atomic water & power
--{0xC9E8FF76,	1500		},--burrito2 (bugstars burrito)					
--{0x98171BD3,	1500	 	},--burrito3 (nolivery burrito)					
--{0x353B561D,	1500	 	},--burrito4 (cowboy construction burrito)				
--{0x437CF2A0,	1500		},--burrito5 (snowy	burrito)					
--{0xD577C962,	25000	 	},--bus							
--{0x2F03547B,	120000	 	},--buzzard							
--{0x2C75F0DD,	200000	 	},--buzzard2 (buzzard with nogun)				
--{0xC6C3242D,	500 		},--cablecar							
--{0x44623884,	520			},--caddy (prolaps caddy)					
--{0xDFF0594C,	520	 		},--caddy2 (caddy convertible)					
--{0x6FD95F68,	760	 		},--camper							
{0x7B8AB45F,	19500	 	},--carbonizzare							
{0x00ABB0C0,	4000	 	},--carbonrs							
--{0xFCFCB68B,	220000	 	},--cargobob							
--{0x60A7EA10,	220000	 	},--cargobob2 (medical cargobob)					
--{0x53174EEF,	220000	 	},--cargobob3 (trevor's	cargobob)					
--{0x15F27762,	500 		},--cargoplane							
{0x779F23AA,	6000	 	},--cavalcade (gtaiv cavalcade/Cadillac Escalade 2005)			
{0xD0EB2BE5,	6000		},--cavalcade2 (gtav cavalcade/Cadillac Escalade 2013)			
{0xB1D95DA0,	65000		},--cheetah							
--{0x84718D34,	7500		},--coach							
{0x13B57D8A,	18500	 	},--cogcabrio							
{0xC1AE4D16,	8500	 	},--comet2							
{0x067BC037,	9500	 	},--coquette							
--{0x1ABA13B5,	300	 		},--cruiser							
--{0x132D5A1A,	22500	 	},--crusader							
--{0xD9927FE3,	500 		},--cuban800							
--{0xC3FBA120,	455500	 	},--cutter							
{0x77934CEE,	1500	 	},--daemon							
{0xBC993509,	2500	 	},--dilettante							
--{0x64430650,	2500	 	},--dilettante2	(merryweather patrol car)				
--{0x3D961290,	500 		},--dinghy							
--{0x107F392C,	500 		},--dinghy2	(2-Seater)						
{0x698521E3,	400			},--dloader							
--{0x806EFBEE,	500 		},--docktrailer	(shipping container	trailer)				
--{0xCB44B1CA,	2500	 	},--docktug							
{0x04CE68AC,	6500	 	},--dominator							
{0x9C669788,	1200	 	},--double							
{0x462FE277,	15500		},--dubsta							
{0xE882E5F6,	16500		},--dubsta2	(blacked out dubsta)				
--{0x810369E2,	4500		},--dump							
{0x9CF21E0F,	2000	 	},--dune							
{0x1FD824AF,	25000	 	},--dune2 (spacedocker)						
--{0x39D6779E,	27500	 	},--duster							
{0xDE3D9D22,	9500	 	},--elegy2							
{0xD7278283,	2500	 	},--emperor							
--{0x8FC3AADC,	500	 		},--emperor2 (rusty emperor)					
--{0xB5FCF74E,	2500	 	},--emperor3 (snowy emperor)					
{0xB2FE5CF9,	79500	 	},--entityxf							
{0xFFB15B5E,	20500	 	},--exemplar							
{0xDCBCBE48,	18500	 	},--f620							
{0x0350D1AB,	500	 		},--faggio2							
--{0x432EA949,	8500	 	},--fbi	(fbi buffalo)					
--{0x9DC66994,	16500	 	},--fbi2 (fbi granger)					
{0xE8A8BDA8,	10000	 	},--felon							
{0xFAAD85EE,	11000	 	},--felon2 (felon gt convertible)				
{0x8911B9F5,	14500	 	},--feltzer2							
--{0x73920F8E,	150000	 	},--firetruk							
{0xCE23D3BF,	400	 		},--fixter							
--{0x50B0215A,	5500	 	},--flatbed							
--{0x58E49664,	800	 		},--forklift							
{0xBC32A33B,	16500	 	},--fq2							
--{0x3D6AAA9B,	500 		},--freight	(train)						
--{0x0AFD22A6,	500			},--freightcar							
--{0x36DCFF98,	500			},--freightcont1							
--{0x0E512E79,	500			},--freightcont2							
--{0x264D9262,	500			},--freightgrain							
--{0xD1ABB666,	500			},--freighttrailer (big flatbed trailer)				
--{0x2C634FBD,	130000	 	},--frogger							
--{0x742E9AC0,	130000	 	},--frogger2 (trevor's frogger)					
{0x71CB2FFB,	2400	 	},--fugitive							
{0x1DC0BA53,	3600	 	},--fusilade							
{0x7836CE2F,	1500	 	},--futo							
{0x94B395C5,	3200	 	},--gauntlet							
{0x97FA4F36,	2500	 	},--gburrito							
--{0x3CC7F596,	500 		},--graintrailer							
{0x9628879C,	3500		},--granger							
{0xA3FC0F4D,	2900		},--gresley							
{0x34B7390F,	2500		},--habanero							
--{0x1A7FCEFA,	50000	 	},--handler							
--{0x5A82F9AE,	15000	 	},--hauler							
{0x11F76C14,	1500	 	},--hexer							
{0x0239E390,	9000	 	},--hotknife							
{0x18F25AC7,	44000	 	},--infernus							
{0xB3206692,	900	 		},--ingot							
{0x34DD8AA1,	1600		},--intruder							
{0xB9CB3B69,	1800	 	},--issi2 (issi convertible)					
{0xDAC67112,	1500	 	},--jackal							
{0x3EAB5555,	47500	 	},--jb700							
--{0x3F119114,	500 		},--jet							
--{0x33581161,	500 		},--jetmax							
--{0xF8D48E7A,	1400	 	},--journey							
{0x206D1B68,	10000	 	},--khamelion							
{0x4BA4E8DC,	5800	 	},--landstalker							
--{0xB39B0AE6,	500000	 	},--lazer							
--{0x1BF8D381,	1500	 	},--lguard							
--{0x250B0C5E,	500 		},--luxor							
--{0x97E55D11,	500 		},--mammatus							
{0x81634188,	1000	 	},--manana							
--{0xC1CE1183,	500			},--marquis							
--{0x9D0450CA,	78000	 	},--maverick							
{0x36848602,	2000		},--mesa							
--{0xD36A4B44,	2000	 	},--mesa2 (snowy mesa)					
{0x84F42E51,	5000		},--mesa3 (merryweather mesa)					
--{0x33C9E158,	500 		},--metrotrain							
{0xED7EADA4,	3000		},--minivan							
--{0xD138A6BB,	3500		},--mixer							
--{0x1C534995,	3500		},--mixer2 (wheels on back)				
{0xE62B361B,	49000	 	},--monroe							
--{0x6A4BD8F6,	100	 		},--mower							
--{0x35ED670B,	1500	 	},--mule							
--{0xC1632BEB,	1500	 	},--mule2	(?)						
{0xDA288376,	1200	 	},--nemesis							
{0x3D8FA25C,	12000	 	},--ninef							
{0xA8E38B01,	12000	 	},--ninef2 (ninef convertible)					
{0x506434F6,	8000	 	},--oracle (gta4 oracle)					
{0xE18195B2,	8000	 	},--oracle2	(oracle xs)					
--{0x21EEE87D,	16500	 	},--packer							
{0xCFCFEB3B,	5000	 	},--patriot							
--{0x885F3671,	15000	 	},--pbus							
{0xC9CEAF06,	900	 		},--pcj							
{0xE9805550,	2400	 	},--penumbra							
{0x6D19CCBC,	1500	 	},--peyote							
{0x809AA4CB,	19500	 	},--phantom							
{0x831A21D5,	3500	 	},--phoenix							
{0x59E0FBF3,	1500	 	},--picador							
--{0x79FBB0C5,	4500	 	},--police (police stanier)					
--{0x9F05F101,	5500	 	},--police2	(police	buffalo)					
--{0x71FA16EA,	4500	 	},--police3	(police	interceptor)					
--{0x8A63C7B9,	3500	 	},--police4	(undercover	police stanier)				
--{0xFDEFAEC3,	1500	 	},--policeb	(police	bike)					
--{0xA46462F7,	2500	 	},--policeold1 (snowy police rancher)				
--{0x95F4C618,	2500	 	},--policeold2 (snowy police esperanto)				
--{0x1B38E955,	3000	 	},--policet	(police	transport van)				
--{0x1517D4D9,	85000	 	},--polmav							
--{0xF8DE29A8,	1300	 	},--pony (sunset bleach sprunk postal pony)		
--{0x38408341,	1300	 	},--pony2 (weed van)					
--{0x7DE35E7D,	9500	 	},--pounder							
{0xA988D3A2,	2800	 	},--prairie							
--{0x2C33B46E,	4500	 	},--pranger							
--{0xE2E7D4AB,	500 		},--predator							
{0x8FB66F9B,	190 		},--premier							
{0xBB6B404F,	2100 		},--primo							
--{0x153E1B0A,	500			},--proptrailer	(mobile	home trailer)				
{0x9D96B45B,	9500	 	},--radi							
--{0x174CB172,	500			},--raketrailer							
{0x6210CBB0,	4500	 	},--rancherxl							
--{0x7341576B,	4500	 	},--rancherxl2 (snowy rancher)					
{0x8CB29A14,	13200	 	},--rapidgt							
{0x679450AF,	14000	 	},--rapidgt2 (rapid gt convertible)				
{0xD83C13CE,	3750	 	},--ratloader							
--{0xB802DD46,	1800	 	},--rebel (rusty rebel)					
{0x8612B64B,	2200		},--rebel2 (clean rebel)					
{0xFF22D208,	1600	 	},--regina							
--{0xBE819C63,	9500		},--rentalbus							
--{0x2EA68690,	300000	 	},--rhino							
--{0xB822A1AA,	55000		},--riot							
--{0xCD935EF9,	15000		},--ripley							
{0x7F5C91F1,	8500	 	},--rocoto							
{0x2560B2FC,	3500	 	},--romero							
--{0x9A5B1DCC,	3500	 	},--rubble							
{0xCABD11E8,	1000	 	},--ruffian							
{0xF26CEFF9,	3200		},--ruiner							
--{0x4543B74D,	1500	 	},--rumpo (weazel	news rumpo)				
--{0x961AFEF7,	1500	 	},--rumpo2 (deludamol rumpo)					
{0x9B909C94,	2800	 	},--sabregt							
{0xDC434E51,	3500	 	},--sadler							
--{0x2BC345D1,	3500	 	},--sadler2	(snowy sadler)					
{0x2EF89E46,	700			},--sanchez	(sanchez livery)					
{0xA960B13E,	700	 		},--sanchez2 (sanchez paint)					
{0xB9210FD0,	4500	 	},--sandking (sandking 4 door)				
{0x3AF8C345,	6500	 	},--sandking2 (sandking 2 door)				
{0xB52B5113,	3500		},--schafter2							
{0xD37B7976,	8000	 	},--schwarzer							
--{0xF4E1AA15,	100	 		},--scorcher							
--{0x9A9FD3DF,	2500	 	},--scrap							
--{0xC2974024,	500			},--seashark (speedophile seashark)					
--{0xDB4388E4,	500			},--seashark2 (lifeguard seashark)					
{0x48CECED3,	3000	 	},--seminole							
{0x50732C82,	2500	 	},--sentinel (sentinel xs)					
{0x3412AE2D,	2500	 	},--sentinel2 (sentinel Convertible)					
{0x4FB1A214,	4500	 	},--serrano							
--{0xB79C1BF5,	500 		},--shamal							
--{0x9BAA707C,	4500	 	},--sheriff	(sheriff stanier)					
--{0x72935408,	6500	 	},--sheriff2 (sheriff granger)					
--{0x3E48BF23,	250000	 	},--skylift							
{0xCFB3870C,	1500	 	},--speedo							
--{0x2B6DC64A,	1500	 	},--speedo2	(clown van)					
--{0x17DF5EC2,	500 		},--squalo							
{0xA7EDE74D,	1000		},--stanier							
{0x5C23AF9B,	100000	 	},--stinger							
{0x82E499FA,	110000	 	},--stingergt							
--{0x6827CF72,	1800	 	},--stockade							
--{0xF337AB36,	1800		},--stockade3 (snowy stockade)					
{0x66B4FC45,	2200	 	},--stratum							
--{0x8B13F083,	18000	 	},--stretch							
{0x81794C70,	25000	 	},--stunt							
--{0x2DFF622F,	500			},--submersible							
{0x39DA2754,	5800	 	},--sultan							
--{0xEF2295C9,	500			},--suntrap							
{0x42F2ED16,	25000	 	},--superd							
{0x16E478C1,	9900	 	},--surano							
{0x29B0DA97,	1300	 	},--surfer (surfer	with surfboard)				
{0xB1D80E06,	1300	 	},--surfer2	(surfer	without	surfboard)				
{0x8F0E3594,	3100	 	},--surge							
--{0x744CA80D,	1500	 	},--taco							
{0xC3DDFDCE,	5500	 	},--tailgater							
--{0xD46F4737,	500			},--tanker							
--{0x22EDDC30,	500			},--tankercar							
--{0xC703DB5F,	2500	 	},--taxi							
--{0x02E19879,	2500	 	},--tiptruck							
--{0xC7824E5E,	2500	 	},--tiptruck2 (sand)						
--{0x761E2AD3,	500			},--titan							
{0x1BB290BC,	1500	 	},--tornado	(clean tornado)					
{0x5B42A5C4,	1700	 	},--tornado2 (clean tornado	with carbon	roof)		
--{0x690A4153,	900	 		},--tornado3 (rusty tornado)					
--{0x86CF7CDD,	1600	 	},--tornado4 (tornado with uitar/mariachi car)			
--{0x73B1C3CB,	8500	 	},--tourbus							
--{0xB12314E0,	3500	 	},--towtruck (large towtruck)					
--{0xE5A2D6C6,	3000	 	},--towtruck2 (small towtruck)					
--{0x7BE032C6,	500			},--tr2	(car carrier trailer)				
--{0x6A59902D,	500 		},--tr3	(marquis trailer)					
--{0x7CAB34D0,	500 		},--tr4	(super car carrier trailer)			
--{0x61D6BA8C,	100	 		},--tractor	(rusty tractor)					
--{0x843B73DE,	6500	 	},--tractor2 (farm tractor)					
--{0x562A97BD,	6500		},--tractor3 (snowy tractor)					
--{0x782A236D,	500			},--trailerlogs	(log trailer)					
--{0xCBB2BE0E,	500			},--trailers (metal trailer)					
--{0xA1DA3C91,	500			},--trailers2 (up & atom cluckinbell piswasser trailer)	
--{0x8548036D,	500			},--trailers3 (biggoods trailer)					
--{0x2A72BEAB,	500			},--trailersmall (small construction	trailer)				
--{0x72435A19,	8500	 	},--trash							
--{0xAF62F6B2,	500			},--trflat (flatbed trailer)					
{0x4339CD69,	250			},--tribike	(green whippet race	bike)			
{0xB67597EC,	250	 		},--tribike2 (red endurex race bike)			
{0xE823FB48,	250	 		},--tribike3 (blue tri-cycles race bike)			
--{0x1149422F,	500 		},--tropic							
--{0x967620BE,	500			},--tvtrailer (fame or shame trailer)			
--{0x1ED0A534,	2500 		},--utillitruck	(building & renovation utillitruck)			
--{0x34E6BF6B,	2500		},--utillitruck2 (landscapegasbuilding&renovationutillitruck)	
--{0x7F2153DF,	2500		},--utillitruck3 (landscape utillitruck)					
{0x142E0DC3,	24000		},--vacca							
{0xF79A00F7,	900			},--vader							
--{0x9C429B6A,	500 		},--velum							
{0xCEC6B9B7,	2100 		},--vigero							
{0x9F4B77BE,	15000 		},--voltic							
{0x1F3766E3,	800	 		},--voodoo2	(rusty voodoo)					
{0x69F06B57,	2500	 	},--washington							
{0x03E5F6B8,	1600	 	},--youga							
{0xBD1B39C3,	5000	 	},--zion (zion xs)					
{0xB8E2AE18,	5400	 	},--zion2 (zion Convertible)					
{0x2D3BD401,	1000000		},--ztype							
{0x49863E9C,	25000		},--marshall
{0xEC8F7094,	27900		},--dukes2
{0xDCBC1C3B,	1700		},--blista3
{0x3DEE5EDA,	1700		},--blista2
--{0xCA495705,	100000		},--dodo
--{0xC07107EE,	100000		},--submersible2
{0xE2C013E,		4200		},--buffalo3
{0x2B26F456,	6200		},--dukes
{0x72A4C31E,	7100		},--stalion
{0xE80F67EE,	7100		},--stalion2
{0xC96B73D9,	7500		},--dominator2
{0x14D22159,	4200		},--gauntlet2
--{0xDB6B4924,	100000		},--Blimp2
{0xEB298297,	7500		},--bifta
{0x05852838,	5100		},--kalahari
{0x58B3979C,	5000		},--paradise
--{0x0DC60D2B,	100000		},--speeder
{0x06FF6914,	50000		},--btype
{0xB2A716A3,	24000		},--jester
{0x185484E1,	50000		},--turismor
{0x2DB8D1AA,	15000		},--alpha
--{0x4FF77E37,	100000		},--vestra
{0xF77ADE32,	27500		},--massacro
{0xAC5DF515,	72500		},--zentorno
{0x1D06D681,	19500		},--huntley
{0x6D6F8F43,	7500		},--thrust
{0x322CF98F,	14000		},--rhapsody
{0x51D83328,	12000		},--warrener
{0xB820ED5E,	16000		},--blade
{0x047A6BC1,	20000		},--glendale
{0xE644E480,	8500		},--panto
{0xB6410173,	24900		},--dubsta3
{0x404B6381,	40000		},--pigalle
{0xCD93A7DB,	40000		},--monster
{0x2C509634,	2000		},--sovereign
--{0x6CBD1D6D,	100000		},--besra
--{0x09D80F93,	100000		},--iljmiljet
{0x3C4E2113,	39500		},--coquette2 
--{0xEBC24DF2,	150000		},--swift
{0x44C4E977,	9250		},--innovat
{0x4B6C568A,	8200		},--hakuchou
{0xBF1691E0,	44800		},--furoregt
{0xBE0E6126,	35000		},--jester2
{0xDA5819A3,	29000		},--massacro2
{0xDCE1D9F7,	3900		},--ratloader2
{0x2B7F9DE3,	2000		},--slamvan
--{0x85A5B471,	2000		},--mule3
--{0x403820E8,	100000		},--velum2
--{0x74998082,	100000		},--tanker2
{0x3822BDFE,	68000		},--casco
--{0x1A79847A,	1600		},--boxville4
--{0x39D6E83F,	300000		},--hydra
--{0x9114EADA,	67500		},--insurgent
--{0x7B7E56F0,	65000		},--insurgent2
{0x11AA0E14,	1800		},--gburrito2
--{0x83051506,	95000		},--technical
--{0x1E5E54EA,	100000		},--dinghy3
--{0xFB133A17,	195000		},--savage
{0x6882FA73,	4800		},--enduro
{0x825A9F4C,	37500		},--guardian
{0x26321E67,	75000		},--lectro
{0xAE2BFE94,	9500		},--kuruma
--{0x187D938D,	19500		},--kuruma2
--{0xB527915C,	3500		},--trash2
--{0x2592B5CF,	45000		},--barracks3
--{0xA09E15FD,	285000		},--valkyrie
{0x31ADBBFC,	2100		}--slamvan2

}

local cargo1list = {
--cargo lvl 1 50k - 300k
0xAFBB2CA4,
0xC9E8FF76,
0x98171BD3,
0x353B561D,
0xF8DE29A8,
0x38408341,
0x4543B74D,
0x961AFEF7,
0xCFB3870C,
0x2B6DC64A,
0x03E5F6B8
}

local cargo2list = {
--cargo lvl 2 300k-2m
0x7DE35E7D,
0x7A61B330,
0xF21B33BE,
0x07405E08,
0x35ED670B,
0xC1632BEB
}

local cargo3list = {
--stockade (lvl 3) 2-5m
0x6827CF72
}

local carspeds = {
0xBE086EFD,	--	A_F_M_BevHills_01
0xA039335F,	--	A_F_M_BevHills_02
-- 0x3BD99114,	--	A_F_M_BodyBuild_01
-- 0x1FC37DBC,	--	A_F_M_Business_02
0x654AD86E,	--	A_F_M_Downtown_01
0x445AC854,	--	A_F_Y_BevHills_01
0x5C2CF7F8,	--	A_F_Y_BevHills_02
-- 0x20C8012F,	--	A_F_Y_BevHills_03
-- 0x36DF2D5D,	--	A_F_Y_BevHills_04
-- 0x2799EFD8,	--	A_F_Y_Business_01
-- 0x31430342,	--	A_F_Y_Business_02
0xAE86FDB4,	--	A_F_Y_Business_03
0xB7C61032,	--	A_F_Y_Business_04
-- 0x563B8570,	--	A_F_Y_Tourist_01
-- 0x9123FB40,	--	A_F_Y_Tourist_02
0x19F41F65,	--	A_F_Y_Vinewood_01
0xDAB6A0EB,	--	A_F_Y_Vinewood_02
0x379DDAB8,	--	A_F_Y_Vinewood_03
0xFAE46146,	--	A_F_Y_Vinewood_04
0xC99F21C4,	--	A_M_Y_Business_01
0xB3B3F5E6,	--	A_M_Y_Business_02
0xA1435105,	--	A_M_Y_Business_03
0x4B64199D,	--	A_M_Y_Vinewood_01
0x5D15BD00,	--	A_M_Y_Vinewood_02
0x1FDF4294,	--	A_M_Y_Vinewood_03
0x31C9E669,	--	A_M_Y_Vinewood_04
0x54DBEE1F,	--	A_M_M_BevHills_01
0x3FB5C3D3,	--	A_M_M_BevHills_02
0x7E6A64B7,	--	A_M_M_Business_01
}

local cargospeds = {
0x59511A6C,	--	S_M_M_Trucker_01
-- 0xF5B0079D,	--	A_F_Y_EastSA_01
-- 0x0438A4AE,	--	A_F_Y_EastSA_02
-- 0x51C03FA4,	--	A_F_Y_EastSA_03
0xF9A6F53F,	--	A_M_M_EastSA_01
0x07DD91AC,	--	A_M_M_EastSA_02
0xA4471173,	--	A_M_Y_EastSA_01
0x168775F6	--	A_M_Y_EastSA_02
}

local cargo3peds = {
0xD768B228,	--	S_M_M_Security_01
0x95C76ECD,	--	S_M_M_Armoured_01
0x63858A4A	--	S_M_M_Armoured_02
}

local weapons = {
"WEAPON_PISTOL",
"WEAPON_COMBATPISTOL",
--"WEAPON_APPISTOL",
"WEAPON_PISTOL50",
"WEAPON_MICROSMG",
--"WEAPON_SMG",
--"WEAPON_ASSAULTSMG",
--"WEAPON_ASSAULTRIFLE",
--"WEAPON_CARBINERIFLE",
--"WEAPON_ADVANCEDRIFLE",
--"WEAPON_MG",
--"WEAPON_COMBATMG",
--"WEAPON_PUMPSHOTGUN",
"WEAPON_SAWNOFFSHOTGUN",
--"WEAPON_ASSAULTSHOTGUN",
--"WEAPON_BULLPUPSHOTGUN",
"WEAPON_STUNGUN",
-- "WEAPON_GRENADELAUNCHER",
-- "WEAPON_RPG",
--"WEAPON_MINIGUN",
-- "WEAPON_GRENADE"
}

local modcols = {
{255,0,0},
{0,255,0},
{0,0,255},
{255,255,0},
{0,255,255},
{255,0,255},
{255,100,0},
{153, 255, 51},
{0, 255, 204},
{102, 0, 255},
{102, 0, 204},
{255, 51, 153},
{0, 204, 0}
}

local target = 0
local payment = 0
local pedslist = {}
local lscblip = 0
local waittime = 0
local stealtrigger = false
-- local jacktrigger = false

local function deletev()
	for _,v in ipairs(pedslist) do
		ENTITY.DELETE_ENTITY(v)
	end
	pedslist = {}
	
	VEHICLE.DELETE_VEHICLE(target)
	print('SZAT - deleted')
	target = 0;
	payment = 0
	stealtrigger = false
	waittime = 0
	
end

local function spawnv(vtr)
		
		local driver = VEHICLE.GET_PED_IN_VEHICLE_SEAT(vtr,-1)
		
		local chance = GAMEPLAY.GET_RANDOM_INT_IN_RANGE(1,70)
		if (driver ~= 0) then
			chance = GAMEPLAY.GET_RANDOM_INT_IN_RANGE(1,101)
		end
		
		
		local hash = 0
		local pedlist = {}
		
		local spawnpos = ENTITY.GET_ENTITY_COORDS(vtr, true)
		local lscdist = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(spawnpos.x,spawnpos.y,spawnpos.z, -374.5, -122.5, 38.5, true)
		
		local rich = false
		
		if (chance < 70) then --TODO ADJUST
			cdata = carslist[GAMEPLAY.GET_RANDOM_INT_IN_RANGE(1,#carslist+1)]
			hash = cdata[1]
			payment = cdata[2]
			if(chance > 40) then
				pedlist = carspeds
				rich = true
			else
				pedlist = cargospeds
			end
		elseif (chance < 85) then
			hash = cargo1list[GAMEPLAY.GET_RANDOM_INT_IN_RANGE(1,#cargo1list+1)]
			payment = GAMEPLAY.GET_RANDOM_INT_IN_RANGE(5000,10000) + (lscdist*10)
			pedlist = cargospeds
		elseif (chance < 95) then
			hash = cargo2list[GAMEPLAY.GET_RANDOM_INT_IN_RANGE(1,#cargo2list+1)]
			payment = GAMEPLAY.GET_RANDOM_INT_IN_RANGE(10000,50000) + (lscdist*50)
			pedlist = cargospeds
		else
			hash = cargo3list[GAMEPLAY.GET_RANDOM_INT_IN_RANGE(1,#cargo3list+1)]
			payment = GAMEPLAY.GET_RANDOM_INT_IN_RANGE(50000,100000) + (lscdist*100)
			pedlist = cargo3peds
		end
		
		payment = math.floor(payment)
		
		
		if (STREAMING.IS_MODEL_IN_CDIMAGE(hash) and STREAMING.IS_MODEL_A_VEHICLE(hash)) then
		
			STREAMING.REQUEST_MODEL(hash)
			
			stealtrigger = true;
			-- jacktrigger = true
			
			while (not STREAMING.HAS_MODEL_LOADED(hash)) do
				wait(0)
			end
			
			local vheading = ENTITY.GET_ENTITY_HEADING(vtr)
			
			ENTITY.SET_ENTITY_AS_MISSION_ENTITY(vtr, true, true)
			VEHICLE.DELETE_VEHICLE(vtr)
			
			newv = VEHICLE.CREATE_VEHICLE(hash, spawnpos.x,spawnpos.y,spawnpos.z, vheading, true, true)
			
			if (chance < 60) then
				--mod the v
				local cols = modcols[GAMEPLAY.GET_RANDOM_INT_IN_RANGE(1,#modcols+1)]
				VEHICLE.SET_VEHICLE_MOD_KIT(newv, 0)
				
				local pc = GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,100)
				
				local paint = 0
				if (pc < 5) then
					paint = 5
				elseif (pc < 30) then
					paint = 3
				end
				
				VEHICLE.SET_VEHICLE_MOD_COLOR_1(newv, paint, 0, 0)
				VEHICLE.SET_VEHICLE_CUSTOM_PRIMARY_COLOUR(newv,cols[1],cols[2],cols[3])
				VEHICLE.SET_VEHICLE_EXTRA_COLOURS(newv, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,75), GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,41))
				VEHICLE.TOGGLE_VEHICLE_MOD(newv, 18, true)
				VEHICLE.SET_VEHICLE_WHEEL_TYPE(newv, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,7))
				VEHICLE.SET_VEHICLE_WINDOW_TINT(newv, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,6))
				VEHICLE.SET_VEHICLE_MOD(newv, 0, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,2), false)
				VEHICLE.SET_VEHICLE_MOD(newv, 1, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,2), false)
				VEHICLE.SET_VEHICLE_MOD(newv, 2, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,2), false)
				VEHICLE.SET_VEHICLE_MOD(newv, 3, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,2), false)
				VEHICLE.SET_VEHICLE_MOD(newv, 4, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,2), false)
				VEHICLE.SET_VEHICLE_MOD(newv, 5, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,2), false)
				VEHICLE.SET_VEHICLE_MOD(newv, 6, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,2), false)
				VEHICLE.SET_VEHICLE_MOD(newv, 7, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,2), false)
				VEHICLE.SET_VEHICLE_MOD(newv, 8, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,2), false)
				VEHICLE.SET_VEHICLE_MOD(newv, 9, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,2), false)
				VEHICLE.SET_VEHICLE_MOD(newv, 10, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,2), false)
				VEHICLE.SET_VEHICLE_MOD(newv, 11, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,4), false)
				VEHICLE.SET_VEHICLE_MOD(newv, 12, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,3), false)
				VEHICLE.SET_VEHICLE_MOD(newv, 13, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,3), false)
				VEHICLE.SET_VEHICLE_MOD(newv, 14, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,15), false)
				VEHICLE.SET_VEHICLE_MOD(newv, 15, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,4), false)
				VEHICLE.SET_VEHICLE_MOD(newv, 23, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,20), true)
			end
			
			if (driver ~= 0) then
				local numtogen = 1 --TODO set to 1 and make peds attack when v is hijacked
				if (rich) then
					numtogen = 0
				end
				
				-- PED.CREATE_GROUP(167)
				for i = 0, numtogen, 1 do
					pedhash = pedlist[GAMEPLAY.GET_RANDOM_INT_IN_RANGE(1,#pedlist+1)]
					
					STREAMING.REQUEST_MODEL(pedhash)
					while(not STREAMING.HAS_MODEL_LOADED(pedhash)) do
						wait(0)
					end
					local newped = PED.CREATE_PED( 0,pedhash,spawnpos.x,spawnpos.y,spawnpos.z,1,false,true)
					table.insert(pedslist, newped)
					-- PED.SET_PED_COMBAT_ATTRIBUTES(newped, 100, true)
					-- PED.SET_PED_COMBAT_ABILITY(newped, 100)
					-- AI.TASK_COMBAT_PED(newped, PLAYER.PLAYER_PED_ID(), 1, 1)
					-- PED.SET_PED_AS_ENEMY(newped, true)
					-- PED.SET_PED_STAY_IN_VEHICLE_WHEN_JACKED(newped, false)
					PED.SET_PED_AS_COP(newped, true)
					PED.SET_PED_CAN_SWITCH_WEAPON(newped,true)
					if (not rich) then
						WEAPON.GIVE_WEAPON_TO_PED(newped, GAMEPLAY.GET_HASH_KEY(weapons[GAMEPLAY.GET_RANDOM_INT_IN_RANGE(1,#weapons+1)]),1000,true,true)
					end
					-- PED.SET_PED_DIES_WHEN_INJURED(newped, false)
					-- PED.SET_PED_MAX_HEALTH(newped, 1000)
					-- PED.SET_PED_ARMOUR(newped, 1000)
					
					PED.SET_PED_INTO_VEHICLE(newped, newv, i-1)
					if (i==0) then
						--AI.TASK_VEHICLE_DRIVE_WANDER(newped, newv, 3, 2)
						AI.TASK_VEHICLE_DRIVE_WANDER(newped, newv, 30, 3)
					end
					
					-- PED.SET_PED_AS_GROUP_MEMBER(newped, 167)
					-- PED.SET_PED_RELATIONSHIP_GROUP_HASH(newped, GAMEPLAY.GET_HASH_KEY(""))
					
					STREAMING.SET_MODEL_AS_NO_LONGER_NEEDED(pedhash)
				end
			else
				VEHICLE.SET_VEHICLE_NEEDS_TO_BE_HOTWIRED(newv, true)
				VEHICLE.SET_VEHICLE_DOORS_LOCKED(newv,0)
				VEHICLE.SET_VEHICLE_DOORS_LOCKED(newv,1)
				VEHICLE.SET_VEHICLE_DOORS_LOCKED_FOR_ALL_PLAYERS(newv,true)
				VEHICLE.SET_VEHICLE_ALARM(newv, true)
			end
			
			
			VEHICLE.SET_VEHICLE_ON_GROUND_PROPERLY(newv)
			ENTITY.SET_ENTITY_AS_MISSION_ENTITY(newv, true, true)
			
			STREAMING.SET_MODEL_AS_NO_LONGER_NEEDED(hash)
			
			ENTITY.SET_ENTITY_AS_MISSION_ENTITY(newv, true, true)
			local blip = UI.ADD_BLIP_FOR_ENTITY(newv)
			--UI.SET_BLIP_SCALE(blip, 1.6)
			UI.SET_BLIP_COLOUR(blip, 0xFF00DDFF)
			
			if (chance < 70) then
				showtext5("There's a VALUABLE CAR nearby you can sell. It's marked on your GPS.\nPayment: $"..tostring(payment))
			else
				showtext5("There's a CARGO VEHICLE nearby you can sell. It's marked on your GPS.\nPayment: $"..tostring(payment))
			end
			
			return newv
		
		end

end

function szaboautotheft.unload() end
function szaboautotheft.init()

end

local lastplayerinv = false
local routerefresh = 0
local searchangle = 0

local lastdisablekeystate = false

function szaboautotheft.tick()
	-- dump pos = -374.5, -122.5, 38.5
	
	if (texttimer > 0) then
		drawtext5()
	end
	
	if(get_key_pressed(disablemodkey) and not lastdisablekeystate) then
		modenabled = not modenabled
	
		if modenabled then
			showtext5("Auto Theft Mod ENABLED")
		else
			deletev()
			showtext5("Auto Theft Mod DISABLED")
		end
	end
	lastdisablekeystate = get_key_pressed(disablemodkey)
	
	if(not modenabled) then
		return 0
	end
	
	local playerPed = PLAYER.PLAYER_PED_ID()
	local player = PLAYER.GET_PLAYER_PED(playerPed)
	-- local playerID = PLAYER.PLAYER_ID()
	local playerPos = ENTITY.GET_ENTITY_COORDS(playerPed, true)
	
	local stars = PLAYER.GET_PLAYER_WANTED_LEVEL(player)
	
	-- print(stars)
	
	if (target == 0) then
	
		if (lscblip ~= 0) then
			UI.REMOVE_BLIP(lscblip)
		end
		
		
		local disttolsc = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerPos.x, playerPos.y, playerPos.z, -374.5, -122.5, 38.5, true)
		local searchradius = szclamp((disttolsc*0.003), 4, 20) --TODO FINE-TUNE THIS SH*T
		
		-- print (disttolsc,searchradius)
		
		searchangle = searchangle + 0.01
		if (searchangle > 2) then
			searchangle = 0
		end
		local searchdist = 180
		local searchpos = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, math.sin(searchangle*math.pi)*searchdist, math.cos(searchangle*math.pi)*searchdist, math.sin(searchangle*4*math.pi)*(searchdist*0.6))
		local rv = VEHICLE.GET_RANDOM_VEHICLE_IN_SPHERE(searchpos.x, searchpos.y, searchpos.z, searchradius, 0, 0)
	
		-- rv = VEHICLE.GET_CLOSEST_VEHICLE(playerPos.x, playerPos.y, playerPos.z, 5, 0, 70)
		
		--																				800
		if (not VEHICLE.IS_THIS_MODEL_A_CAR(ENTITY.GET_ENTITY_MODEL(rv)) or disttolsc < 500) then
			rv = 0
		end
		
		if (rv ~= 0 and stars == 0) then
		
			-- local t = ENTITY.GET_ENTITY_COORDS(rv, true)
			-- local disttolsc = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(t.x, t.y, t.z, -374.5, -122.5, 38.5, true)
			
			-- print('CAR FOUND, dtlsc',disttolsc)
			
			local rvpos = ENTITY.GET_ENTITY_COORDS(rv, true)
			-- local dist = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerPos.x, playerPos.y, playerPos.z, rvpos.x, rvpos.y, rvpos.z, true)
			
			-- print('dtp',dist)
			
			-- if (dist > 150 and dist < 250) then
			--if (dist > 1 and dist < 20) then
				
			if (UI.GET_BLIP_FROM_ENTITY(rv) == 0) then
				
				target = spawnv(rv)
				waittime = 1500

			end
			-- end

		end
	
	else
		local t = ENTITY.GET_ENTITY_COORDS(target, true)
		
		local playerinv = PED.IS_PED_IN_VEHICLE(playerPed, target, true)
		
		if (playerinv and not lastplayerinv) then
			nblip = UI.ADD_BLIP_FOR_COORD(-374.5, -122.5, 38.5)
			UI.SET_BLIP_COLOUR(nblip, 0x00FF00FF)
			lscblip = nblip
			print('added route blip')
		end
		lastplayerinv = playerinv
		
		if (playerinv and routerefresh > 100) then
			UI.SET_BLIP_ROUTE(lscblip, true)
			UI.SET_BLIP_ROUTE_COLOUR(lscblip, 0x00FF00FF)
			routerefresh = 0
			-- print('refreshing route')
		end
		routerefresh = routerefresh+1
		
		if (playerinv and stealtrigger) then
			stealtrigger = false
			playerID = PLAYER.PLAYER_ID()
			if (stars < wantedlevelforstealing) then
				PLAYER.SET_PLAYER_WANTED_LEVEL(playerID, wantedlevelforstealing, false)
				PLAYER.SET_PLAYER_WANTED_LEVEL_NOW(playerID, false)
			end
		end
		
		-- NO WAY TO MAKE THIS WORK
		-- if (jacktrigger and not playerinv) then
			-- jacktrigger = false
			-- local ped1 = VEHICLE.GET_PED_IN_VEHICLE_SEAT(target, -1)
			-- local ped2 = VEHICLE.GET_PED_IN_VEHICLE_SEAT(target, -1)
			-- if(PED.IS_PED_BEING_JACKED(ped1) or PED.IS_PED_BEING_JACKED(ped2)) then
				-- AI.TASK_LEAVE_VEHICLE(ped1, target, 4096) --4096
				-- AI.TASK_COMBAT_PED(ped1, PLAYER.PLAYER_PED_ID(), 1, 1)
				-- AI.TASK_LEAVE_VEHICLE(ped2, target, 4096)
				-- AI.TASK_COMBAT_PED(ped2, PLAYER.PLAYER_PED_ID(), 1, 1)
			-- end
		-- end
		
		-- print(VEHICLE.GET_VEHICLE_ENGINE_HEALTH(target))
		
		if(VEHICLE.GET_VEHICLE_ENGINE_HEALTH(target) < 600) then
			target = 0
			payment = 0
			while (UI.GET_BLIP_FROM_ENTITY(target) ~= 0) do
				UI.REMOVE_BLIP(UI.GET_BLIP_FROM_ENTITY(target))
				wait(0)
			end
			ENTITY.SET_VEHICLE_AS_NO_LONGER_NEEDED(target)
			showtext5("This vehicle is too damaged to sell")
		end
		
		if (waittime > 0) then
			waittime = waittime-1
		end
		print(waittime)
		
		--																										300	or not ENTITY.DOES_ENTITY_EXIST(target)
		if (GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerPos.x, playerPos.y, playerPos.z, t.x, t.y, t.z, true	) > 300 and waittime<=0) then
			deletev()
			showtext5("The vehicle was lost")
		elseif (GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(t.x, t.y, t.z, -374.5, -122.5, 38.5, true) < 30 and stars == 0) then
			if (playerinv) then
				texttoshow = "Leave the vehicle"
				drawtext5()
			else
				addmoneytoplayer(payment)
				deletev()
				payment = 0
				showtext5("Thanks for your business")
			end
		end
	end
	
end

return szaboautotheft