Jump to content

[HELP] random Play sound


Recommended Posts

local introOgg
local endRoundOgg
local endmusic = {
  "audio/endr1.ogg",
  "audio/endr2.ogg",
  "audio/endr2.ogg"
}


local counter = 0
local starttick
local currenttick
local bestKiller = { };
local bestHeadshots = { };
local sX, sY = guiGetScreenSize( );
gui = { };
camdata = { };
clientdata = { };

function centerWindow( center_window )
    local screenW,screenH = guiGetScreenSize( )
    local windowW,windowH = guiGetSize( center_window, false )
    local x,y = ( screenW-windowW )/2,( screenH-windowH )/2
    guiSetPosition( center_window, x, y, false )
end

addEventHandler( 'onClientPlayerWasted', localPlayer,
    function( killer, weapon, bodypart )
	    local playerTeam = getPlayerTeam( localPlayer )
		if ( playerTeam ) and ( getElementData( localPlayer, 'State' ) == 'Alive' ) then
	        setGameSpeed( 0.2 )
		    setTimer( function( )
				if RoundStats.window[1] and guiGetVisible( RoundStats.window[1] ) == false then
					setGameSpeed( 1 );
				end
			end, 3000, 1 )
		end
	end
)

addEventHandler( 'onClientPlayerSpawn', localPlayer,
    function( )
	    --fadeCamera( false, 0.5 )
		setGameSpeed( 1 )
		if ( green_radar ) then
		    destroyElement( green_radar )
			green_radar = nil
		end
        local x,y,z = getElementPosition( localPlayer )
	    green_radar = createRadarArea( x-350, y-350, 700, 700, 0, 255, 0, 140 )
	end
)

addEvent( 'clientChangeTeam', true )
addEventHandler( 'clientChangeTeam', localPlayer,
    function( )
	    guiSetVisible( gui.tabpanel['window'], true )
		guiSetVisible( gui.images['intro'], true )
		showCursor( true )
		antiJoinTeamSpam( true )
	end
)

addEvent( 'clientJoinTeam2', true )
addEventHandler( 'clientJoinTeam2', localPlayer,
    function( )
	    guiSetVisible( gui.tabpanel['window'], false )
		showCursor( false )
		outputChatBox( '● To change the team press (F3).', 222, 222, 222, true )
		attachRotatingCamera( false, localPlayer )
		setCameraInterior( 0 )
	end
)

addEvent( 'clientJoinTeam', true )
addEventHandler( 'clientJoinTeam', localPlayer,
    function( )
	    guiSetVisible( gui.tabpanel['window'], false )
		showCursor( false )
		outputChatBox( '● To change the team press (F3).', 222, 222, 222, true )
		attachRotatingCamera( false, localPlayer )
		setCameraInterior( 0 )
	end
)

addEvent( 'clientSpectateStart', true )
addEventHandler( 'clientSpectateStart', root,
    function( )
	    
	end
)

addEvent( 'clientRoundStart', true )
addEventHandler( 'clientRoundStart', localPlayer,
    function( )
	    setGameSpeed( 1 )
		guiSetVisible( gui.images['intro'], false )
    	bestKiller = { }
		--bestHeadshots = { }
	end
)

