Jump to content

Custom Horns For Vehicle


koragg

Recommended Posts

Here goes nothing, but I'm trying to port this horns resource for my server and wanna make it super simple as well. But I'm not really sure how to continue with it, anyone who helps with whatever, no matter how small, is greatly appreciated as this thing I've been wanting for a long time now. What I've edited so far, code below:

horns_c.lua

local screenWidth, screenHeight = guiGetScreenSize()
downloadHornList = {}
hornsTable = {
	[1] = "Birdo-geluidje",
	[2] = "Boo-gebulder",
	[3] = "Come on! - Wario",
	[4] = "Dry Bones-gegiechel",
	[5] = "Hatsjwao! Oh sorry.. - Luigi",
	[6] = "Hey Stinky! - Mario",
	[7] = "Mushroom! - Toadette",
	[8] = "Peach-annoy",
	[9] = "Toad-boeee",
	[10] = "Yoshi-cool geluid",
	[11] = "You know I'll win! - Daisy",
	[12] = "You're lousy! - Waluigi",
	[13] = "The Dukes of hazzard",
	[14] = "Adios",
	[15] = "Aww crap",
	[16] = "Bad Boys",
	[17] = "Beat it!",
	[18] = "Billnye",
	[19] = "Callonme",
	[20] = "Come out",
	[21] = "Do'h",
	[22] = "English",
	[23] = "Feel good",
	[24] = "Haha",
	[25] = "Hello",
	[26] = "Madness",
	[27] = "Muh",
	[28] = "Muhaha",
	[29] = "Noobs",
	[30] = "Omg",
	[31] = "Sparta",
	[32] = "Suck",
	[33] = "Suckers",
	[34] = "Wazza",
	[35] = "Woohoo",
	[36] = "Yaba",
	[37] = "stewie",
	[38] = "titten",
	[39] = "buggle call",
	[40] = "random",
	[41] = "ring",
	[42] = "mario win",
	[43] = "goodbadugly",
	[44] = "who cares",
	[45] = "loser",
	[46] = "noooo",
	[47] = "cartman",
	[48] = "such a noob",
	[49] = "Screw you, that's funny",
	[50] = "hello again",
	[51] = "haaaaaai",
	[52] = "knock knock",
	[53] = "giggity",
	[54] = "shade aran",
	[55] = "YES,YES.",
	[56] = "Burn baby burn.",
	[57] = "Cry some moar!",
	[58] = "Davaj do svidanija",
	[59] = "WHAT YOU GONNA DO",
	[60] = "Dr.Zaius",
	[61] = "Here we go",
	[62] = "Holy :~",
	[63] = "It's my life",
	[64] = "JAAZZZZ",
	[65] = "Let's get ready to rumble",
	[66] = "What did you say :O!?",
	[67] = "Not a big surprise",
	[68] = "Livin' on a prayer",
	[69] = "Low Rider",
	[70] = "MammaMia",
	[71] = "Mariodeath",
	[72] = "My horse is amazing",
	[73] = "U can't touch this",
	[74] = "We are the champions",
	[75] = "We will rock you",
	[76] = "Bye have a great time",
	[77] = "Damn son! Where'd you find this",
	[78] = "Denied!",
	[79] = "Derp!1!",
	[80] = "Fart SFX",
	[81] = "Fatality",
	[82] = "Finish him!",
	[83] = "Giggity",
	[84] = "Gotya bitch",
	[85] = "Headshot!",
	[86] = "Hehe! Alright",
	[87] = "Here We Go!",
	[88] = "Like A Baus",
	[89] = "Prepare to be astonished",
	[90] = "Smoke Weed Everyday",
	[91] = "Tah daah",
	[92] = "That's nasty",
	[93] = "Toasty!",
	[94] = "Whaaat",
	[95] = "You got knocked the :O out",
	[96] = "You suck sound effect",
	[97] = "Haha You Suck",
	[98] = "Imma bust you up",
	[99] = "It's on, Baby",
	[100] = "Mess with the best",
	[101] = "That's gotta hurt",
	[102] = "Yo Whassup",
	[103] = "F--k you ceelo",
	[104] = "Stewie Mummy",
	[105] = "Hah, Ghaay",
	[106] = "J's on my feet",
	[107] = "Jim Carrey",
	[108] = "Minion laugh",
	[109] = "My :O my :O",
	[110] = "Darude - Sandstorm",
	[111] = "So it begins",
	[112] = "What are you doing",
	[113] = "Whoooaah",
	[114] = "Wiggle wiggle wiggle",
	[115] = "You shall not pass!",
	[116] = "Higher",
	[117] = "I need a dollar",
	[118] = "M-O Wall-E",
	[119] = "Wall-E",
	[120] = "Help!..nope",
	[121] = "I dare you",
	[122] = "Iragenerghvjksah",
	[123] = "KAR Spring Breeze",
	[124] = "Let's do this again",
	[125] = "Oh you",
	[126] = "Brush heavy's hair!",
	[127] = "OKTOBERFEST MAGGOT",
	[128] = "Full of SANDWITCHES!",
	[129] = "Scary",
	[130] = "Ugly, AAAH",
	[131] = "You're not a real soldier!",
	[132] = "1,2,3 Let's GO!",
	[133] = "Airporn",
	[134] = "Black & Yellow",
	[135] = "Don't look down",
	[136] = "Dreamscape",
	[137] = "GET NOSOCOPED!",
	[138] = "Oh baby a triple",
	[139] = "Put your hands up!!!",
	[140] = "Really, :O?",
	[141] = "Schnappi",
	[142] = "Smoke Weed Everyday remix",
	[143] = "Spacemen",
	[144] = "They call it Merther!",
	[145] = "Sad violin air horn",
	[146] = ":Oing bi#@h!",
	[147] = "Nice and strong Cena",
	[148] = "Dikke BMW",
	[149] = "Burp!",
	[150] = "Meep-meep!",
	[151] = "Angels are crying",
	[152] = "Bocka bass",
	[153] = "I can't get no sleep",
	[154] = "Ja pierdole kurwa",
	[155] = "Komodo",
	[156] = "Let go",
	[157] = "Pop Hold it Down",
	[158] = "Sacrifice",
	[159] = "Single ladies",
	[160] = "Feel Good Drag",
	[161] = "They see me rollin",
	[162] = "OH. MY. GOD.",
	[163] = "F1 Horn",
	[164] = "Evil Laugh",
	[165] = "Antonioooo",		
 	[166] = "Hero",		
 	[167] = "GTALibertyCity",		
 	[168] = "PersonalJesus",		
 	[169] = "Unforgiven",
	[170] = "Kappa",
	[171] = "Adele - Hello",
	[172] = "Magiiiik",
	[173] = "Keep the Change You Filthy Animal",
	[174] = "Crazy santa",
	[175] = "Dumb Florida Moron",
	[176] = "AMG",
	[177] = "Audi",
	[178] = "Chase the sun",
	[179] = "Give Me A Sign",
	[180] = "Heads Will Roll (A Trak remix)",
	[181] = "Holy Ghost",
	[182] = "I Am Jacks Hungry Heart Vocal 2",
	[183] = "I Am Jacks Hungry Heart Vocal",
	[184] = "I Am Jacks Hungry Heart",
	[185] = "I Believe In Dreams",
	[186] = "I Can't Stop",
	[187] = "Insomnia",
	[188] = "Komodoo",
	[189] = "Love Sex American Express",
	[190] = "Nighttrain",
	[191] = "Step it up",
	[192] = "Tobi King",
	[193] = "Tsunami",
	[194] = "DubStep!!",
	[195] = "Disturbed - Fear",
	[196] = "Knife Party - Nya",
	[197] = "Feel Dog Inc",
	[198] = "Reality - Melody",
	[199] = "Reality - Original",
	[200] = "Bellini - Samba De Janeiro",
	[201] = "Do You See Me Now?",
	[202] = "WAR, WAR NEVER CHANGES!",
	[203] = "Laugh",
	[204] = "Mr :OFace",
	[205] = "Leeroy",
	[206] = "MadLaugh1",	
	[207] = "MadLaugh2",	
	[208] = "MadLaugh3",
	[209] = "MadLaugh4",	
	[210] = "Out Of My Way",
	[211] = "Gazuj",
	[212] = "One click headshop",
	[213] = "DubStep 2",
	[214] = "Detonate",
	[215] = "Want To Want Me",
	[216] = "Bring It On!",
	[217] = "Cant handle the truth",
	[218] = "Eminem My Salsa",
	[219] = "Für Elise",
	[220] = "Gooooodmorning Vietnaaam",
	[221] = "HELP ME !! ",
	[222] = "I'm a Metalhead ",
	[223] = "I'm Batman ",
	[224] = "more hate..",
	[225] = "Rational Gaze",
	[226] = "The Watcher",
	[227] = "Use force luke",
	[228] = "weird thunder",
	[229] = "Wohoohue salsa",
	[230] = "Chilling y'all",
	[231] = "Im... Faaalling !",
	[232] = "You R so F_cked !",
	[233] = "Its time to dueell",
	[234] = "Metins horn",
	[235] = "frontliner-halos",
	[236] = "Chicken",
	[237] = "Mom",
	[238] = "Spanish Flea Quick",
	[239] = "Spanish Flea",
	[240] = "Xfile",
	[241] = "Tutturuu",
	[242] = "Benny Hill Theme",
	[243] = "Groove Street!",
	[244] = "Lenteja",
	[245] = "Cannonball",
	[246] = "Hotel-California",
	[247] = "I need a doctor, call me a doctor",
	[248] = "Jump",
	[249] = "Let it go",
	[250] = "Mehter 2",
	[251] = "Mehter",
	[252] = "Midnight",
	[253] = "No Money In The Bank",
	[254] = "Number Of The Beast",
	[255] = "Otpusti",
	[256] = "Powerslave",
	[257] = "Que boludo - Coco Basile",
	[258] = "Surface",
	[259] = "The Trooper",
    [260] = "GLP Dubstep",
	[261] = "Espectacular",
	[262] = "I Am Optimus Prime",
	[263] = "NyanCat",
	[264] = "Said-Nya",
	[265] = "Thriller",
	[266] = "CUZ IMA MUTHAPHUKIN NINJAA",
	[267] = "JUMP MOTHER:OER JUMP",
	[268] = "Tuco - It's me Tuco",
	[269] = "Tuco - Sandy:O",
}

