shaio Posted July 22, 2016 Share Posted July 22, 2016 How would I hook up commands to these events? local sound = {} local blocked = {} local draw = {} addEvent ("playSounds", true) addEventHandler ("playSounds", getRootElement(), function (sound2D, sound3D, attached, theSound, x, y, z, player, vehicle) if (checkBlockedPlayers (player) == true) then outputChatBox (getPlayerName(player).." is currently on your blocked players list.") else if string.find(tostring(theSound), "http://") == nil and string.find(tostring(theSound), "https://") == nil then theSound = string.format("http://%s", theSound) end local newSound = url_decode (theSound) if sound3D == true then if attached == false then local dimension = getElementDimension (player) sound[player] = playSound3D (theSound, x, y, z, true) if not sound[player] then outputChatBox ("Failed to create your sound. (not attached)") end setElementDimension (sound[player], dimension) attachElements (sound[player], getRootElement()) setSoundMinDistance (sound[player], 20) setSoundMaxDistance (sound[player], 40) setSoundVolume (sound[player], 15) addText (player, tostring(newSound), false, true, x, y, z) return true elseif attached == true then if vehicle then local dimension = getElementDimension (vehicle) sound[player] = playSound3D (theSound, x, y, z, true) if not sound[player] then outputChatBox ("Failed to create your sound. (attached + vehicle)") end setElementDimension (sound[player], dimension) setSoundVolume (sound[player], 1) setSoundMinDistance (sound[player], 20) setSoundMaxDistance (sound[player], 40) attachElements (sound[player], vehicle, 0, 0, 0) addText (player, tostring(newSound), vehicle) return true else local dimension = getElementDimension (player) sound[player] = playSound3D (theSound, x, y, z, true) if not sound[player] then outputChatBox ("Failed to create your sound. (attached + on foot)") end setElementDimension (sound[player], dimension) setSoundVolume (sound[player], 1) setSoundMinDistance (sound[player], -- s8) --> setSoundMaxDistance (sound[player], 18) attachElements (sound[player], player, 0, 0, 0) addText (player, tostring(newSound)) return true end else outputConsole ("Failed attach and static") end elseif sound2D == true then sound[player] = playSound (theSound, true) setSoundVolume (sound[player], 1) return true else outputConsole ("Failed making anything") end end end ) addEvent ("stopAllSongs", true) addEventHandler ("stopAllSongs", getRootElement(), function () for k, v in ipairs (getElementsByType ("sound")) do destroyElement (v) end draw = {} end ) addEvent ("stopPlayerSongs", true) addEventHandler ("stopPlayerSongs", getRootElement(), function (player) if sound[player] then destroyElement (sound[player]) removeText (player) end end ) function checkBlockedPlayers (player) for k, players in ipairs (blocked) do if players == player then return true else return false end end end function addText(player, text, vehicle, static, x, y, z) local temp if vehicle then temp = { ["player"] = player, ["text"] = text, ["vehicle"] = vehicle } elseif static == true then temp = { ["player"] = player, ["text"] = text, ["vehicle"] = false, ["static"] = true, ["x"] = x, ["y"] = y, ["z"] = z } else temp = { ["player"] = player, ["text"] = text } end table.insert (draw, temp) end function removeText (player) for k, v in ipairs (draw) do if v["player"] == player then table.remove (draw, k) break end end end function url_decode(str) str = string.gsub (str, "+", " ") str = string.gsub (str, "%%(%x%x)", function(h) return string.char(tonumber(h,16)) end) str = string.gsub (str, "\r\n", "\n") return str end addEvent ("blockPlayer", true) addEventHandler ("blockPlayer", getRootElement(), function (player) if checkBlockedPlayers (player) == false or checkBlockedPlayers (player) == nil then table.insert (blocked, player) outputChatBox ("Blocked "..getPlayerName (player)) elseif checkBlockedPlayers (player) == true then for k, v in ipairs (blocked) do if v == player then table.remove (blocked, k) break end end outputChatBox ("Unblocked "..getPlayerName (player)) end end ) addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()), function () setTimer (triggerServerEvent, 4000, 1, "startSounds", getRootElement(), getLocalPlayer()) end ) addEventHandler ("onClientRender", getRootElement(), function () if draw then for k, v in ipairs(draw) do if isElement (v["player"]) then local x, y, z if v["static"] == true then x, y, z = v["x"], v["y"], v["z"] elseif v["vehicle"] and isElement (v["vehicle"]) then x1, y1, z1 = getElementPosition (v["vehicle"]) x, y, z = x1, y1, z1 + 1 else local camPosXl, camPosYl, camPosZl = getPedBonePosition (v["player"], 6) local camPosXr, camPosYr, camPosZr = getPedBonePosition (v["player"], 7) x, y, z = (camPosXl + camPosXr) / 2, (camPosYl + camPosYr) / 2, (camPosZl + camPosZr) / 2 end local cx, cy, cz = getCameraMatrix () local distance = getDistanceBetweenPoints3D (cx, cy, cz, x, y, z) local posx, posy = getScreenFromWorldPosition (x, y, z + 0.020 * distance + 0.10) local ignore = getPedOccupiedVehicle (v["player"]) or v["player"] local ignore2 = getPedOccupiedVehicle(getLocalPlayer()) or getLocalPlayer() if posx and distance <= 45 and (isLineOfSightClear (cx, cy, cz, x, y, z, true, true, false, true, false, true, false, ignore)) and (isLineOfSightClear (cx, cy, cz, x, y, z, true, true, false, true, false, true, false, ignore2)) then local width = dxGetTextWidth (v["text"], 1, "default") dxDrawText (v["text"], posx - (0.5 * width), posy, posx - (0.5 * width), posy, tocolor(255, 255, 255, 255), 1, "default", "left", "top", false, false, false) end end end end end ) Link to comment
EstrategiaGTA Posted July 22, 2016 Share Posted July 22, 2016 Not stealing client side scripts. Link to comment
shaio Posted July 22, 2016 Author Share Posted July 22, 2016 Could I just get some help? Link to comment
EstrategiaGTA Posted July 22, 2016 Share Posted July 22, 2016 We don't give support for leaked scripts... Link to comment
Captain Cody Posted July 22, 2016 Share Posted July 22, 2016 Well it doesn't seam like the script itself actually works any ways, there are a few messed up bits of it. Link to comment
shaio Posted July 23, 2016 Author Share Posted July 23, 2016 this is not a leaked script, this is custom built by a scripter that i know, but the scripter wont help me so i'm asking for help here. The script works, I just don't have the serverside for it.. Link to comment
EstrategiaGTA Posted July 23, 2016 Share Posted July 23, 2016 Sure, liar, I read your post saying it was leaked from client side, I know it is bad but I really want this, etc... Make one yourself and don't leak others' works. Link to comment
shaio Posted July 23, 2016 Author Share Posted July 23, 2016 for real bro its not leaked.. Link to comment
shaio Posted July 24, 2016 Author Share Posted July 24, 2016 right but what variables do i need in the function to trigger the event properly? Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now