addEvent( 'clientRoundEnd', true )
addEventHandler( 'clientRoundEnd', localPlayer,
    --function( camPosX, camPosY, camPosZ, camLookX, camLookY, camLookZ, winTeamName )
	function( table )
		local camPosX, camPosY, camPosZ, camLookX, camLookY, camLookZ, winTeamName
		camPosX = table[ 1 ]
		camPosY = table[ 2 ]
		camPosZ = table[ 3 ]
		camLookX = table[ 4 ]
		camLookY = table[ 5 ]
		camLookZ = table[ 6 ]
		winTeamName = table[ 7 ]
	    w = winTeamName
	    setGameSpeed( 0.02 )
		guiSetVisible( gui.images['intro'], true )
		showPlayerHudComponent( 'radar', false )
		guiSetVisible( weaponsGui.window[1], false )
		guiSetVisible( weaponsGui.window[2], false )
		guiSetVisible( gui.images[ winTeamName ], true )
		fadeCamera( true )
		setElementData( localPlayer, 'State', 'Dead' )
		setTimer(
		    function( )
			    attachRotatingCamera( false, localPlayer )
			    guiSetVisible( gui.images[ winTeamName ], false )
				fadeCamera( false, 0.01 )
				setCameraMatrix( camPosX, camPosY, camPosZ, camLookX, camLookY, camLookZ )
				setGameSpeed( 1 )
				setTimer( fadeCamera, 500, 1, true, 1.0 )
			end,
		5500,1 )
		setTimer(
		    function( )
				triggerServerEvent( 'takeClientWeapons', resourceRoot )
				setGameSpeed( 1 )
			end,
		6000,1 )
		showCursor( true )
		updateBestKiller( )
		gdyRundaSieSkonczy( )
		endRoundOgg = playSound(endmusic[ math.random (#endmusic)])
)

addEvent( 'clientMapStart', true )
addEventHandler( 'clientMapStart', localPlayer,
    --function( camPosX, camPosY, camPosZ, camLookX, camLookY, camLookZ, mapName, mapInterior, team1Name, team2Name, statsSystem, drawLasers, stealthIntro )
	function( table )
		local camPosX, camPosY, camPosZ, camLookX, camLookY, camLookZ, mapName, mapInterior, team1Name, team2Name, statsSystem, drawLasers, stealthIntro
		camPosX = table[ 1 ] or nil
		camPosY = table[ 2 ] or nil
		camPosZ = table[ 3 ] or nil
		camLookX = table[ 4 ] or nil
		camLookY = table[ 5 ] or nil
		camLookZ = table[ 6 ] or nil
		mapName = table[ 7 ] or nil
		mapInterior = table[ 8 ] or nil
		team1Name = table[ 9 ] or nil
		team2Name = table[ 10 ] or nil
		statsSystem = table[ 11 ] or nil
		drawLasers = table[ 12 ] or nil
		stealthIntro = table[ 13 ] or nil
	    attachRotatingCamera( false, localPlayer )
	    if ( team1Name ) and ( team2Name ) then
	        clientdata[1] = team1Name
		    clientdata[2] = team2Name
			if ( statsSystem ) then
				clientdata[3] = statsSystem
				if ( clientdata[3] == 'true' ) then
				    createStatsGui( )
				end
			end
		    guiSetText( gui.button[1], ''..team1Name..'-' )
		    guiSetText( gui.button[2], ''..team2Name..'-' )
			if ( drawLasers ) then
			    clientdata[4] = drawLasers
			end
		end
	    nazwaMapy = mapName
		local timers = getTimers( )
		if ( timers ) then
		    for k, t in pairs( timers ) do
			    if ( t ~= reduceSoundTimer ) or ( t ~= infoBox.timer ) then
		            killTimer( t )
				end
		    end
		end
		if ( w ) then
		    guiSetVisible( gui.images[ w ], false )
		end
	    showPlayerHudComponent( 'clock', false )
	    showPlayerHudComponent( 'area_name', false )
		showPlayerHudComponent( 'radar', false )
		showPlayerHudComponent( 'money', false )
		guiSetVisible( gui.images['intro'], true )
	    setElementHealth( localPlayer, 0 )
		if mapInterior then setElementInterior( localPlayer, mapInterior ) end
		setElementData( localPlayer, 'State', 'Dead' )
	    fadeCamera( true, 1.0 )
	    setCameraMatrix( camPosX, camPosY, camPosZ, camLookX, camLookY, camLookZ )
		if weaponsGui.window[1] then guiSetVisible( weaponsGui.window[1], false ) end
		if weaponsGui.window[2] then guiSetVisible( weaponsGui.window[2], false ) end
		guiSetVisible( gui.tabpanel['window'], true )
		showCursor( true )
		antiJoinTeamSpam( true )
    	bestKiller = { }
		bestHeadshots = { }
	end
)

function antiJoinTeamSpam( bool )
	guiSetEnabled( gui.button[1], bool )
	guiSetEnabled( gui.button[2], bool )
	guiSetEnabled( gui.button[3], bool )
	guiSetEnabled( gui.button[4], bool )
end

function joinRED( )
    setElementHealth( localPlayer, 0 )
    local teamRedCount = countPlayersInTeam( getTeamFromName( clientdata[1] ) )
	local teamBlueCount = countPlayersInTeam( getTeamFromName( clientdata[2] ) )
	if ( teamRedCount == teamBlueCount ) then
	    triggerServerEvent( 'joinTeam', resourceRoot, 'RED' )
		playSoundFrontEnd( 0 )
		antiJoinTeamSpam( false )
	elseif ( teamRedCount > teamBlueCount ) then
	    outputChatBox( "● Can't join RED too many players.", 222, 222, 222, true )
    elseif ( teamRedCount < teamBlueCount ) then	
        triggerServerEvent( 'joinTeam', resourceRoot, 'RED' )
		playSoundFrontEnd( 0 )
		antiJoinTeamSpam( false )
	end
	stopSound( introOgg );
end

function joinBLU( )
    setElementHealth( localPlayer, 0 )
    local teamRedCount = countPlayersInTeam( getTeamFromName( clientdata[1] ) )
	local teamBlueCount = countPlayersInTeam( getTeamFromName( clientdata[2] ) )
	if ( teamBlueCount == teamRedCount ) then
	    triggerServerEvent( 'joinTeam', resourceRoot, 'BLU' )
		playSoundFrontEnd( 0 )
		antiJoinTeamSpam( false )
	elseif ( teamBlueCount > teamRedCount ) then
	    outputChatBox( "● Can't join BLUE too many players.", 222, 222, 222, true )
	elseif ( teamBlueCount < teamRedCount ) then
	    triggerServerEvent( 'joinTeam', resourceRoot, 'BLU' )
		playSoundFrontEnd( 0 )
		antiJoinTeamSpam( false )
	end
	stopSound( introOgg );
end

function joinAA( )
    local teamRedCount = countPlayersInTeam( getTeamFromName( clientdata[1] ) )
	local teamBlueCount = countPlayersInTeam( getTeamFromName( clientdata[2] ) )
	if ( teamRedCount == teamBlueCount ) then
	    triggerServerEvent( 'joinTeam', resourceRoot, 'RED' )
		playSoundFrontEnd( 0 )
		antiJoinTeamSpam( false )
	elseif ( teamRedCount > teamBlueCount ) then
	    triggerServerEvent( 'joinTeam', resourceRoot, 'BLU' )
		playSoundFrontEnd( 0 )
    elseif ( teamRedCount < teamBlueCount ) then	
        triggerServerEvent( 'joinTeam', resourceRoot, 'RED' )
		playSoundFrontEnd( 0 )
		antiJoinTeamSpam( false )
	end
	stopSound( introOgg );
end

function joinSP( )
    antiJoinTeamSpam( false )
    triggerServerEvent( 'joinSpectate', resourceRoot )
	playSoundFrontEnd( 0 )
	stopSound( introOgg );
end

addEventHandler( 'onClientRender', root,
    function( )
		if not starttick then
			starttick = getTickCount( )
		end
		counter = counter + 1
		currenttick = getTickCount( )
		if ( currenttick - starttick >= 1000 ) then
			setElementData( localPlayer, "FPS", counter )
			counter = 0
			starttick = false
		end
        if ( guiGetVisible( gui.images['intro'] ) == true ) then
		    if GUIEditor.window[1] and guiGetVisible( GUIEditor.window[1] ) == true then
			    dxDrawText( '● Login / Register to play.', sX*0.5+2, sY*0.8+2, sX*0.5+2, sY*0.8+2, tocolor ( 0, 0, 0, 150 ), 0.6, 'bankgothic', "center", "top", false, false, true, false, false )
			    dxDrawText( '● Login / Register to play.', sX*0.5, sY*0.8, sX*0.5, sY*0.8, tocolor ( 200, 200, 200, 222 ), 0.6, 'bankgothic', "center", "top", false, false, true, false, false )
		    elseif ( guiGetVisible( gui.tabpanel['window'] ) == true  ) then
			    dxDrawText( '● Choose your Team.', sX*0.5+2, sY*0.8+2, sX*0.5+2, sY*0.8+2, tocolor ( 0, 0, 0, 150 ), 0.6, 'bankgothic', "center", "top", false, false, true, false, false )
			    dxDrawText( '● Choose your Team.', sX*0.5, sY*0.8, sX*0.5, sY*0.8, tocolor ( 200, 200, 200, 222 ), 0.6, 'bankgothic', "center", "top", false, false, true, false, false )
				if clientdata[1] then
					guiSetText( gui.button[1], ''..clientdata[1]..'-('..countPlayersInTeam( getTeamFromName( clientdata[1] ) )..')' )
				end
				if clientdata[2] then
					guiSetText( gui.button[2], ''..clientdata[2]..'-('..countPlayersInTeam( getTeamFromName( clientdata[2] ) )..')' )
				end
			elseif weaponsGui.window[1] and weaponsGui.window[2] then
				if ( guiGetVisible( weaponsGui.window[1] ) == true  ) or ( guiGetVisible( weaponsGui.window[2] ) == true  ) then
					--dxDrawText( '● Choose your Weapons.', sX*0.5+2, sY*0.8+2, sX*0.5+2, sY*0.8+2, tocolor ( 0, 0, 0, 150 ), 0.6, 'bankgothic', "center", "top", false, false, true, false, false )
					--dxDrawText( '● Choose your Weapons.', sX*0.5, sY*0.8, sX*0.5, sY*0.8, tocolor ( 200, 200, 200, 222 ), 0.6, 'bankgothic', "center", "top", false, false, true, false, false )
				end
			else
			    dxDrawText( '● Wait for next Round to Spawn.', sX*0.5+2, sY*0.8+2, sX*0.5+2, sY*0.8+2, tocolor ( 0, 0, 0, 150 ), 0.6, 'bankgothic', "center", "top", false, false, false, false, false )
			    dxDrawText( '● Wait for next Round to Spawn.', sX*0.5, sY*0.8, sX*0.5, sY*0.8, tocolor ( 200, 200, 200, 222 ), 0.6, 'bankgothic', "center", "top", false, false, false, false, false )
			end
			if ( nazwaMapy ) then
			    dxDrawText( '● Map: '..nazwaMapy, sX*0.01, sY*0.95, sX*0.01, sY*0.95, tocolor ( 150, 150, 150, 222 ), 0.6, 'bankgothic', "left", "top", false, false, true, false, false )
			end
			guiSetVisible( gui.button[5], false )
			guiSetVisible( soundGui.progressbar[1], false )
			guiSetVisible( RoundStats.window[1], false )
		else
		    guiSetVisible( gui.button[5], true )
			guiSetVisible( soundGui.progressbar[1], true )
			guiSetVisible( RoundStats.window[1], false )
		end
		dxDrawText( 'FPS: '..getElementData( localPlayer, 'FPS' )..' PING: '..getPlayerPing( localPlayer ), sX*0.5, sY*0.05, sX*0.5, sY*0.05, tocolor ( 255, 255, 255, 180 ), 1, 'default', "center", "top", false, false, true, false, false )
	    if ( guiGetVisible( gui.images['red'] ) == true ) or ( guiGetVisible( gui.images['blu'] ) == true ) or ( guiGetVisible( gui.images['tie'] ) == true ) then
		    guiSetVisible( RoundStats.window[1], true )
		end
		if ( bestKiller.player ) and ( bestHeadshots.player ) then
		    dxDrawText( 'Best killer in this round: '..bestKiller.player..'('..bestKiller.kills..') \nHeadshots: '..bestHeadshots.player..'('..bestHeadshots.headshots..')', sX*0.5, sY*0.96, sX*0.5, sY*0.96, tocolor ( 255, 255, 255, 158 ), 1, 'default', "center", "top", false, false, true, false, false )
		else
		    if ( not bestKiller.player ) and ( bestHeadshots.player ) then
		        dxDrawText( 'Best killer in this round: - \nHeadshots: '..bestHeadshots.player..'('..bestHeadshots.headshots..')', sX*0.5, sY*0.96, sX*0.5, sY*0.96, tocolor ( 255, 255, 255, 158 ), 1, 'default', "center", "top", false, false, true, false, false )
			end
		    if ( bestKiller.player ) and ( not bestHeadshots.player ) then
		        dxDrawText( 'Best killer in this round: '..bestKiller.player..'('..bestKiller.kills..') \nHeadshots: -', sX*0.5, sY*0.96, sX*0.5, sY*0.96, tocolor ( 255, 255, 255, 158 ), 1, 'default', "center", "top", false, false, true, false, false )
			end
		    if ( not bestKiller.player ) and ( not bestHeadshots.player ) then
		        dxDrawText( 'Best killer in this round: - \nHeadshots: -', sX*0.5, sY*0.96, sX*0.5, sY*0.96, tocolor ( 255, 255, 255, 120 ), 1, 'default', "center", "top", false, false, true, false, false )
			end
		end
	end
)

addEvent( 'updateClientBestKiller', true )
function updateBestKiller( )
	bestKiller = { };
	bestHeadshots = { };
	
	local playersTable = getElementsByType( "player" )
	for i=1,#playersTable do
		local thePlayer = playersTable[i]
		local pRoundKills = getElementData( thePlayer, 'roundKills' )
		if ( pRoundKills ) and ( pRoundKills > 0 ) then
			if not bestKiller.player then
			    bestKiller.player = getPlayerName( thePlayer )
				bestKiller.kills = pRoundKills
			else
				if ( pRoundKills > bestKiller.kills ) then
					bestKiller.player = getPlayerName( thePlayer )
				   	bestKiller.kills = pRoundKills
				end
			end
		end
	end
	
	local playersTable = getElementsByType( "player" )
	for i=1,#playersTable do
		local thePlayer = playersTable[i]
		local pHeadShots = getElementData( thePlayer, 'Headshots' )
		if ( pHeadShots ) and ( pHeadShots > 0 ) then
			if not bestHeadshots.player then
				bestHeadshots.player = getPlayerName( thePlayer )
				bestHeadshots.headshots = pHeadShots
			else
				if ( pHeadShots > bestHeadshots.headshots ) then
				    bestHeadshots.player = getPlayerName( thePlayer )
				    bestHeadshots.headshots = pHeadShots
				end
			end
		end
	end
	
end
addEventHandler( 'updateClientBestKiller', localPlayer, updateBestKiller )

local rotSpeed = 1
local angle = 0
local elem
local zOff
local dist
local active = false
 
function getPointFromDistanceRotation( x, y, dist, angle )
    local a = math.rad( 90 - angle )
    local dx = math.cos( a ) * dist;
    local dy = math.sin( a ) * dist;
    return x+dx, y+dy;
end
 
function attachRotatingCamera( bool, element, Zoffset, distance )
   if bool then
      active = true
      elem,zOff,dist=element,Zoffset,distance
      addEventHandler( "onClientRender", root, createRotRamera )
   else
      removeEventHandler( "onClientRender", root, createRotRamera )
      --[[setCameraTarget( localPlayer, localPlayer )]]
      active = false
   end
end
 
function createRotRamera( )
   local x,y,z=getElementPosition( elem )
   local camx,camy=getPointFromDistanceRotation( x, y, dist, angle )
   setCameraMatrix( camx, camy, z + zOff, x, y, z )
   angle = ( angle + rotSpeed )%360
end

addEventHandler( 'onClientResourceStart', getResourceRootElement( getThisResource( ) ),
    function( )
	    gui.font = {}
		gui.images = {}
		gui.tab = {}
		gui.button = {}
		gui.tabpanel = {}
		gui.memo = {}
		gui.label = {}
	    gui.font[1] = guiCreateFont( "fonts/cs_regular.ttf", 15 )
	    gui.font[2] = guiCreateFont( "fonts/cs_regular.ttf", 9 )
		gui.font[3] = guiCreateFont( "fonts/cs_regular.ttf", 12 )
	    gui.images['intro'] = guiCreateStaticImage( 0.0, 0.0, 1279.0, 767.0, 'img/intro.png', true )
		if ( gui.images['intro'] ) then
	        guiSetEnabled( gui.images['intro'], false )
	        guiSetAlpha( gui.images['intro'], 0.99 )
		end
		gui.images['red'] = guiCreateStaticImage( 0.0, 0.0, 1279.0, 767.0, 'img/red.png', true )
		gui.images['blu'] = guiCreateStaticImage( 0.0, 0.0, 1279.0, 767.0, 'img/blu.png', true )
		gui.images['tie'] = guiCreateStaticImage( 0.0, 0.0, 1279.0, 767.0, 'img/tie.png', true )
		guiSetEnabled( gui.images['red'], false )
		guiSetEnabled( gui.images['blu'], false )
		guiSetEnabled( gui.images['tie'], false )
		guiSetAlpha( gui.images['red'], 0.7 )
		guiSetAlpha( gui.images['blu'], 0.7 )
		guiSetAlpha( gui.images['tie'], 0.7 )
		guiSetVisible( gui.images['red'], false )
		guiSetVisible( gui.images['blu'], false )
		guiSetVisible( gui.images['tie'], false )
	    gui.tabpanel['window'] = guiCreateTabPanel( 0.33, 0.30, 0.33, 0.40, true )
		if gui.tabpanel['window'] then
			guiSetFont( gui.tabpanel['window'], "default-bold-small" );
	    	guiSetAlpha( gui.tabpanel['window'], 0.85 );
	    	gui.tab[1] = guiCreateTab( "CHOOSE YOUR TEAM", gui.tabpanel['window'] )
	    	--[[gui.label[1] = guiCreateLabel( 0.02, 0.04, 0.96, 0.16, "Stealth:PRO", true, gui.tab[1] )
	    	guiSetFont( gui.label[1], "sa-header" )
	    	guiLabelSetHorizontalAlign( gui.label[1], "center", false )
			guiLabelSetColor( gui.label[1], 180, 180, 180 )]]
	    	gui.button[1] = guiCreateButton( 0.02, 0.10, 0.47, 0.39, "RED-", true, gui.tab[1] )
	    	guiSetFont( gui.button[1], gui.font[1] )
	    	guiSetProperty( gui.button[1], "NormalTextColour", "FFF30000" )
	    	gui.button[2] = guiCreateButton(0.51, 0.10, 0.47, 0.39, "BLUE-", true, gui.tab[1] )
        	guiSetFont( gui.button[2], gui.font[1] )
        	guiSetProperty( gui.button[2], "NormalTextColour", "FF001CF3" )
        	gui.button[3] = guiCreateButton( 0.02, 0.67, 0.96, 0.13, "Auto-Assign", true, gui.tab[1] )
        	guiSetFont( gui.button[3], gui.font[2] )
        	guiSetProperty( gui.button[3], "NormalTextColour", "FF7F7F7F" )
        	gui.button[4] = guiCreateButton( 0.02, 0.83, 0.96, 0.13, "Spectate", true, gui.tab[1] )
        	guiSetFont( gui.button[4], gui.font[2] )
        	guiSetProperty( gui.button[4], "NormalTextColour", "FF7F7F7F" )
	    	guiSetVisible( gui.tabpanel['window'], false )
        	gui.button[5] = guiCreateButton( 0.889378, 0.949666, 0.11, 0.05, "", true )
      		guiSetAlpha( gui.button[5], 0.40 )
      		guiSetProperty( gui.button[5], "NormalTextColour", "FFFFFFFF" )    
			guiSetEnabled( gui.button[5], true )
		end
		showCursor( true )
	    addEventHandler( 'onClientGUIClick', gui.button[1], joinRED, false )
  	    addEventHandler( 'onClientGUIClick', gui.button[2], joinBLU, false )
		addEventHandler( 'onClientGUIClick', gui.button[3], joinAA, false )
		addEventHandler( 'onClientGUIClick', gui.button[4], joinSP, false )
	    showPlayerHudComponent( 'area_name', false )
	    showPlayerHudComponent( 'clock', false )
	    showPlayerHudComponent( 'money', false )
	    showPlayerHudComponent( 'radio', false )
	    showPlayerHudComponent( 'radar', false )
		updateBestKiller( )
		RoundStats = {
            window = { },
			gridlist = { },
			column = { }
		}
        RoundStats.window[1] = guiCreateWindow( 430/1366*sX, 410/768*sY, 513/1366*sX, 203/768*sY, "Round-Stats", false )
        guiWindowSetSizable( RoundStats.window[1], false )
        guiSetAlpha( RoundStats.window[1], 0.50 )
        RoundStats.gridlist[1] = guiCreateGridList( 0.02, 0.12, 0.96, 0.95, true, RoundStats.window[1] )
		if RoundStats.gridlist[1] then
		    guiSetFont( RoundStats.gridlist[1], 'default-small' )
		end
        RoundStats.column[1] = guiGridListAddColumn( RoundStats.gridlist[1], "Player", 0.4 )
        RoundStats.column[2] = guiGridListAddColumn( RoundStats.gridlist[1], "Kills", 0.2 )
        RoundStats.column[3] = guiGridListAddColumn( RoundStats.gridlist[1], "Headshots", 0.2 )    
		if RoundStats.window[1] then
		    guiWindowSetMovable( RoundStats.window[1], false )
			guiWindowSetSizable( RoundStats.window[1], false )
		    guiSetVisible( RoundStats.window[1], false )
		end
        setCloudsEnabled( false )
        setHeatHaze( 0 )
		setFogDistance( 0 )
		triggerServerEvent( 'downloadEnd', resourceRoot )
		outputDebugString( " " )
		introOgg = playSound( "audio/intro.ogg" );
    end
)

function gdyRundaSieSkonczy( )
    guiGridListClear( RoundStats.gridlist[1] )
	local playersTable = getElementsByType( "player" )
	for i=1,#playersTable do
		local thePlayer = playersTable[i]
	    local pRoundKills = getElementData( thePlayer, 'roundKills' )
		local pHeadShots = getElementData( thePlayer, 'roundHead' )
		local row = guiGridListAddRow( RoundStats.gridlist[1] )
		guiGridListSetItemText( RoundStats.gridlist[1], row, RoundStats.column[1], tostring( getPlayerName( thePlayer ) ), false, false )
		guiGridListSetItemText( RoundStats.gridlist[1], row, RoundStats.column[2], tostring( pRoundKills ), false, false )
		guiGridListSetItemText( RoundStats.gridlist[1], row, RoundStats.column[3], tostring( pHeadShots ), false, false )
	end
end

addEvent( "Client:endCameraTarget", true );
addEventHandler( "Client:endCameraTarget", localPlayer,
function( table )
	local killer, source
	killer = table[ 1 ]
	source = table[ 2 ]
	if killer and getElementType( killer ) == "player" then
		--[[outputChatBox( "1" );]]
		attachRotatingCamera( true, killer, 0.7, 4.5 );
	end
	setTimer( function( )
		if RoundStats.window[1] and guiGetVisible( RoundStats.window[1] ) == true then
			attachRotatingCamera( false, localPlayer );
			if source and getElementType( source ) == "player" then
				--[[outputChatBox( "2" );]]
				attachRotatingCamera( true, source, 0.7, 4.5 );
			end
		end
	end, 4000, 1 )
end )

local last_top100 = getTickCount( ) - 60000
addCommandHandler( "top100",
function( cmd )
	if getTickCount() - last_top100 < 60000 then outputChatBox("● Please wait "..math.floor((61000-(getTickCount()-last_top100))/1000).."s.",222,100,100) return end
	triggerServerEvent( "Server:executeTop100Command", resourceRoot );
	last_top100 = getTickCount( )
end )

local last_stats = getTickCount( ) - 60000
addCommandHandler( "stats",
function( cmd )
	if getTickCount() - last_stats < 60000 then outputChatBox("● Please wait "..math.floor((61000-(getTickCount()-last_stats))/1000).."s.",222,100,100) return end
	triggerServerEvent( "Server:executeStatsCommand", resourceRoot );
	last_stats = getTickCount( )
end )

--[[ tocolor(0, 0, 0, math.abs(math.sin(getTickCount() / 300)) * 200) ]]

but gamemode is does not waroking :( 

 

c_stealthmain.lua  look line 143

 

Edited by #Heshan||eUNLOCK||
mention the line
Link to comment
  • Discord Moderators
7 hours ago, JeViCo said:

Uhh minor problem.

replace this


math.random (#endmusic)

with this


math.random (1, #endmusic)

@#Heshan||eUNLOCK||

Actually.

Quote

math.random() with no arguments generates a real number between 0 and 1.

math.random(upper) generates integer numbers between 1 and upper (both inclusive).

math.random(lower, upper) generates integer numbers between lower and upper (both inclusive).

 

Edited by Pirulax
  • Thanks 1
Link to comment
20 hours ago, Pirulax said:

Actually.

Quote

math.random() with no arguments generates a real number between 0 and 1.

math.random(upper) generates integer numbers between 1 and upper (both inclusive).

math.random(lower, upper) generates integer numbers between lower and upper (both inclusive).

Didn't know that) thank you

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...