function onShopInit ( tabPanel )
	shopTabPanel = tabPanel
	if isElement(hornsTab) then return end
	--// Tab Panels //--
	hornsTab = guiCreateWindow(0, 250, 650, 410, "Custom Horns", false)
	--// Gridlists //--
	availableHornsList = guiCreateGridList(0.05, 0.15, 0.42, 0.66, true, hornsTab)
	guiGridListSetSortingEnabled(availableHornsList, false)
	local column = guiGridListAddColumn(availableHornsList, "Available horns", 0.9)
	for id, horn in ipairs(hornsTable) do 
		local row = guiGridListAddRow(availableHornsList)
		guiGridListSetItemText(availableHornsList, row, column, tostring(id)..") "..horn, false, false)
	end
	myHornsList = guiCreateGridList(0.53, 0.15, 0.42, 0.66, true, hornsTab)
	guiGridListSetSortingEnabled(myHornsList, false)
	myHornsNameColumn = guiGridListAddColumn(myHornsList, "My horns", 0.7)
	myHornsKeyColumn = guiGridListAddColumn(myHornsList, "Key", 0.2)
	--// Labels //--
	guiCreateLabel(0.05, 0.04, 0.9, 0.15,'Select a horn out of the left box and press "Use selected horn" to get it (more than one horn is possible).',true,hornsTab)
	guiCreateLabel(0.06, 0.105, 0.9, 0.15,'Double-click on a selected horn to listen to it:',true,hornsTab)
	guiCreateLabel(0.53, 0.105, 0.9, 0.15,'Double-click on a selected horn to bind it to a key:',true,hornsTab)
	guiCreateLabel(0.753, 0.94, 0.9, 0.15,'(for gamepads)',true,hornsTab)
	--// Buttons //--
	local buy = guiCreateButton(0.05, 0.83, 0.22, 0.12, "Use selected horn", true, hornsTab)
	local unbindall = guiCreateButton(0.53, 0.83, 0.14, 0.12, "Unbind\nall horns", true, hornsTab)
	local bindForGamepads = guiCreateButton(0.69, 0.83, 0.26, 0.12, "Bind to a horn control name\n(Esc -> Settings -> Binds)", true, hornsTab)
	--// Event Handlers //--
	addEventHandler ( "onClientGUIClick",buy, buyButton,false)
	addEventHandler ( "onClientGUIDoubleClick",myHornsList, preBindKeyForHorn,false)
	addEventHandler ( "onClientGUIDoubleClick",availableHornsList, playButton,false)
	addEventHandler ( "onClientGUIClick",unbindall, unbindAllHorns,false)
	addEventHandler ( "onClientGUIClick",bindForGamepads, bindToHornControlName,false)
end
addCommandHandler("horns", onShopInit)

local previewHornList = {}
function playButton(button, state)
	if button == "left" and state == "up" then	
		local row, col = guiGridListGetSelectedItem(availableHornsList)
		if row == -1 or row == false then
			return
		end
		row = row + 1
		local extension
		extension = ".mp3"

		table.insert(previewHornList,"files/"..tostring(row)..extension)
		downloadFile( "files/"..tostring(row)..extension )
	end
end

function buyButton(button, state)
	if button == "left" and state == "up" then
		local row, col = guiGridListGetSelectedItem(availableHornsList)
		if row == -1 or row == false then
			outputChatBox("Select a horn first", 255, 0, 0)
			return
		end
		row = row + 1
		triggerServerEvent('onPlayerBuyHorn', localPlayer, row)
	end
end

------------------
-- Horn binding --
------------------
function bindToHornControlName(button, state)
	if button == "left" and state == "up" then
		local row, col = guiGridListGetSelectedItem(myHornsList)
		if row == -1 or row == false then
			outputChatBox("Select a horn first", 255, 0, 0)
			return
		end
		soundName = guiGridListGetItemData(myHornsList, row, col)
		bindKeyForHorn("horn")
	end
