Jump to content

~Gangsta~

Members
  • Posts

    45
  • Joined

  • Last visited

Everything posted by ~Gangsta~

  1. How to install the vinyl on the door? Help Pls
  2. Всем привет! Как можно определить нагрузку сервера, и скрипт который больше всего нагружает сервер?
  3. how to make the hidden packages to every player could find 100 pieces and save can write an algorithm??? pls help
  4. Всем привет. Можно ли добавть элементдате ключ на русском языке setElementData ( thePlayer, "Страна", ?
  5. Спасибо что ответил, но проблема не решена
  6. Всем привет. У меня проблема, когда я захожу на маркер открываются ворота, а когда захожу повторно, нет ни каких действий, а по идеи ворота должны закрыться, я думаю что это из-за того что status[markerParent] не меняется на 'open'. Пожалуйста помоги решить эту проблему. скрипт TCT local dist3d = getDistanceBetweenPoints3D local status = {} addEventHandler ( "onMarkerHit", resourceRoot, function (hitElement,matchingDimension ) if matchingDimension ~= true then return end markerParent = getElementParent (source) status[markerParent] = 'close' if getElementType ( markerParent ) ~= "object" and getElementType ( markerParent ) ~= "marker" then return end for _, trigger in ipairs ( getElementsByType ( "trigger", source ) ) do local triggerData = getAllElementData ( trigger ) local x, y, z = getElementPosition ( markerParent ) if dist3d ( x, y, z, triggerData.startX, triggerData.startY, triggerData.startZ ) < dist3d ( x, y, z, triggerData.endX, triggerData.endY, triggerData.endZ) then if status[markerParent] == 'close' then moveObject ( markerParent, triggerData.time, triggerData.endX, triggerData.endY, triggerData.endZ,triggerData.endrX, triggerData.endrY, triggerData.endrZ) setTimer(function()status[markerParent] = 'open' end,triggerData.time,1) end else if status[markerParent] == 'open' then moveObject( markerParent, triggerData.time, triggerData.startX, triggerData.startY, triggerData.startZ ) setTimer(function()status[markerParent] = 'close' end,triggerData.time,1) end end end end )
  7. ~Gangsta~

    Markers

    how to do it? what to use the functions?
  8. ~Gangsta~

    Markers

    I wanted make the hidden packages I want to do after the restart taken packages do not appear
  9. ~Gangsta~

    Markers

    how to keep position markers after restart resource? local markers = { {2473.29834, -1667.39075, 13.31641}, {2484.35034, -1660.34570, 13.33595}, {2491.05371, -1675.56274, 13.33595}, } local Marker = {} addEventHandler( 'onResourceStart', getResourceRootElement( getThisResource () ), function() for i, pos in ipairs( markers ) do Marker[i] = createMarker( pos[1], pos[2], pos[3], 'cylinder', 2.5, 0,255,0,255 ) addEventHandler ( "onMarkerHit", Marker[i], destroy ) end end ) function destroy(hitPlayer, matchingDimension) if getElementType( hitPlayer ) == "player" then destroyElement ( source ) end end
  10. Solidsnake14, A giant thank you!!!
  11. does not work 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 triggerServerEvent ( "createSound", root, selSong, theVehicle) end; elseif source == btn[2] then triggerServerEvent ( "destroySound", localPlayer, theVehicle ) elseif source == btn[4] then if sound [ theVehicle ] then setSoundVolume( sound [ theVehicle ], getSoundVolume( sound [ theVehicle ] ) + 0.25 ); if getSoundVolume( sound [ theVehicle ] ) > 1 then setSoundVolume( sound [ theVehicle ], 1 ); end; end; elseif source == btn[3] then if sound [ theVehicle ] then setSoundVolume( sound [ theVehicle ], getSoundVolume( sound [ theVehicle ] ) - 0.25 ); if getSoundVolume( sound [ theVehicle ] ) < 0 then setSoundVolume( sound [ theVehicle ], 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 ) if isElement ( sound [ theVehicle ] ) then stopSound ( sound [ theVehicle ] ); end local x, y, z = getElementPosition ( theVehicle ) sound [ theVehicle ] = playSound3D ( id, x, y, z ) attachElements ( sound [ theVehicle ], theVehicle ) end ) addEvent ( "destroySoundClient", true ) addEventHandler ( "destroySoundClient", root, function ( theVehicle ) if isElement ( sound [ theVehicle ] ) then stopSound ( sound [ theVehicle ] ); end sound [ theVehicle ] = nil end ) addEventHandler("onClientResourceStart", resourceRoot, function() triggerServerEvent("onPlayerToggleRadio", getLocalPlayer()) end ) addEvent("onServerToggleRadio", true) addEventHandler("onServerToggleRadio", root, function(url) for radio,_ in ipairs(url) do triggerEvent ( "createSoundClient", root,radio ) end 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) sounds [ theVehicle ] = id -- Store in the table the music ID using theVehicle as table index. end end ) addEvent ( "destroySound", true ) addEventHandler ( "destroySound", root, function ( theVehicle ) if ( theVehicle ) then triggerClientEvent(root, "destroySoundClient", root, theVehicle) sounds [ theVehicle ] = nil -- Remove the entry from the table. end end ) addEvent("onPlayerToggleRadio", true) addEventHandler("onPlayerToggleRadio", root, function() triggerClientEvent("onServerToggleRadio", root, sounds) end )
  12. I do not understand how to do
  13. can it be done with the help of setElementData and getElementData?
  14. Solidsnake14, you can explain the details
  15. have to forget about this Idea I can not do it thanks for the help
  16. Thank you very much but there is a problem When I go out I go to the server and back then the music fades
  17. and how to synchronize stopSound?
  18. 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 theVehicle then if source == btn[1] then local selSong = guiGridListGetItemData( songDisplay, guiGridListGetSelectedItem( songDisplay ) ); if selSong then if ( not isElement (sound[source])) then triggerServerEvent ( "createSound", root, selSong, theVehicle) else destroyElement(sound[source]) triggerServerEvent ( "createSound", root, selSong, theVehicle) end; end; elseif source == btn[2] then if sound[source] then destroyElement(sound[source]) sound[source] = 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 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[source] = playSound3D(id, x, y, z ) attachElements ( sound[source], theVehicle ) end ) When pressed again, the music is copied
  19. bindKey ( "--button--", "both", --function name-- ) ?
×
×
  • Create New...