Jump to content

~Gangsta~

Members
  • Posts

    45
  • Joined

  • Last visited

Everything posted by ~Gangsta~

  1. And why when the player presses the stop and I still hear the music and he did not
  2. not work gMe = getLocalPlayer(); gRoot = getRootElement(); gResRoot = getResourceRootElement( getThisResource () ); btn = {}; ipodCoor = { moving={}, pos={} }; addEvent( "clientReceiveMusicTable", true ); local sound = {} addEventHandler( "onClientResourceStart", gResRoot, function () outputChatBox( "Press 'i' to open your iPod", 0, 255, 0 ); ipod = guiCreateStaticImage( 1.0, 0.2279, 0.1916, 0.4036, "ipod.png", true ); --0.7744 ipodCoor.moving[ipod] = false; ipodCoor.pos[ipod] = "out"; songDisplay = guiCreateGridList( 0.0671, 0.0245, 0.8504, 0.4663, true, ipod ); btn[1] = guiCreateButton( 0.64, 0.67, 0.15, 0.05, "Abspielen", true, ipod ); btn[2] = guiCreateButton( 0.185, 0.67, 0.15, 0.05, "Stop", true, ipod ); btn[3] = guiCreateButton( 0.42, 0.825, 0.15, 0.05, "vD", true, ipod ); btn[4] = guiCreateButton( 0.42, 0.525, 0.15, 0.05, "vU", true, ipod ); for i=1,4 do guiSetAlpha( btn[i], 1.0 ); guiSetFont( btn[i], "default-small" ); end; songList = guiGridListAddColumn( songDisplay, "My Songs", 0.85 ); triggerServerEvent( "serverLoadMusicTable", gMe ); addEventHandler( "onClientGUIClick", gRoot, function () local theVehicle = getPedOccupiedVehicle ( gMe ) if source == btn[1] then local selSong = guiGridListGetItemData( songDisplay, guiGridListGetSelectedItem( songDisplay ) ); if selSong then if not sound then triggerServerEvent ( "createSound", root, selSong, theVehicle) else stopSound(sound); triggerServerEvent ( "createSound", root, selSong, theVehicle) end; end; elseif source == btn[2] then if sound then stopSound(sound); sound = nil; end; elseif source == btn[4] then if music then setSoundVolume( music, getSoundVolume( music ) + 0.25 ); if getSoundVolume( music ) > 1 then setSoundVolume( music, 1 ); end; end; elseif source == btn[3] then if music then setSoundVolume( music, getSoundVolume( music ) - 0.25 ); if getSoundVolume( music ) < 0 then setSoundVolume( music, 0 ); end; end; end; end ) bindKey( "i", "down", function () if ipodCoor.moving[ipod] == false then if ipodCoor.pos[ipod] == "out" then showCursor( true, false ); ipodCoor.moving[ipod] = true; addEventHandler( "onClientRender", gRoot, openIPod ); toggleControl( "fire", false ); else showCursor( false, false ); ipodCoor.moving[ipod] = true; addEventHandler( "onClientRender", gRoot, closeIPod ); toggleControl( "fire", true ); end; end; end ) end ) function openIPod() local x, y = guiGetPosition( ipod, true ); guiSetPosition( ipod, x - 0.01, y, true ); if x < 0.775 then ipodCoor.moving[ipod] = false; ipodCoor.pos[ipod] = "in"; removeEventHandler( "onClientRender", gRoot, openIPod ); end; end; function closeIPod() local x, y = guiGetPosition( ipod, true ); guiSetPosition( ipod, x + 0.01, y, true ); if x > 1.0 then guiSetPosition( ipod, 1.0, y, true ); ipodCoor.moving[ipod] = false; ipodCoor.pos[ipod] = "out"; removeEventHandler( "onClientRender", gRoot, closeIPod ); end; end; addEventHandler( "clientReceiveMusicTable", gRoot, function ( mTable ) if mTable == nil then triggerServerEvent( "serverLoadMusicTable", gMe ); else for _, v in ipairs ( mTable ) do local row = guiGridListAddRow( songDisplay ); local streamtable = split(v, ';') guiGridListSetItemText( songDisplay, row, 1, streamtable[2], false, false ); guiGridListSetItemData ( songDisplay, row, 1, streamtable[1]); outputChatBox(streamtable[2].." has ben added to your ipod", getLocalPlayer()); end; guiGridListAutoSizeColumn( songDisplay, 1 ); guiBringToFront( songDisplay ); end; end ) addEvent ( "createSoundClient", true ) addEventHandler ( "createSoundClient", root, function ( id, theVehicle ) local x, y, z = getElementPosition(theVehicle) sound = playSound3D(id, x, y, z ) attachElements ( sound, theVehicle ) end ) WARNING:ipod\ipod_c.lua:43:Bad argument @ 'stopSound' [Expected sound at argument 1, got table]
  3. I do not understand why the music does not stop please help me, I wanted to do this radio for cars client gMe = getLocalPlayer(); gRoot = getRootElement(); gResRoot = getResourceRootElement( getThisResource () ); btn = {}; ipodCoor = { moving={}, pos={} }; addEvent( "clientReceiveMusicTable", true ); local sound = {} addEventHandler( "onClientResourceStart", gResRoot, function () outputChatBox( "Press 'i' to open your iPod", 0, 255, 0 ); ipod = guiCreateStaticImage( 1.0, 0.2279, 0.1916, 0.4036, "ipod.png", true ); --0.7744 ipodCoor.moving[ipod] = false; ipodCoor.pos[ipod] = "out"; songDisplay = guiCreateGridList( 0.0671, 0.0245, 0.8504, 0.4663, true, ipod ); btn[1] = guiCreateButton( 0.64, 0.67, 0.15, 0.05, "Abspielen", true, ipod ); btn[2] = guiCreateButton( 0.185, 0.67, 0.15, 0.05, "Stop", true, ipod ); btn[3] = guiCreateButton( 0.42, 0.825, 0.15, 0.05, "vD", true, ipod ); btn[4] = guiCreateButton( 0.42, 0.525, 0.15, 0.05, "vU", true, ipod ); for i=1,4 do guiSetAlpha( btn[i], 1.0 ); guiSetFont( btn[i], "default-small" ); end; songList = guiGridListAddColumn( songDisplay, "My Songs", 0.85 ); triggerServerEvent( "serverLoadMusicTable", gMe ); addEventHandler( "onClientGUIClick", gRoot, function () local theVehicle = getPedOccupiedVehicle ( gMe ) if source == btn[1] then local selSong = guiGridListGetItemData( songDisplay, guiGridListGetSelectedItem( songDisplay ) ); if selSong then if not sound then triggerServerEvent ( "createSound", root, selSong, theVehicle) else stopSound( sound); triggerServerEvent ( "createSound", root, selSong, theVehicle) end; end; elseif source == btn[2] then if sound then stopSound( sound); sound = nil; end; elseif source == btn[4] then if music then setSoundVolume( music, getSoundVolume( music ) + 0.25 ); if getSoundVolume( music ) > 1 then setSoundVolume( music, 1 ); end; end; elseif source == btn[3] then if music then setSoundVolume( music, getSoundVolume( music ) - 0.25 ); if getSoundVolume( music ) < 0 then setSoundVolume( music, 0 ); end; end; end; end ) bindKey( "i", "down", function () if ipodCoor.moving[ipod] == false then if ipodCoor.pos[ipod] == "out" then showCursor( true, false ); ipodCoor.moving[ipod] = true; addEventHandler( "onClientRender", gRoot, openIPod ); toggleControl( "fire", false ); else showCursor( false, false ); ipodCoor.moving[ipod] = true; addEventHandler( "onClientRender", gRoot, closeIPod ); toggleControl( "fire", true ); end; end; end ) end ) function openIPod() local x, y = guiGetPosition( ipod, true ); guiSetPosition( ipod, x - 0.01, y, true ); if x < 0.775 then ipodCoor.moving[ipod] = false; ipodCoor.pos[ipod] = "in"; removeEventHandler( "onClientRender", gRoot, openIPod ); end; end; function closeIPod() local x, y = guiGetPosition( ipod, true ); guiSetPosition( ipod, x + 0.01, y, true ); if x > 1.0 then guiSetPosition( ipod, 1.0, y, true ); ipodCoor.moving[ipod] = false; ipodCoor.pos[ipod] = "out"; removeEventHandler( "onClientRender", gRoot, closeIPod ); end; end; addEventHandler( "clientReceiveMusicTable", gRoot, function ( mTable ) if mTable == nil then triggerServerEvent( "serverLoadMusicTable", gMe ); else for _, v in ipairs ( mTable ) do local row = guiGridListAddRow( songDisplay ); local streamtable = split(v, ';') guiGridListSetItemText( songDisplay, row, 1, streamtable[2], false, false ); guiGridListSetItemData ( songDisplay, row, 1, streamtable[1]); outputChatBox(streamtable[2].." has ben added to your ipod", getLocalPlayer()); end; guiGridListAutoSizeColumn( songDisplay, 1 ); guiBringToFront( songDisplay ); end; end ) addEvent ( "createSoundClient", true ) addEventHandler ( "createSoundClient", root, function ( id, theVehicle ) local x, y, z = getElementPosition(theVehicle) local sound = playSound3D(id, x, y, z ) attachElements ( sound, theVehicle ) end ) server local gRoot = getRootElement(); addEvent( "serverLoadMusicTable", true ); addEventHandler( "serverLoadMusicTable", gRoot, function () local res, mTable, xml = getThisResource(), {}, xmlLoadFile( "meta.xml", res ); local nameTable = {} if xml then local i = 0; while ( xmlFindChild( xml, "stream", i ) ) do local dir = xmlNodeGetAttribute( xmlFindChild( xml, "stream", i ), "url" ); local streamname = xmlNodeGetAttribute( xmlFindChild( xml, "stream", i ), "name" ); table.insert( mTable, dir..";"..streamname ); i = i + 1; end; end; triggerClientEvent( source, "clientReceiveMusicTable", gRoot, mTable ); end ) addEvent ( "createSound", true ) addEventHandler ( "createSound", root, function ( id, theVehicle) if ( theVehicle ) then triggerClientEvent(root, "createSoundClient", root, id, theVehicle) end end )
  4. ~Gangsta~

    Freeroam

    Hi all, how can disable a Freeroam in another dimension
  5. Здравствуйте! Я хочу создать систему неона на своем сервере. Вопрос: на какой стороне лучше аттачить неон P.S. в с скриптинге я пока новичок
  6. зайди в settings, выбери "weapon/disallowed" и запрети желаемое оружие.. типо "38, 31" (без скобок)
  7. ~Gangsta~

    lights

    How to turn the headlights on the car on the right side
  8. client function showGUI() guiSetVisible(Wnd,true) showCursor(true) end addEvent("showGUI",true) addEventHandler("showGUI",getRootElement(),showGUI) addEvent("hideGUI",true) addEventHandler("hideGUI",getRootElement(), function () guiSetVisible(Wnd,false) showCursor (false) end) server shop = createMarker( 1541.7912597656,-1697.8956298828,12.5, "cylinder", 2, 255, 255, 255, 255 ) function showGUI(hitPlayer) triggerClientEvent (hitPlayer,"showGUI",getRootElement(),hitPlayer) end addEventHandler ("onMarkerHit",shop,showGUI) addEventHandler("onMarkerLeave",shop, function (leavePlayer) triggerClientEvent(leavePlayer,"hideGUI",leavePlayer) end)
  9. ~Gangsta~

    lights

    Hi all! How to turn the headlights on the car on the right side?
  10. Hi all ! How to make DX? not to change the size and position at different resolutions?
  11. Привет всем! Я на своем сервере хочу сделать систему скрытых пакетов (надо собрать каждому игроку по 100 пакетов) На какой стороне делать этот скрипт?
  12. One can replace the sound of cars?
  13. How to make sure that when you click the cursor on the player open gui?
  14. ~Gangsta~

    Help GUI!

    Hi all ! How to make gui? not to change the size and position at different resolutions (I knew what to do with guiGetScreenSize, but what's next?)
  15. ~Gangsta~

    Help

    Tete omar, thank you!
  16. ~Gangsta~

    Help

    please show an example
  17. ~Gangsta~

    Help

    please show an example ..... I just started to learn scripting
  18. ~Gangsta~

    Help

    how to create a top 5 player money in chat?
×
×
  • Create New...