end

function getKeyForHorn(key, state) 
	if state then 
		if key == "escape" then
			unbindKeyForHorn()
			cancelEvent()
		else	
			bindKeyForHorn(key) 
		end	
		removeEventHandler("onClientKey", root, getKeyForHorn)
		destroyElement(bindingWindow)
	end 
end

function preBindKeyForHorn()
	local row, col = guiGridListGetSelectedItem(source)
	if row == -1 or row == false then
		outputChatBox("Select a horn first", 255, 0, 0)
		return
	end
	soundName = guiGridListGetItemData(source, row, col)
	bindingWindow = guiCreateWindow(0.4*screenWidth/1920, 0.45*screenHeight/1080, 0.2*screenWidth/1920, 0.08*screenHeight/1080, "Binding a key to horn", true)
	guiCreateLabel(0.25, 0.5, 1, 1, "Press a key to bind or escape to clear", true, bindingWindow)
	guiWindowSetMovable(bindingWindow, false)
	guiSetAlpha(bindingWindow, 1)
	addEventHandler("onClientKey", root, getKeyForHorn)
end

function bindKeyForHorn(keyNew)
	for i,j in ipairs(hornsTable) do 
		if j == soundName then
			hornBinded = false
			bindsXML = xmlLoadFile ('horns/binds-' .. getElementData(localPlayer, "mrgreen_gc_forumID").. '.xml')
			
			for x=0, 1000 do
				local bindNode = xmlFindChild(bindsXML, "bind", x)
			
				if bindNode then
					local keyOld = xmlNodeGetAttribute(bindNode, "key")
					local hornID = xmlNodeGetAttribute(bindNode, "hornID")
					
					if hornID == tostring(i) then
						xmlNodeSetAttribute(bindNode, "key", keyNew)
						triggerServerEvent("bindHorn", localPlayer, keyNew, i, soundName, false)
						triggerServerEvent("unbindHorn", localPlayer, keyOld)
						xmlSaveFile(bindsXML)
						hornBinded = true
					end
					
				else --elseif no bindNode then create it:
					if not hornBinded then
						local bindNode = xmlCreateChild(bindsXML, "bind")
						xmlNodeSetAttribute(bindNode, "key", keyNew)
						xmlNodeSetAttribute(bindNode, "hornID", i)
						xmlNodeSetAttribute(bindNode, "hornName", soundName)
						triggerServerEvent("bindHorn", localPlayer, keyNew, i, soundName, false)
						xmlSaveFile(bindsXML)
					end
					
					xmlUnloadFile(bindsXML) 
					triggerServerEvent('getHornsData', localPlayer)
					break  
				end
			end 
		end	
	end
end

function unbindKeyForHorn()
	for i,j in ipairs(hornsTable) do 
		if j == soundName then
			bindsXML = xmlLoadFile ('horns/binds-' .. getElementData(localPlayer, "mrgreen_gc_forumID").. '.xml')
			for x=0, 1000 do
				local bindNode = xmlFindChild(bindsXML, "bind", x)
				if bindNode then
					local key = xmlNodeGetAttribute(bindNode, "key")
					local hornID = xmlNodeGetAttribute(bindNode, "hornName")
					if hornID == soundName then
						xmlDestroyNode(bindNode)
						triggerServerEvent("unbindHorn", localPlayer, key)
						xmlSaveFile(bindsXML)
						xmlUnloadFile(bindsXML) 
						triggerServerEvent('getHornsData', localPlayer)
						break  
					end
				end
			end
		end
	end
end

function unbindAllHorns()
triggerServerEvent("unbindAllHorns", resourceRoot)

bindsXML = xmlLoadFile ('horns/binds-' .. getElementData(localPlayer, "mrgreen_gc_forumID").. '.xml')
	for i=0, 1000 do
		if bindsXML then
			local bindNode = xmlFindChild(bindsXML, "bind", i)
			if bindNode then
				local key = xmlNodeGetAttribute(bindNode, "key")
				if key ~= nil then
					triggerServerEvent("unbindHorn", localPlayer, key)
				end
			else 
				bindsXML = xmlCreateFile('horns/binds-' .. getElementData(localPlayer, "mrgreen_gc_forumID").. '.xml', "binds")
				xmlSaveFile(bindsXML)
				xmlUnloadFile(bindsXML)
				triggerServerEvent('getHornsData', localPlayer)
			break  
			end
		end 
	end
end

function unlimitedHorn(button, state)
	if button == "left" and state == "up" then
		triggerServerEvent('onPlayerBuyUnlimitedHorn', localPlayer)
	end
end



addEvent('onClientSuccessBuyHorn', true)
addEventHandler('onClientSuccessBuyHorn', root,
function(success)
	if success then
		outputChatBox("Horn successfully bought")
		triggerServerEvent('getHornsData', localPlayer)
	else
		outputChatBox("Either not logged in, or not enough GC, or you already have this horn.")
	end
end
)

addEvent("hornsLogin", true)
addEventHandler("hornsLogin", root,
function(isUnlimited, forumid)
	setElementData(localPlayer, "mrgreen_gc_forumID", forumid)
	if isUnlimited then
		guiSetText(unlimited, "Buy unlimited usage\nPrice: 5000 GC\nBought!")
		guiSetEnabled(unlimited, false)
	end
	triggerServerEvent('getHornsData', localPlayer)
end
)

addEvent("hornsLogout", true)
addEventHandler("hornsLogout", root,
function()
	triggerServerEvent("unbindAllHorns", resourceRoot)
	
	guiGridListClear(myHornsList)
	guiSetText(unlimited, "Buy unlimited usage\nPrice: 5000 GC")
	guiSetEnabled(unlimited, true)
end
)

addEvent('sendHornsData', true)
addEventHandler('sendHornsData', root,
function(boughtHorns)
	guiGridListClear(myHornsList)
	for i,j in ipairs(boughtHorns) do
		local row = guiGridListAddRow(myHornsList)
		guiGridListSetItemText(myHornsList, row, myHornsNameColumn, tostring(j)..") "..hornsTable[tonumber(j)], false, false)
		guiGridListSetItemData(myHornsList, row, myHornsNameColumn, hornsTable[tonumber(j)])
		guiGridListSetItemText(myHornsList, row, myHornsKeyColumn, getKeyBoundToHorn( tostring(j) ), false, false)
	end
end
)

function getKeyBoundToHorn(horn)
	bindsXML = xmlLoadFile ('horns/binds-' .. getElementData(localPlayer, "mrgreen_gc_forumID").. '.xml')
	if not bindsXML then
		bindsXML = xmlCreateFile('horns/binds-' .. getElementData(localPlayer, "mrgreen_gc_forumID").. '.xml', "binds")
		xmlSaveFile(bindsXML)
	end
	
	for i=0, 1000 do
		local bindNode = xmlFindChild(bindsXML, "bind", i)
		if bindNode then
			local key = xmlNodeGetAttribute(bindNode, "key")
			local hornID = xmlNodeGetAttribute(bindNode, "hornID")
			if key ~= nil and horn == hornID then
				if string.len(hornID) >=5 then
					triggerServerEvent("bindHorn", localPlayer, key, hornID, nil, true)
				elseif string.len(hornID) >= 1 and string.len(hornID) <= 3 then
					triggerServerEvent("bindHorn", localPlayer, key, hornID, nil, false)
				end
				xmlUnloadFile(bindsXML)
				return key
			end
		else xmlUnloadFile(bindsXML) return "-"  
		end
	end 
