Jump to content

koragg

Members
  • Posts

    730
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by koragg

  1. On the first screenshot, slide the slider to the right, there should be resource name of those 2 maps that are left (I guess it'll be same as finding them manually but won't hurt to try and see if it's different). In my 'unzipped' folder there are no map files, just some scripts (probably old versions that I should delete) so try to: - delete those 2 maps when server's running, do refresh in both places - shut down server and delete them, then start again If still nothing, I can't think of anything else to try for now. Btw this "no gamemode" map is a corrupt file, which has copied some info from the real map but hasn't gotten the gamemode part, thus has no home in there
  2. koragg

    help

    If you lag without any mods installed (just normal GTA vehicles) then this may help you. Turn it on/off with C button. It hides all other cars and greatly increases your FPS if you're PC isn't that strong. If you have lag with modded vehicles, do what @loki2143 said and you'll be fine.
  3. I got this code but I'm not really sure how to edit it so that it works for me. Idea is to show votemanager after a map ends even if next map is set from admin panel or bought from a 3rd-party script. This is the part which needs editing but whatever I try doesn't work. No errors in debug but no votemanager either. if getResourceFromName('gcshop') and getResourceState(getResourceFromName('gcshop')) == 'running' and exports.gcshop:isAnyMapQueued(true) and skipMapQueue ~= exports.mapmanager:getRunningGamemodeMap() then -- GCshop next queued map -- [1] = mapName, [2] = mapResName, [3] = gamemode, [4] = playername local map = exports.gcshop:getCurrentMapQueued(true) local mapRes = getResourceFromName(map[2]) if map and mapRes then local mapName = getResourceInfo(mapRes, "name") or getResourceName(mapRes) local mapName = "[Maps-Center] "..mapName table.insert(poll, {mapName , 'nextMapVoteResult', getRootElement(), mapRes,map[4]}) usedGcMapQueue = true else-- normal next map local mapName = getResourceInfo(_nextMap, "name") or getResourceName(_nextMap) table.insert(poll, {mapName , 'nextMapVoteResult', getRootElement(), _nextMap}) end else -- Normal next map local mapName = getResourceInfo(_nextMap, "name") or getResourceName(_nextMap) table.insert(poll, {mapName , 'nextMapVoteResult', getRootElement(), _nextMap}) end The thing that makes this hard for me is that I don't know how to include the next map set from admin panel or by the buymap script into the votemanager as obviosly "getCurrentMapQueued" belongs to another resource which I cannot use.
  4. Try to "/refresh all" in console and click "Refresh list" in admin panel. If still no go, search around server's folder, there might be some dump files which have somehow copied a map's meta.xml file. I had the same problem months ago but I don't remember exactly how I fixed it. Do this^ and see. Additionally you can just temporarily remove all maps from the server, restart it and see. If the list is fine then, start adding back the maps in packs. That way you'll see if a map is responsible for this or not.
  5. 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)'
  6. I'm lazy to turn off the 'clans' and 'nfsnos' resources before starting the 'cw' one (it is needed) so I wanted to make a few functions which do this for me. The first two work fine and stop the mentioned resources and then start the 'cw' one. BUT The third and fourth functions do not work as intended and idk why. They should stop the 'cw' resource and then start the 'clans' and 'nfsnos' ones so everything is like before. I saw in console that indeed they start the 2 resources when the 'cw' one stops, but both 'nfsnos' and 'clans' stop right after 'cw' stops, this idk how to fix. function stopclans() local res = getResourceFromName ( "clans" ) if getResourceState(res) == "running" then stopResource(res) end end addEventHandler("onResourceStart", resourceRoot, stopclans) function stopnfsnos() local res = getResourceFromName ( "nfsnos" ) if getResourceState(res) == "running" then stopResource(res) end end addEventHandler("onResourceStart", resourceRoot, stopnfsnos) function startclans() local res = getResourceFromName ( "clans" ) if getResourceState(res) == "loaded" then startResource(res) end end addEventHandler("onResourceStop", resourceRoot, startclans) function startnfsnos() local res = getResourceFromName ( "nfsnos" ) if getResourceState(res) == "loaded" then startResource(res) end end addEventHandler("onResourceStop", resourceRoot, startnfsnos)
  7. Well, ok, will see. But the default permission is fine, just wanna exclude maps from the mapmanager (or mapcycler?).
  8. @Gravestone I know I can set it from there I just gave it as example, map should not be in random cycle or votes, but should be setable from admin panel (or bought from my custom shop).
  9. So basically, I have a few maps which I don't want to see if I do /random or in votes. But I also want to have them so that people who like them can still buy them (or set, if admin). I tried adding this in a lot of places inside the mapmanager resource but nothing worked (sometimes had errors, other times no errors but maps were still cycled as normal). if (getMapName() == "Hell Choose Me") then return end I'm not even sure if what I want is possible, asked a friend, he's got no idea. So I thought someone here can help. Found few old topics with similar content but there was no answer there or it didn't work.
  10. So I fixed the personal time's position by using the same lines as for the top1-top9 lines, just changed 'i' to '10' and it worked if toptimes.personal[1] then dxDrawRectangle(sX-x*0.4354166666666667, (sY/2)+((10-1)*20)-y*0.4759259259259259-1, x*0.1979166666666667, y*0.017022792022792/cY, displayColor) dxDrawRectangle(sX-x*0.4354166666666667, (sY/2)+((10-1)*20)-y*0.4759259259259259-1, x*0.1979166666666667, y*0.017022792022792/cY, tocolor(255,255,255,100)) -- Shadow dxDrawText(""..toptimes.personal.pos..". "..toptimes.personal.spacement..removeColorCoding(toptimes.personal.name), sX-x*0.4341666666666667, (sY/2)+((10-1)*20)-y*0.8277777777777778, sX-x*0.0244791666666667, (sY/2)+((10)*20)-y*0.1240740740740741, tocolor(0,0,0,255), cY*1, "default-bold","left","center",true,false,false,true) dxDrawText(toptimes.personal.time, sX-x*0.3132291666666667, (sY/2)+((10-1)*20)-y*0.8277777777777778, sX-x*0.0244791666666667, (sY/2)+((10)*20)-y*0.1240740740740741, tocolor(0,0,0,255), cY*1, "default-bold","left","center",true,false,false,true) dxDrawText(toptimes.personal.data, sX-x*0.2744791666666667, (sY/2)+((10-1)*20)-y*0.8277777777777778, sX-x*0.0244791666666667, (sY/2)+((10)*20)-y*0.1240740740740741, tocolor(0,0,0,255), cY*1, "default-bold","left","center",true,false,false,true) -- dxDrawText(""..toptimes.personal.pos..". "..toptimes.personal.spacement..toptimes.personal.name, sX-x*0.4346875, (sY/2)+((10-1)*20)-y*0.8287037037037037, sX-x*0.025, (sY/2)+((10)*20)-y*0.125, tocolor(255,255,255,255), cY*1, "default-bold","left","center",true,false,false,true) dxDrawText(toptimes.personal.time, sX-x*0.31375, (sY/2)+((10-1)*20)-y*0.8287037037037037, sX-x*0.025, (sY/2)+((10)*20)-y*0.125, tocolor(255,255,255,255), cY*1, "default-bold","left","center",true,false,false,true) dxDrawText(toptimes.personal.data, sX-x*0.275, (sY/2)+((10-1)*20)-y*0.8287037037037037, sX-x*0.025, (sY/2)+((10)*20)-y*0.125, tocolor(255,255,255,255), cY*1, "default-bold","left","center",true,false,false,true) if toptimes.personal.country ~= "" then if fileExists(":admin/client/images/flags/"..toptimes.personal.country..".png") then dxDrawImage(sX-x*0.4227083333333333, (sY/2)+((10-1)*20)-y*0.4731481481481481, x*0.0083333333333333, y*0.0101851851851852/cY, ":admin/client/images/flags/"..toptimes.personal.country..".png", tocolor(255,255,255,255)) end else if fileExists(":admin/client/images/flags/gtasa.png") then dxDrawImage(sX-x*0.4227083333333333, (sY/2)+((10-1)*20)-y*0.4731481481481481, x*0.0083333333333333, y*0.0101851851851852/cY, ":admin/client/images/flags/gtasa.png", tocolor(255,255,255,255)) end end end
  11. The personal best though does not go to the correct position no matter what I do. Other things are fine now, just personal best rectangles, name, date, time and flag gotta be right under top9...idk why they aren't.
  12. Doesn't even show on screen now. Which is ok as I used the guigetscreensize to divide positions and everything, not x/1980 and y/1080. OK, I managed to fix the background rectangle's size by dividing the last y value by cY. dxDrawRectangle(sX-x*0.4354166666666667, (sY/2)-y*0.5, x*0.1979166666666667, y*0.0231481481481481/cY, clanColor)
  13. On FullHD it is, yea. Anything under and it goes bad (more or less).
  14. @Gravestone after I did what you said, size of dxtexts seems to be fine but the size of the background rectangle is smaller than it should be on small resolutions + the personal best is totally dispositioned (should be under top9) And I can't put size argument in dxDrawRectangle as far as i know.
  15. Heyo, so recently I got an awesome toptimes resource from a friend and today I fixed the positions of all elements drawn with dxDraw so that the toptimes window doesn't go outside of screen boundary on any resolution. So far, so good. But there is one problem, I don't know how to fix the elements' size to be same for all resolutions. I tried with something like " local x_,y_ = x/1680,y/1080 " and put " *y_ " after the size but it still looks ugly, also tried more combinations such as " x/1440,y/900 " and so on, to no success. Below is just the function which draws the F5 tops window, I always had trouble with fixing the size and here i am again, same problem...for the Nth time. Any help is appreciated. sX,sY = guiGetScreenSize() function drawToptimesIntreface() local x,y = guiGetScreenSize() if toptimes.animState == "closed" then local tick = getTickCount() - toptimes.tick local progress = tick/1000 toptimes.anim = interpolateBetween(0,0,0,390,0,0,progress,"OutBack") else local tick = getTickCount() - toptimes.tick local progress = tick/1000 toptimes.anim = interpolateBetween(390,0,0,0,0,0,progress,"InBack") end local clanColor = tocolor(255, 205, 0, 255) -- Clan Color local titleColor = tocolor(0, 255, 255, 255) -- Toptimes Title local displayColor = tocolor(0, 0, 0, 150) -- Toptimes Blackground if toptimes.state then local sY = sY-toptimes.anim*1.2 dxDrawRectangle(sX-x*0.4354166666666667, (sY/2)-y*0.5, x*0.1979166666666667, y*0.0231481481481481, clanColor) dxDrawText("Toptimes - "..toptimes.mapname, sX-x*0.6713541666666667, (sY/2)-y*0.8509259259259259,sX-x*0.0046875, (sY/2)-y*0.1240740740740741, tocolor(0,0,0,255), 1, "default-bold","center","center",true) dxDrawText("Toptimes - "..toptimes.mapname, sX-x*0.671875, (sY/2)-y*0.8518518518518519, sX-x*0.0052083333333333, (sY/2)-y*0.125, titleColor, 1, "default-bold", "center","center",true) dxDrawRectangle(sX-x*0.4354166666666667, (sY/2)-y*0.4768518518518519, x*0.1979166666666667, y*0.1666666666666667, displayColor) for i=1,9 do -- Show when player have toptime in any map dxDrawRectangle(sX-x*0.4354166666666667, (sY/2)+((i-1)*20)-y*0.4759259259259259, x*0.1979166666666667, y*0.017022792022792, tocolor(255,255,255,toptimes.color[i])) end for i=1,9 do -- Shadow dxDrawText(i..". "..removeColorCoding(toptimes.label[i]), sX-x*0.4310416666666667, (sY/2)+((i-1)*20)-y*0.8277777777777778, sX-x*0.0244791666666667, (sY/2)+((i)*20)-y*0.1240740740740741, tocolor(0,0,0,255), 1, "default-bold","left","center",true,false,false,true) dxDrawText(toptimes.time[i], sX-x*0.3132291666666667, (sY/2)+((i-1)*20)-y*0.8277777777777778, sX-x*0.0244791666666667, (sY/2)+((i)*20)-y*0.1240740740740741, tocolor(0,0,0,255), 1, "default-bold","left","center",true,false,false,true) dxDrawText(toptimes.data[i], sX-x*0.2744791666666667, (sY/2)+((i-1)*20)-y*0.8277777777777778, sX-x*0.0244791666666667, (sY/2)+((i)*20)-y*0.1240740740740741, tocolor(0,0,0,255), 1, "default-bold","left","center",true,false,false,true) -- dxDrawText(i..". "..toptimes.label[i], sX-x*0.4315625, (sY/2)+((i-1)*20)-y*0.8287037037037037, sX-x*0.025, (sY/2)+((i)*20)-y*0.125, tocolor(255,255,255,255), 1, "default-bold","left","center",true,false,false,true) dxDrawText(toptimes.time[i], sX-x*0.31375, (sY/2)+((i-1)*20)-y*0.8287037037037037, sX-x*0.025, (sY/2)+((i)*20)-y*0.125, tocolor(255,255,255,255), 1, "default-bold","left","center",true,false,false,true) dxDrawText(toptimes.data[i], sX-x*0.275, (sY/2)+((i-1)*20)-y*0.8287037037037037, sX-x*0.025, (sY/2)+((i)*20)-y*0.125, tocolor(255,255,255,255), 1, "default-bold","left","center",true,false,false,true) if toptimes.country[i] ~= "" then if fileExists(":admin/client/images/flags/"..toptimes.country[i]..".png") then dxDrawImage(sX-x*0.4227083333333333, (sY/2)+((i-1)*20)-y*0.4731481481481481, x*0.0083333333333333, y*0.0101851851851852, ":admin/client/images/flags/"..toptimes.country[i]..".png", tocolor(255,255,255,255)) end else if fileExists(":admin/client/images/flags/gtasa.png") then dxDrawImage(sX-x*0.4227083333333333, (sY/2)+((i-1)*20)-y*0.4731481481481481, x*0.0083333333333333, y*0.0101851851851852, ":admin/client/images/flags/gtasa.png", tocolor(255,255,255,255)) end end end if toptimes.personal[1] then dxDrawRectangle(sX-x*0.4354166666666667, (sY/2)-y*0.3101851851851852, x*0.1979166666666667, y*0.017592592592596, displayColor) dxDrawRectangle(sX-x*0.4354166666666667, (sY/2)-y*0.3089506172839506, x*0.1979166666666667, y*0.0166666666666667, tocolor(255,255,255,100)) -- Shadow dxDrawText(""..toptimes.personal.pos..". "..toptimes.personal.spacement..removeColorCoding(toptimes.personal.name), sX-x*0.4341666666666667, (sY/2)-y*0.6673611111111111, sX-x*0.0244791666666667, (sY/2)+y*0.0668981481481481, tocolor(0,0,0,255), 1, "default-bold","left","center",true,false,false,true) dxDrawText(toptimes.personal.time, sX-x*0.3132291666666667, (sY/2)-y*0.6645833333333333, sX-x*0.0244791666666667, (sY/2)+y*0.0641203703703704, tocolor(0,0,0,255), 1, "default-bold","left","center",true,false,false,true) dxDrawText(toptimes.personal.data, sX-x*0.2744791666666667, (sY/2)-y*0.6645833333333333, sX-x*0.0244791666666667, (sY/2)+y*0.0641203703703704, tocolor(0,0,0,255), 1, "default-bold","left","center",true,false,false,true) -- dxDrawText(""..toptimes.personal.pos..". "..toptimes.personal.spacement..toptimes.personal.name, sX-x*0.4346875, (sY/2)-y*0.668287037037037, sX-x*0.025, (sY/2)+y*0.0659722222222222, tocolor(255,255,255,255), 1, "default-bold","left","center",true,false,false,true) dxDrawText(toptimes.personal.time, sX-x*0.31375, (sY/2)-y*0.6655092592592593, sX-x*0.025, (sY/2)+y*0.0631944444444444, tocolor(255,255,255,255), 1, "default-bold","left","center",true,false,false,true) dxDrawText(toptimes.personal.data, sX-x*0.275, (sY/2)-y*0.6655092592592593, sX-x*0.025, (sY/2)+y*0.0631944444444444, tocolor(255,255,255,255), 1, "default-bold","left","center",true,false,false,true) if toptimes.personal.country ~= "" then if fileExists(":admin/client/images/flags/"..toptimes.personal.country..".png") then dxDrawImage(sX-x*0.4227083333333333, (sY/2)-y*0.30625, x*0.0083333333333333, y*0.0101851851851852, ":admin/client/images/flags/"..toptimes.personal.country..".png", tocolor(255,255,255,255)) end else if fileExists(":admin/client/images/flags/gtasa.png") then dxDrawImage(sX-x*0.4227083333333333, (sY/2)-y*0.30625, x*0.0083333333333333, y*0.0101851851851852, ":admin/client/images/flags/gtasa.png", tocolor(255,255,255,255)) end end end end end addEventHandler("onClientRender",getRootElement(),drawToptimesIntreface) This is how it should look like, on any screen :
  16. pls next time put the 1k lines file as a spoiler :v
  17. koragg

    freeze camera

    Well, depending on what you want to achieve here are two things. 1st: If you want to lock the camera's target to a specific location or object, use setCameraMatrix 2nd: If you want to make the player to not be able to move at all, use setElementFrozen(localPlayer, true)
  18. God, this... please explain better what you wanna achieve ? All I got was that you're editing your scoreboard but the rest
  19. @Walid wow, didn't expect someone would just write me the fixed script Thanks, it works perfect + is less lines now.
  20. attemp to index local 'thePlayerName' (a nil value), line 361. That's the getfrompartialname function there.
  21. Hey everyone, So basically the full command is /give (part of) nick amount. That way players can give coins to each other but there is one thing that I'm not able to fix myself. When a player enters just /give (part of) nick without the amount part, a chatbox message is shown stating the full command. When a player writes a nickname which isn't on the server, it says invalid user. Now here comes my problem, when a player enters just /give without anything else after it, I want it to show the same message I mentioned above which shows the correct command's syntax in chat. At the moment if you type /give it shows few errors in debug (that it can't find part of the name, in GetPlayerFromPartialName function). I need it to show a message telling the full command to the user who entered /give and ofcourse there should be no debug errors. I tried to figure it out by using [arg] but no luck, and I'm not really familiar with how that works, even though I have an example script which uses arguments and also requires 3 of them to work. function giveCash(player, command, who, amount) local playeraccount = getPlayerAccount (player) local otherguy = getPlayerFromPartialName(who) or getPlayerFromName(who) if isGuestAccount(playeraccount) then outputChatBox("You need to register and login in order to share coins!", player, 255,153,0) return end if not amount then outputChatBox("#FF0000Correct command is : #FEFE22/give [(part of) nick] [amount]", player, 0, 255, 0, true) return end if not otherguy then outputChatBox("No player found.", player, 255, 0,0) return end if otherguy == player then outputChatBox("In case you haven't noticed, you're trying to give KnightCoins to yourself. #FEFE22WAKE UP!", player, 0, 255, 0, true) return end coinslimit = tonumber(getAccountData(playeraccount, "knightcoins") or 0) if round(tonumber(amount)) > coinslimit then outputChatBox("You don't have so many KnightCoins. Please select a lower amount to give.", player, 255, 0, 0, true) return end if otherguy then local playeraccount = getPlayerAccount (player) local otheraccount = getPlayerAccount (otherguy) if isGuestAccount(otheraccount) then outputChatBox("This player is not registered / logged in.", player, 255, 0, 0, true) return end givercash = tonumber(getAccountData(playeraccount, "knightcoins") or 0) - round(tonumber(amount)) setAccountData (playeraccount, "knightcoins", givercash) setElementData (player,"data.knightcoins", givercash, true) if round(amount) ~= 1 then outputChatBox("#00FFFFYou gave #00FF00"..comma_value(round(tonumber(amount))).." #00FFFFKnightCoins to #FFFFFF"..getPlayerName(otherguy).."#00FFFF.", player, 0, 255, 255, true) recievercash = tonumber(getAccountData(otheraccount, "knightcoins") or 0) + round(tonumber(amount)) setAccountData (otheraccount, "knightcoins", recievercash) setElementData (otherguy,"data.knightcoins", recievercash, true) else outputChatBox("#00FFFFYou gave #00FF00"..comma_value(round(tonumber(amount))).." #00FFFFKnightCoin to #FFFFFF"..getPlayerName(otherguy).."#00FFFF.", player, 0, 255, 255, true) recievercash = tonumber(getAccountData(otheraccount, "knightcoins") or 0) + round(tonumber(amount)) setAccountData (otheraccount, "knightcoins", recievercash) setElementData (otherguy,"data.knightcoins", recievercash, true) end if round(amount) ~= 1 then outputChatBox("#FFFFFF"..getPlayerName(player).." #00FFFF gave you #00FF00"..comma_value(round(tonumber(amount))).." #00FFFFKnightCoins.", otherguy, 0, 255, 255, true) else outputChatBox("#FFFFFF"..getPlayerName(player).." #00FFFF gave you #00FF00"..comma_value(round(tonumber(amount))).." #00FFFFKnightCoin.", otherguy, 0, 255, 255, true) end end end addCommandHandler("give", giveCash) -------------------------------------------------------------------------------------------------------------------------- --http://lua-users.org/wiki/FormattingNumbers function comma_value(amount) local formatted = amount while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if (k==0) then break end end return formatted end -------------------------------------------------------------------------------------------------------------------------- function getPlayerFromPartialName(thePlayerName) local thePlayer = getPlayerFromName(thePlayerName) if thePlayer then return thePlayer end for _,thePlayer in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then return thePlayer end end return false end -------------------------------------------------------------------------------------------------------------------------- --http://lua-users.org/wiki/FormattingNumbers function round(val, decimal) if (decimal) then return math.floor( (val * 10^decimal) + 0.5) / (10^decimal) else return math.floor(val+0.5) end end
  22. hm, is it possible that playing with 1.5.3 client on a 1.5.2 server causes fps drops? Before updating I could record with 45-60fps with bandicam, now it's down to 35-45.
  23. So far, so good. No problems with 1.5.3 at all (neither client nor server) Good job guys! PS @DemonSeed yea I figured that out heh
×
×
  • Create New...