Jump to content

destrodio

Members
  • Posts

    13
  • Joined

  • Last visited

destrodio's Achievements

Square

Square (6/54)

0

Reputation

  1. ну помогите.. народ! хоть кто нибудь
  2. Ну хоть кто нибудь помогите!
  3. понимаю что тема подобная создавалась, но не чем не помогло(((( вот собственно вопрос: какие строчки добавить в скрипт чтоб была музыка из авто на расстоянии вот скрипт Клиент: sx,sy = guiGetScreenSize () local volume = 0.3 local guiShowing = false local currentPlaying = nil local state = nil musicPlayerGUI = {} width,height = 200,350 function createGui () musicPlayerGUI.window = guiCreateWindow(sx-width,sy/2-height/2,width,height,"Radio player",false) musicPlayerGUI.grid = guiCreateGridList(5,25,width-10,height-95,false,musicPlayerGUI.window) addEventHandler ( "onClientGUIDoubleClick", musicPlayerGUI.grid, onGuiClick, true ) -- klikanie w grid odpala radio stacje musicPlayerGUI.column = guiGridListAddColumn(musicPlayerGUI.grid,"Radio stations",0.9) musicPlayerGUI.button1 = guiCreateButton(10,height-65,25,20,">",false,musicPlayerGUI.window) addEventHandler ( "onClientGUIClick", musicPlayerGUI.button1, onGuiClick,true) musicPlayerGUI.button2 = guiCreateButton (40, height-65,25,20,"||",false,musicPlayerGUI.window) addEventHandler ( "onClientGUIClick", musicPlayerGUI.button2, onGuiClick, true ) musicPlayerGUI.button3 = guiCreateButton(70,height-65,60,20,"Play 3D",false,musicPlayerGUI.window) addEventHandler ( "onClientGUIClick", musicPlayerGUI.button3, onGuiClick, true ) musicPlayerGUI.button4 = guiCreateButton (135, height-65,60,20,"Close",false,musicPlayerGUI.window) addEventHandler ( "onClientGUIClick", musicPlayerGUI.button4, onGuiClick, true ) musicPlayerGUI.label = guiCreateLabel (5,height-45,width-10,20,"Volume",false,musicPlayerGUI.window) guiSetFont (musicPlayerGUI.label, "default-bold-small") guiLabelSetHorizontalAlign (musicPlayerGUI.label, "center") musicPlayerGUI.volumeBar = guiCreateScrollBar(5,height-30,width-10,20,true,false,musicPlayerGUI.window) guiScrollBarSetScrollPosition (musicPlayerGUI.volumeBar, volume*100) guiWindowSetMovable (musicPlayerGUI.window, false) guiWindowSetSizable (musicPlayerGUI.window, false) guiSetVisible (musicPlayerGUI.window, false) end stationsNames = {} stations = {} function showGui () if guiShowing then guiShowing = false guiSetVisible (musicPlayerGUI.window, false) showCursor (false) else guiShowing = true guiSetVisible (musicPlayerGUI.window, true) showCursor (true) end end bindKey("m","down", showGui) function onGuiClick (button, state, x,y) if source == musicPlayerGUI.button1 and state == "up" then --play button local selected = guiGridListGetSelectedItem (musicPlayerGUI.grid) if selected then local stationName = guiGridListGetItemText (musicPlayerGUI.grid, selected, musicPlayerGUI.column) if stationName then if currentPlaying then stopSound (currentPlaying) end currentPlaying = playSound (stations[stationName]) setSoundVolume (currentPlaying, volume) state = "play" else outputChatBox ("unknown error") end elseif state == "pause" and isSoundPaused(currentPlaying) then setSoundPaused (currentPlaying, false) end end if source == musicPlayerGUI.button2 and state == "up" then --pause button if isSoundPaused (currentPlaying) == false then setSoundPaused (currentPlaying, true) end end if source == musicPlayerGUI.button3 and state == "up" then -- 3d local selected = guiGridListGetSelectedItem (musicPlayerGUI.grid) if selected then local stationName = guiGridListGetItemText (musicPlayerGUI.grid, selected, musicPlayerGUI.column) if stationName then triggerServerEvent ("onClientRadioCreate", getLocalPlayer(), getLocalPlayer(), stationName) end end end if source == musicPlayerGUI.button4 and state == "up" then -- close showGui () end if source == musicPlayerGUI.grid and state == "up" then -- grid list click local selected = guiGridListGetSelectedItem (musicPlayerGUI.grid) if selected then local stationName = guiGridListGetItemText (musicPlayerGUI.grid, selected, musicPlayerGUI.column) if stationName then if currentPlaying then stopSound (currentPlaying) end currentPlaying = playSound (stations[stationName]) setSoundVolume (currentPlaying, volume) else outputChatBox ("unknown error") end end end end function OnScroll(Scrolled) if source == musicPlayerGUI.volumeBar then volume = guiScrollBarGetScrollPosition (source) / 100 if currentPlaying then setSoundVolume (currentPlaying, volume) end end end addEventHandler("onClientGUIScroll",getRootElement(),OnScroll) function onRadioCreate (x,y,z,path) local sound = playSound3D (path, x,y,z) setSoundVolume (sound, volume) setSoundMaxDistance (sound, 20) end addEvent ("onNewRadioCreate", true) addEventHandler ("onNewRadioCreate", getRootElement(), onRadioCreate) function onStart () triggerServerEvent ("requestForRadios", getLocalPlayer(), getLocalPlayer()) end addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()), onStart) function onJoin (radia, names, st) for k,v in ipairs(radia) do local sound = playSound3D (v[4], v[1], v[2], v[3]) setSoundVolume (sound, volume/100) setSoundMaxDistance (sound, 20) end stationsNames = names stations = st for k,v in ipairs(stationsNames) do local row = guiGridListAddRow ( musicPlayerGUI.grid ) guiGridListSetItemText ( musicPlayerGUI.grid, row, musicPlayerGUI.column, v, false, false ) end end addEvent ("sendAllRadios", true) addEventHandler ("sendAllRadios", getRootElement(), onJoin) createGui () server function getPointFromDistanceRotation(x, y, dist, angle) local a = math.rad(angle+90) local plusX = math.cos(a) * dist local plusY = math.sin(a) * dist return x+plusX, y+plusY end xmlFile = xmlLoadFile ("radios.xml") radios = {} stations = {} stationsNames = {} function loadStations () if xmlFile then local children = xmlNodeGetChildren (xmlFile) for k,v in ipairs(children) do local radioTable = xmlNodeGetAttributes (v) for name,value in pairs(radioTable) do --outputChatBox (tostring(value)) if name == "name" then stationName = value elseif name == "path" then stationPath = value end end --outputChatBox ("name = " .. tostring(stationName) .. ", path = " .. tostring(stationPath)) stations[stationName] = stationPath table.insert (stationsNames, 1, stationName) end table.sort (stationsNames) end end loadStations () --stacje["kwejk"] = "http://fm.kwejk.pl/kwejkfm_aac.m3u" --stacje["zet"] = "http://www.radiozet.pl/content/stream/radiozet.pls" --stacje["rmf"] = "http://www.miastomuzyki.pl/odbior/rmf_aacp.pls" --stacje["rmf fm"] = "http://www.miastomuzyki.pl/odbior/rmf_aacp.pls" --nazwyStacji = {"kwejk", "zet", "rmf fm"} function createRadio (player,station) if station then local stationPath = stations[station] if stationPath then local x,y,z = getElementPosition( player ) local rx,ry,rz = getElementRotation ( player ) local newX, newY = getPointFromDistanceRotation (x,y, 1.5, rz) local newZ = z - 1 local obiekt = createObject (2226, newX, newY, newZ, rx,ry,rz) triggerClientEvent ("onNewRadioCreate", getRootElement(), newX, newY, newZ, stationPath) -- wysyla informacje do clientow o nowym radiu outputChatBox ("New station: " .. station .. " created, path: " .. tostring(stationPath), 0,220,0) table.insert (radios, 1, {newX, newY, newZ, stationPath}) -- zapisuje informacje o radiu dla nowych graczy else outputChatBox ("error", player, 220, 0, 0) --outputChatBox ("You choose wrong station, avaible stations:", player, 220, 0, 0) --for k,v in ipairs(stationsNames) do --outputChatBox ("-" .. v, player) --end end else outputChatBox ("error", player, 220, 0, 0) --outputChatBox ("Choose radio to create, avaible stations:", player,220,0,0) --for k,v in ipairs(stationsNames) do -- outputChatBox ("-" .. v, player) --end end end addEvent ("onClientRadioCreate", true) addEventHandler ("onClientRadioCreate", getRootElement(), createRadio) --addCommandHandler ("radio", createRadio) function onJoin (player) if radios then triggerClientEvent (player, "sendAllRadios", getRootElement(), radios, stationsNames, stations) end end addEvent ("requestForRadios", true) addEventHandler ("requestForRadios", getRootElement(), onJoin)
  4. BASS ERROR 0 in PlayStream b3D = true path = :radio3d_playlist/music/http://dubstep.fm/listen.pls вот что пишет мне в консоли
  5. а куда тогда URL ссылки ставить?
  6. он же не читает ссылки URL он просто mp3 файлы
  7. а поподробнее можно друзья???
  8. как можно реализовать интернет радио, но чтоб было его слышно из машины??? видел подобную тему, но так и не понял что и как там делать, прошу ногами не пинать, так как я только начинающий! Жду вашей помощи...
  9. собственно не смог я нарыть его нигде нет(( вот собственно вопрос... сколько будет стоить это реализовать??? да и кто возмется???прошу понять, и помоч
  10. но я видел на одном сервере такое окно! там написано заменить модели или нет, и выбираешь что заменить, ну выбрал что надо, и оно заменяется
  11. НароД! правда нужна ваша помошь, я в тупике
  12. Ребян я новенький тут и в скриптинге неочень разбираюсь... но без вашей помощи я боюсь что все мои планы рухнут... у меня на сервере Очень много модов, и когда всё включаешь, то при заходе на сервер он ооооочень долго включается, вот собственно просьба: можете помочь сделать так чтоб при включении сервера обобразилась окошко которое спрашивает заменить модели или нет, ну чтоб они не сразу включались а только после захода серв,и серверу будет легче, да и игрокам на нём. Надеюсь что, изложеное мной понятно и смысл ясен. если какие то вопросы, спрашивайте
×
×
  • Create New...