end


soundTimer = {}
killOtherTimer = {}
local screenSizex, screenSizey = guiGetScreenSize()
local guix = screenSizex * 0.1
local guiy = screenSizex * 0.1
local globalscale = 1
local globalalpha = 1
icon = {}

function createSoundForCar(car, horn)
	if not isElement(car) then return end
	if getElementType(car) == "player" then car = getPedOccupiedVehicle( car ) end -- If var car = player then turn car into an actual car element
	if isElement(icon[car]) then destroyElement(icon[car]) end
	if isTimer(soundTimer[car]) then killTimer(soundTimer[car]) end
	if isTimer(killOtherTimer[car]) then killTimer(killOtherTimer[car]) end
	icon[car] = guiCreateStaticImage(0, 0, guix, guiy, "horns/icon.png", false )
	guiSetVisible(icon[car], false)
	local x,y,z = getElementPosition(car)

	local sound = playSound3D(horn, x, y, z, false) -- Horn argument is passed as path
	setSoundMaxDistance(sound, 50)
	local length = getSoundLength(sound)
	length = length * 1000
	soundTimer[car] = setTimer(function(sound, car)
		if not isElement(sound) or not isElement(car) then return end
		local rx,ry,rz = getElementPosition(car)
		setElementPosition(sound, rx, ry, rz)
		
		
		local playerx, playery, playerz = getElementPosition( getPedOccupiedVehicle(localPlayer) )
		cp_x, cp_y, cp_z = getElementPosition( car)
		local dist = getDistanceBetweenPoints3D ( cp_x, cp_y, cp_z, playerx, playery, playerz )
		if dist and dist < 40 and ( isLineOfSightClear(cp_x, cp_y, cp_z+1.2, playerx, playery, playerz, true, false, false, false )) then
			local screenX, screenY = getScreenFromWorldPosition ( cp_x, cp_y, cp_z+1.2 )
			local scaled = screenSizex * (1/(2*(dist+5))) *.85
			local relx, rely = scaled * globalscale, scaled * globalscale
			
			guiSetAlpha(icon[car], globalalpha)
			guiSetSize(icon[car], relx, rely, false)
			if(screenX and screenY) then
				guiSetPosition(icon[car], screenX, screenY, false)
				guiSetVisible(icon[car], true)
			else
				guiSetVisible(icon[car], false)
			end
		else
		 guiSetVisible(icon[car], false)
		end
		
		
		
	end, 50, 0, sound,car)
	
	killOtherTimer[car] = setTimer(function(theTimer, car) if isTimer(theTimer) then killTimer(theTimer) if isElement(icon[car]) then destroyElement(icon[car]) end end  end, length, 50, soundTimer[car], car)
end

addEvent("onPlayerUsingHorn", true)
function playerUsingHorn(horn,car)
	if (getElementData(source, "state") == "alive") and (getElementData(localPlayer, "state") == "alive") and (soundsOn == true) and (getElementData(localPlayer, "dim") == getElementData(source, "dim")) and getPedOccupiedVehicle(localPlayer) then
		local x,y,z = getElementPosition(getPedOccupiedVehicle(localPlayer))
		local rx, ry, rz = getElementPosition(car)
		local playerTriggered = getVehicleOccupant( car )
		if not playerTriggered or getElementType(playerTriggered) ~= "player" then return end
		-- DO THIS IN OTHER FUNCTION -- if getDistanceBetweenPoints3D(x,y,z,rx,ry,rz) < 40 then
		
		-- Download file first, then do this

		local extension = ".mp3"


		local hornPath = "horns/files/"..horn..extension
		table.insert(downloadHornList,{horn=hornPath,player=playerTriggered})
		downloadFile( hornPath )
			
	end	
end
addEventHandler("onPlayerUsingHorn", root,playerUsingHorn)

	


function getHornSource(path,preview)
	local found = {}
	local remove = {}

	if preview then
		for num,t in ipairs(previewHornList) do
			if t == path then
				found = true
				table.insert(remove,num)
			end
		end
		if #remove > 0 then
			for _,i in ipairs(remove) do
				table.remove(previewHornList,i)
			end
		end		
	else

		for num,t in ipairs(downloadHornList) do
			if t.horn == path then
				table.insert(found,t.player)
				table.insert(remove,num)
			end
		end
		if #remove > 0 then
			for _,i in ipairs(remove) do
				table.remove(downloadHornList,i)
			end
		end
	end

	return found
end


function onHornDownloadComplete(path,succes)
	if not succes then outputDebugString("GCSHOP: "..path.." failed to download (horns_c)") return false end
	
	if #previewHornList > 0 then
		local prevSource = getHornSource(path,true)
		if isElement(hornPreview) then
			stopSound(hornPreview) 
		end
		if prevSource then
			hornPreview = playSound( path,false )
		end
	end

	local hornSource = getHornSource(path)
	if #hornSource > 0 then
		for _,p in ipairs(hornSource) do
			createSoundForCar(p, path)
		end
	end
end
addEventHandler("onClientFileDownloadComplete",resourceRoot,onHornDownloadComplete)

soundsOn = true

addEvent('onClientSuccessBuyUnlimitedUsage', true)
addEventHandler('onClientSuccessBuyUnlimitedUsage', root,
function(success)
	if success then
		guiSetText(unlimited, "Buy unlimited usage\nPrice: 5000 GC\nBought!")
		guiSetEnabled(unlimited, false)
	end
end
)

horns_s.lua

local price = 1500
local unlimitedUses = 5000
local canHornBeUsed = {}
local howManyTimes = {}
local newMap = nil
local coolOffTimer = {}
local coolOff = {}

local keyTable = { "mouse1", "mouse2", "mouse3", "mouse4", "mouse5", "mouse_wheel_up", "mouse_wheel_down", "arrow_l", "arrow_u",
 "arrow_r", "arrow_d", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
 "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "num_0", "num_1", "num_2", "num_3", "num_4", "num_5",
 "num_6", "num_7", "num_8", "num_9", "num_mul", "num_add", "num_sep", "num_sub", "num_div", "num_dec", "num_enter", "F1", "F2", "F3", "F4", "F5",
 "F6", "F7", "F8", "F9", "F10", "F11", "F12", "escape", "backspace", "tab", "lalt", "ralt", "enter", "space", "pgup", "pgdn", "end", "home",
 "insert", "delete", "lshift", "rshift", "lctrl", "rctrl", "[", "]", "pause", "capslock", "scroll", ";", ",", "-", ".", "/", "#", "\\", "=" }
 
local horns = { "Birdo-geluidje", "Boo-gebulder", "Come on! - Wario", "Dry Bones-gegiechel", "Hatsjwao! Oh sorry.. - Luigi", "Hey Stinky! - Mario",
 "Mushroom! - Toadette", "Peach-annoy", "Toad-boeee", "Yoshi-cool geluid", "You know I'll win! - Daisy", "You're lousy! - Waluigi", "The Dukes of hazzard",
 "Adios", "Aww crap", "Bad Boys", "Beat it!", "Billnye", "Callonme", "Come out", "Do'h", "English", "Feel good", "Haha", "Hello", "Madness", "Muh", "Muhaha",
 "Noobs", "Omg", "Sparta", "Suck", "Suckers", "Wazza", "Woohoo", "Yaba", "stewie", "titten", "buggle call", "random", "ring", "mario win", "goodbadugly",
 "who cares", "loser", "noooo", "cartman", "such a noob", "Screw you, that's funny", "hello again", "haaaaaai", "knock knock", "giggity", "shade aran",
 "YES,YES.", "Burn baby burn.", "Cry some moar!", "Davaj do svidanija", "WHAT YOU GONNA DO", "Dr.Zaius", "Here we go", "Holy :~", "It's my life", "JAAZZZZ",
 "Let's get ready to rumble", "What did you say :O!?", "Not a big surprise", "Livin' on a prayer", "Low Rider", "MammaMia", "Mariodeath", "My horse is amazing",
 "U can't touch this", "We are the champions", "We will rock you", "Bye have a great time", "Damn son! Where'd you find this", "Denied!", "Derp!1!", "Fart SFX",
 "Fatality", "Finish him!", "Giggity", "Gotya bitch", "Headshot!", "Hehe! Alright", "Here We Go!", "Like A Baus", "Prepare to be astonished", "Smoke Weed Everyday",
 "Tah daah", "That's nasty", "Toasty!", "Whaaat", "You got knocked the :O out", "You suck sound effect", "Haha You Suck", "Imma bust you up", "It's on, Baby",
 "Mess with the best", "That's gotta hurt", "Yo Whassup", "F--k you ceelo", "Stewie Mummy", "Hah, Ghaay", "J's on my feet", "Jim Carrey", "Minion laugh",
 "My :O my :O", "Darude - Sandstorm", "So it begins", "What are you doing", "Whoooaah", "Wiggle wiggle wiggle", "You shall not pass!", "Higher", "I need a dollar",
 "M-O Wall-E", "Wall-E", "Help!..nope", "I dare you", "Iragenerghvjksah", "KAR Spring Breeze", "Let's do this again", "Oh you", "Brush heavy's hair!", "OKTOBERFEST MAGGOT",
 "Full of SANDWITCHES!", "Scary", "Ugly, AAAH", "You're not a real soldier!", "1,2,3 Let's GO!", "Airporn", "Black & Yellow", "Don't look down", "Dreamscape", "GET NOSOCOPED!",
 "Oh baby a triple", "Put your hands up!!!", "Really, :O?", "Schnappi", "Smoke Weed Everyday remix", "Spacemen", "They call it Merther!", "Sad violin air horn",
 ":Oing bi#@h!", "Nice and strong Cena", "Dikke BMW", "Burp!", "Meep-meep!", "Angels are crying", "Bocka bass", "I can't get no sleep", "Ja pierdole kurwa", "Komodo",
 "Let go", "Pop Hold it Down", "Sacrifice", "Single ladies", "Feel Good Drag", "They see me rollin", "OH. MY. GOD.", "F1 Horn", "Evil Laugh", "Antonioooo",	"Hero", "GTALibertyCity",		
 "PersonalJesus", "Unforgiven", "Kappa", "Adele - Hello", "Magiiiik", "Keep the Change You Filthy Animal", "Crazy santa", "Dumb Florida Moron", "AMG", "Audi", "Chase the sun",
 "Give Me A Sign", "Heads Will Roll (A Trak remix)", "Holy Ghost", "I Am Jacks Hungry Heart Vocal 2", "I Am Jacks Hungry Heart Vocal", "I Am Jacks Hungry Heart", "I Believe In Dreams",
 "I Can't Stop", "Insomnia", "Komodoo", "Love Sex American Express", "Nighttrain", "Step it up", "Tobi King", "Tsunami", "DubStep!!", "Disturbed - Fear", "Knife Party - Nya",
 "Feel Dog Inc", "Reality - Melody", "Reality - Original", "Bellini - Samba De Janeiro", "Do You See Me Now?", "WAR, WAR NEVER CHANGES!", "Laugh", "Mr :OFace", "Leeroy", "MadLaugh1",	
 "MadLaugh2",	 "MadLaugh3", "MadLaugh4",	 "Out Of My Way", "Gazuj", "One click headshop", "DubStep 2", "Detonate", "Want To Want Me", "Bring It On!", "Cant handle the truth",
 "Eminem My Salsa", "Für Elise", "Gooooodmorning Vietnaaam", "HELP ME !! ", "I'm a Metalhead ", "I'm Batman ", "more hate..", "Rational Gaze", "The Watcher", "Use force luke",
 "weird thunder", "Wohoohue salsa", "Chilling y'all", "Im... Faaalling !", "You R so F_cked !", "Its time to dueell", "Metins horn", "frontliner-halos", "Chicken", "Mom",
 "Spanish Flea Quick", "Spanish Flea", "Xfile", "Tutturuu", "Benny Hill Theme", "Groove Street!", "Lenteja", "Cannonball", "Hotel-California", "I need a doctor, call me a doctor",
 "Jump", "Let it go", "Mehter 2", "Mehter", "Midnight", "No Money In The Bank", "Number Of The Beast", "Otpusti", "Powerslave", "Que boludo - Coco Basile", "Surface", "The Trooper",
 "GLP Dubstep", "Espectacular", "I Am Optimus Prime", "NyanCat", "Said-Nya", "Thriller", "CUZ IMA MUTHAPHUKIN NINJAA", "JUMP MOTHER:OER JUMP", "Tuco - It's me Tuco", "Tuco - Sandy:O",
}

addEventHandler('onMapStarting', root,
function()
	newMap = true
end
)

addEvent('onRaceStateChanging', true)
addEventHandler('onRaceStateChanging', root,
function(new)
	if (new == 'Running') and (newMap == true) then
		for i,j in ipairs(getElementsByType('player')) do 
			canHornBeUsed[j] = true
			howManyTimes[j] = 0
		end
		newMap = false
	end	
end
)

addEvent("onGCShopLogout", true)
addEventHandler("onGCShopLogout", root,
function()
	triggerClientEvent(source, "hornsLogout", source)
end
)

addEvent("onGCShopLogin", true)
addEventHandler("onGCShopLogin", root,
function(forumid)
	local query = dbQuery(handlerConnect, "SELECT unlimited FROM gc_horns WHERE forumid = ?", forumid)
	local sql = dbPoll(query,-1)
	local unlimited = false
	if #sql >= 1 then
		if sql[1].unlimited == 1 then unlimited = true else unlimited = false end	
	end
	triggerClientEvent(source, "hornsLogin", source, unlimited, forumid)
end
)

addEventHandler('onPlayerJoin', root,
function()
	canHornBeUsed[source] = true
	howManyTimes[source] = 0
	coolOff[source] = true
end
)

addEventHandler('onPlayerQuit', root,
function()
	canHornBeUsed[source] = nil
	howManyTimes[source] = nil
	coolOff[source] = nil
	coolOffTimer[source] = nil
end
)

addEventHandler('onResourceStart', resourceRoot,
function()
	for i,j in ipairs(getElementsByType('player')) do 
		canHornBeUsed[j] = true
		howManyTimes[j] = 0
		coolOff[j] = true
	end
end
)

function useHorn(player, arg1, arg2, hornID)
	if (canHornBeUsed[player]) and (coolOff[player] == true) and (isPedInVehicle(player)) and (not isVehicleBlown(getPedOccupiedVehicle(player))) and (getElementHealth(getPedOccupiedVehicle(player)) > 250) and (getElementData(player, "state") == "alive") then
		local logged = exports.gc:isPlayerLoggedInGC(player)
		if logged then
			local forumid = exports.gc:getPlayerForumID(player)
			forumid = tostring(forumid)
			if tonumber(hornID or arg2) then
				local query = dbQuery(handlerConnect, "SELECT horns, unlimited FROM gc_horns WHERE forumid = ?", forumid)
				local sql = dbPoll(query,-1)
				if #sql > 0 then
					local allHorns = split(sql[1].horns, string.byte(','))
					
					local useHorn = false
					for i,j in ipairs(allHorns) do
						if tonumber(j) == tonumber(hornID or arg2) then
							useHorn = true
							break
						end
					end

					if not useHorn then outputChatBox("Please buy the horn (".. tostring(hornID or arg2) ..") first before using it",player,255,0,0) return end

					local car = getPedOccupiedVehicle(player)
					coolOffTimer[player] = setTimer(function(player) coolOff[player] = true end, 10000, 1, player)
					triggerClientEvent("onPlayerUsingHorn", player, hornID or arg2, car)
					coolOff[player] = false
					howManyTimes[player] = howManyTimes[player] + 1
					if sql[1].unlimited == 1 then howManyTimes[player] = 0 end
					if howManyTimes[player] == 3 then
						canHornBeUsed[player] = false
					end
				end	
			else
				outputChatBox("Something went wrong",player,255,0,0)
			end
		end	
	end	
end
addCommandHandler("gchorn",useHorn)

addEvent("bindHorn", true)
addEventHandler("bindHorn", root, function(key, hornID, hornName)
	if not isKeyBound(client, key, "down", useHorn) then
		bindKey(client, key, "down", useHorn, hornID)
	end
end
)

addEvent("unbindHorn", true)
addEventHandler("unbindHorn", root, function(key)
	unbindKey(client, key, "down", useHorn)
end
)

addEvent("unbindAllHorns", true)
addEventHandler("unbindAllHorns", root, function()
	for i=1, #keyTable do
		unbindKey(client, keyTable[i], "down", useHorn)
	end
end
)

addEvent('onPlayerBuyUnlimitedHorn', true)
addEventHandler('onPlayerBuyUnlimitedHorn', root,
function()
	local logged = exports.gc:isPlayerLoggedInGC(source)
	if logged then
		local forumid = exports.gc:getPlayerForumID(source)
		forumid = tostring(forumid)
		local query = dbQuery(handlerConnect, "SELECT unlimited FROM gc_horns WHERE forumid = ?", forumid)
		local sql = dbPoll(query,-1)
		if #sql > 0 then
			if sql[1].unlimited == 1 then
				outputChatBox("You already have unlimited horn usage.", source)
				return
			else
				local money = exports.gc:getPlayerGreencoins(source)
				if money >= unlimitedUses then
					local ok = gcshopBuyItem ( source, unlimitedUses, 'Unlimited horns' )
					if ok then
						local result = dbExec(handlerConnect, "UPDATE gc_horns SET unlimited=? WHERE forumid=?", 1, forumid)
						outputChatBox("You have bought unlimited horn usage for 5000 GC.", source)
						triggerClientEvent(source, 'onClientSuccessBuyUnlimitedUsage', source, true)
						addToLog ( '"' .. getPlayerName(source) .. '" (' .. tostring(forumid) .. ') bought Unlimited horns ' .. tostring(result))
					end
				else
					outputChatBox("You do not have enough GreenCoins", source)
				end	
			end
		else
			outputChatBox("You have no horns bought.", source)
		end	
	else
		outputChatBox("You are not logged in GreenCoins", source)
	end
end
)


addEvent('onPlayerBuyHorn', true)
addEventHandler('onPlayerBuyHorn', root,
function(horn)
	local playeraccount = getPlayerAccount(source)
	if playeraccount and not isGuestAccount(playeraccount) then
		local accName = getAccountName(playeraccount)
		accName = tostring(accName)
		--local query = dbQuery(handlerConnect, "SELECT horns FROM gc_horns WHERE forumid = ?", forumid)
		--local sql = dbPoll(query,-1)
		--if #sql > 0 then
			--local allHorns = split(sql[1].horns, string.byte(','))
			local allHorns = horns, string.byte(',')
			for i,j in ipairs(allHorns) do 
				if j == tostring(horn) then
					triggerClientEvent(source, 'onClientSuccessBuyHorn', source, false)
					return
				end
			end
		--end	
		--[[local money = exports.gc:getPlayerGreencoins(source)
		if money >= price then
			local ok = gcshopBuyItem ( source, price, 'Horn:' .. horn)
			if ok then
				local result
				if #sql == 0 then
					result = dbExec(handlerConnect, "INSERT INTO gc_horns (forumid,horns) VALUES (?,?)", forumid, tostring(horn))
				else
					local hornString = sql[1].horns..","..tostring(horn)
					result = dbExec(handlerConnect, "UPDATE gc_horns SET horns=? WHERE forumid=?", hornString, forumid)
				end--]]
				triggerClientEvent(source, 'onClientSuccessBuyHorn', source, true, horn)
				--addToLog ( '"' .. getPlayerName(source) .. '" (' .. tostring(forumid) .. ') bought horn=' .. tostring(horn) ..  ' ' .. tostring(result))
			--end
		--else
			--triggerClientEvent(source, 'onClientSuccessBuyHorn', source, false, nil)
		--end
	else
		triggerClientEvent(source, 'onClientSuccessBuyHorn', source, false)
	end
end
)


addEvent('getHornsData', true)
addEventHandler('getHornsData', root,
function()
	--local logged = exports.gc:isPlayerLoggedInGC(source)
	local playeraccount = getPlayerAccount(source)
	if playeraccount and not isGuestAccount(playeraccount) then
		--[[local forumid = exports.gc:getPlayerForumID(source)
		forumid = tostring(forumid)
		local query = dbQuery(handlerConnect, "SELECT horns FROM gc_horns WHERE forumid = ?", forumid)
		local sql = dbPoll(query,-1)
		if #sql > 0 then--]]
			local allHorns = horns, string.byte(',')
			--local allHorns = split(sql[1].horns, string.byte(','))
			triggerClientEvent(source, 'sendHornsData', source, allHorns)
		--end
	end	
end
)

meta.xml

<meta>
    <info author="SDK" version="1.5" type="script" />
    <min_mta_version server="1.3.0-9.03772" client="1.3.0-9.03772"></min_mta_version>
    <!-- Custom horns by BinSlayer     -->
    
    <script src="horns_c.lua" type="client" />
    <script src="horns_s.lua" type="server" />
    <file src="files\1.mp3" download="false"/>
    <file src="files\2.mp3" download="false"/>
    <file src="files\3.mp3" download="false"/>
    <file src="files\4.mp3" download="false"/>
    <file src="files\5.mp3" download="false"/>
    <file src="files\6.mp3" download="false"/>
    <file src="files\7.mp3" download="false"/>
    <file src="files\8.mp3" download="false"/>
    <file src="files\9.mp3" download="false"/>
    <file src="files\10.mp3" download="false"/>
    <file src="files\11.mp3" download="false"/>
    <file src="files\12.mp3" download="false"/>
    <file src="files\13.mp3" download="false"/>
    <file src="files\14.mp3" download="false"/>
    <file src="files\15.mp3" download="false"/>
    <file src="files\16.mp3" download="false"/>
    <file src="files\17.mp3" download="false"/>
    <file src="files\18.mp3" download="false"/>
    <file src="files\19.mp3" download="false"/>
    <file src="files\20.mp3" download="false"/>
    <file src="files\21.mp3" download="false"/>
    <file src="files\22.mp3" download="false"/>
    <file src="files\23.mp3" download="false"/>
    <file src="files\24.mp3" download="false"/>
    <file src="files\25.mp3" download="false"/>
    <file src="files\26.mp3" download="false"/>
    <file src="files\27.mp3" download="false"/>
    <file src="files\28.mp3" download="false"/>
    <file src="files\29.mp3" download="false"/>
    <file src="files\30.mp3" download="false"/>
    <file src="files\31.mp3" download="false"/>
    <file src="files\32.mp3" download="false"/>
    <file src="files\33.mp3" download="false"/>
    <file src="files\34.mp3" download="false"/>
    <file src="files\35.mp3" download="false"/>
    <file src="files\36.mp3" download="false"/>
    <file src="files\37.mp3" download="false"/>
    <file src="files\38.mp3" download="false"/>
    <file src="files\39.mp3" download="false"/>
    <file src="files\40.mp3" download="false"/>
    <file src="files\41.mp3" download="false"/>
    <file src="files\42.mp3" download="false"/>
    <file src="files\43.mp3" download="false"/>
    <file src="files\44.mp3" download="false"/>
    <file src="files\45.mp3" download="false"/>
    <file src="files\46.mp3" download="false"/>
    <file src="files\47.mp3" download="false"/>
    <file src="files\48.mp3" download="false"/>
    <file src="files\49.mp3" download="false"/>
    <file src="files\50.mp3" download="false"/>
    <file src="files\51.mp3" download="false"/>
    <file src="files\52.mp3" download="false"/>
    <file src="files\53.mp3" download="false"/>
    <file src="files\54.mp3" download="false"/>
    <file src="files\55.mp3" download="false"/>
    <file src="files\56.mp3" download="false"/>
    <file src="files\57.mp3" download="false"/>
    <file src="files\58.mp3" download="false"/>
    <file src="files\59.mp3" download="false"/>
    <file src="files\60.mp3" download="false"/>
    <file src="files\61.mp3" download="false"/>
    <file src="files\62.mp3" download="false"/>
    <file src="files\63.mp3" download="false"/>
    <file src="files\64.mp3" download="false"/>
    <file src="files\65.mp3" download="false"/>
    <file src="files\66.mp3" download="false"/>
    <file src="files\67.mp3" download="false"/>
    <file src="files\68.mp3" download="false"/>
    <file src="files\69.mp3" download="false"/>
    <file src="files\70.mp3" download="false"/>
    <file src="files\71.mp3" download="false"/>
    <file src="files\72.mp3" download="false"/>
    <file src="files\73.mp3" download="false"/>
    <file src="files\74.mp3" download="false"/>
    <file src="files\75.mp3" download="false"/>
    <file src="files\76.mp3" download="false"/>
    <file src="files\77.mp3" download="false"/>
    <file src="files\78.mp3" download="false"/>
    <file src="files\79.mp3" download="false"/>
    <file src="files\80.mp3" download="false"/>
    <file src="files\81.mp3" download="false"/>
    <file src="files\82.mp3" download="false"/>
    <file src="files\83.mp3" download="false"/>
    <file src="files\84.mp3" download="false"/>
    <file src="files\85.mp3" download="false"/>
    <file src="files\86.mp3" download="false"/>
    <file src="files\87.mp3" download="false"/>
    <file src="files\88.mp3" download="false"/>
    <file src="files\89.mp3" download="false"/>
    <file src="files\90.mp3" download="false"/>
    <file src="files\91.mp3" download="false"/>
    <file src="files\92.mp3" download="false"/>
    <file src="files\93.mp3" download="false"/>
    <file src="files\94.mp3" download="false"/>
    <file src="files\95.mp3" download="false"/>
    <file src="files\96.mp3" download="false"/>
    <file src="files\97.mp3" download="false"/>
    <file src="files\98.mp3" download="false"/>
    <file src="files\99.mp3" download="false"/>
    <file src="files\100.mp3" download="false"/>
    <file src="files\101.mp3" download="false"/>
    <file src="files\102.mp3" download="false"/>
    <file src="files\103.mp3" download="false"/>
    <file src="files\104.mp3" download="false"/>
    <file src="files\105.mp3" download="false"/>
    <file src="files\106.mp3" download="false"/>
    <file src="files\107.mp3" download="false"/>
    <file src="files\108.mp3" download="false"/>
    <file src="files\109.mp3" download="false"/>
    <file src="files\110.mp3" download="false"/>
    <file src="files\111.mp3" download="false"/>
    <file src="files\112.mp3" download="false"/>
    <file src="files\113.mp3" download="false"/>
    <file src="files\114.mp3" download="false"/>
    <file src="files\115.mp3" download="false"/>
    <file src="files\116.mp3" download="false"/>
    <file src="files\117.mp3" download="false"/>
    <file src="files\118.mp3" download="false"/>
    <file src="files\119.mp3" download="false"/>
    <file src="files\120.mp3" download="false"/>
    <file src="files\121.mp3" download="false"/>
    <file src="files\122.mp3" download="false"/>
    <file src="files\123.mp3" download="false"/>
    <file src="files\124.mp3" download="false"/>
    <file src="files\125.mp3" download="false"/>
    <file src="files\126.mp3" download="false"/>
    <file src="files\127.mp3" download="false"/>
    <file src="files\128.mp3" download="false"/>
    <file src="files\129.mp3" download="false"/>
    <file src="files\130.mp3" download="false"/>
    <file src="files\131.mp3" download="false"/>
    <file src="files\132.mp3" download="false"/>
    <file src="files\133.mp3" download="false"/>
    <file src="files\134.mp3" download="false"/>
    <file src="files\135.mp3" download="false"/>
    <file src="files\136.mp3" download="false"/>
    <file src="files\137.mp3" download="false"/>
    <file src="files\138.mp3" download="false"/>
    <file src="files\139.mp3" download="false"/>
    <file src="files\140.mp3" download="false"/>
    <file src="files\141.mp3" download="false"/>
    <file src="files\142.mp3" download="false"/>
    <file src="files\143.mp3" download="false"/>
    <file src="files\144.mp3" download="false"/>
    <file src="files\145.mp3" download="false"/>
    <file src="files\146.mp3" download="false"/>
    <file src="files\147.mp3" download="false"/>
    <file src="files\148.mp3" download="false"/>
    <file src="files\149.mp3" download="false"/>
    <file src="files\150.mp3" download="false"/>
    <file src="files\151.mp3" download="false"/>
    <file src="files\152.mp3" download="false"/>
    <file src="files\153.mp3" download="false"/>
    <file src="files\154.mp3" download="false"/>
    <file src="files\155.mp3" download="false"/>
    <file src="files\156.mp3" download="false"/>
    <file src="files\157.mp3" download="false"/>
    <file src="files\158.mp3" download="false"/>
    <file src="files\159.mp3" download="false"/>
    <file src="files\160.mp3" download="false"/>
    <file src="files\161.mp3" download="false"/>
    <file src="files\162.mp3" download="false"/>
    <file src="files\163.mp3" download="false"/>
    <file src="files\164.mp3" download="false"/>
    <file src="files\165.mp3" download="false"/>
    <file src="files\166.mp3" download="false"/>
    <file src="files\167.mp3" download="false"/>
    <file src="files\168.mp3" download="false"/>
    <file src="files\169.mp3" download="false"/>
    <file src="files\170.mp3" download="false"/>
    <file src="files\171.mp3" download="false"/>
    <file src="files\172.mp3" download="false"/>
    <file src="files\173.mp3" download="false"/>
    <file src="files\174.mp3" download="false"/>
    <file src="files\175.mp3" download="false"/>  
    <file src="files\176.mp3" download="false"/>
    <file src="files\177.mp3" download="false"/>
    <file src="files\178.mp3" download="false"/>
    <file src="files\179.mp3" download="false"/>
    <file src="files\180.mp3" download="false"/>
    <file src="files\181.mp3" download="false"/>
    <file src="files\182.mp3" download="false"/>
    <file src="files\183.mp3" download="false"/>
    <file src="files\184.mp3" download="false"/>
    <file src="files\185.mp3" download="false"/>
    <file src="files\186.mp3" download="false"/>
    <file src="files\187.mp3" download="false"/>
    <file src="files\188.mp3" download="false"/>
    <file src="files\189.mp3" download="false"/>
    <file src="files\190.mp3" download="false"/>
    <file src="files\191.mp3" download="false"/>
    <file src="files\192.mp3" download="false"/>
    <file src="files\193.mp3" download="false"/>
    <file src="files\194.mp3" download="false"/>
    <file src="files\195.mp3" download="false"/>
    <file src="files\196.mp3" download="false"/>
    <file src="files\197.mp3" download="false"/>
    <file src="files\198.mp3" download="false"/>
    <file src="files\199.mp3" download="false"/>
    <file src="files\200.mp3" download="false"/>
    <file src="files\201.mp3" download="false"/>
	<file src="files\202.mp3" download="false"/>
    <file src="files\203.mp3" download="false"/>
	<file src="files\204.mp3" download="false"/>
	<file src="files\205.mp3" download="false"/>
	<file src="files\206.mp3" download="false"/>
	<file src="files\207.mp3" download="false"/>
	<file src="files\208.mp3" download="false"/>
	<file src="files\209.mp3" download="false"/>
	<file src="files\210.mp3" download="false"/>
	<file src="files\211.mp3" download="false"/>
	<file src="files\212.mp3" download="false"/>
	<file src="files\213.mp3" download="false"/>
	<file src="files\214.mp3" download="false"/>
	<file src="files\215.mp3" download="false"/>
	<file src="files\216.mp3" download="false"/>
	<file src="files\217.mp3" download="false"/>
	<file src="files\218.mp3" download="false"/>
	<file src="files\219.mp3" download="false"/>
	<file src="files\220.mp3" download="false"/>
	<file src="files\221.mp3" download="false"/>
	<file src="files\222.mp3" download="false"/>
	<file src="files\223.mp3" download="false"/>
	<file src="files\224.mp3" download="false"/>
	<file src="files\225.mp3" download="false"/>
	<file src="files\226.mp3" download="false"/>
	<file src="files\227.mp3" download="false"/>
	<file src="files\228.mp3" download="false"/>
	<file src="files\229.mp3" download="false"/>
	<file src="files\230.mp3" download="false"/>
	<file src="files\231.mp3" download="false"/>
	<file src="files\232.mp3" download="false"/>
	<file src="files\233.mp3" download="false"/>
	<file src="files\234.mp3" download="false"/>
	<file src="files\235.mp3" download="false"/>
	<file src="files\236.mp3" download="false"/>
	<file src="files\237.mp3" download="false"/>
	<file src="files\238.mp3" download="false"/>
	<file src="files\239.mp3" download="false"/>
	<file src="files\240.mp3" download="false"/>
	<file src="files\241.mp3" download="false"/>
	<file src="files\242.mp3" download="false"/>
	<file src="files\243.mp3" download="false"/>
	<file src="files\244.mp3" download="false"/>	
	<file src="files\245.mp3" download="false"/>
	<file src="files\246.mp3" download="false"/>
	<file src="files\247.mp3" download="false"/>
	<file src="files\248.mp3" download="false"/>
	<file src="files\249.mp3" download="false"/>
	<file src="files\250.mp3" download="false"/>
	<file src="files\251.mp3" download="false"/>
	<file src="files\252.mp3" download="false"/>
	<file src="files\253.mp3" download="false"/>
	<file src="files\254.mp3" download="false"/>
	<file src="files\255.mp3" download="false"/>
	<file src="files\256.mp3" download="false"/>
	<file src="files\257.mp3" download="false"/>
	<file src="files\258.mp3" download="false"/>
	<file src="files\259.mp3" download="false"/>
	<file src="files\260.mp3" download="false"/>
	<file src="files\261.mp3" download="false"/>
	<file src="files\262.mp3" download="false"/>
	<file src="files\263.mp3" download="false"/>
	<file src="files\264.mp3" download="false"/>
	<file src="files\265.mp3" download="false"/>
	<file src="files\266.mp3" download="false"/>
	<file src="files\267.mp3" download="false"/>
	<file src="files\268.mp3" download="false"/>
	<file src="files\269.mp3" download="false"/>
	<file src="icon.png" />
</meta>

So far when a player types /horns in the chat a window shows with the horns in a gridlist. When he double clicks on a horn, it gets downloaded and played to the player who double clicked it so he can preview it before deciding to use it. <-- all this works now.

What I can't get is how to remove all sql (and gc) parts and still make it work.

PS: gc account should be replaced with normal mta account (i've started this and can probably do it myself, just giving info).

Right now when i click on 'select' after i've selected a horn it says "horn bought successfully" in chat but throws a debug error stating 'line 515 attempt to concatenate field "?" (nill value)'

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...