#Heshan||eUNLOCK||

Members
  • Content count

    45
  • Joined

  • Last visited

Community Reputation

3 Neutral

About #Heshan||eUNLOCK||

  • Rank
    Rat

Recent Profile Visitors

510 profile views
  1. #Heshan||eUNLOCK||

    [HELP] random Play sound

    no problem dude if you have any problem i will help you thanx for your care about me
  2. #Heshan||eUNLOCK||

    [HELP] random Play sound

    missing is found ) missing in line 8 bro my prblem is fixed thank you for your honest help
  3. #Heshan||eUNLOCK||

    [HELP] random Play sound

    then what deos replaced this ?
  4. #Heshan||eUNLOCK||

    [HELP] random Play sound

    oh im checked gamemode its file was missing im fixe it and now working perfectly and it use random reound end musics thanks for you honest help :*
  5. #Heshan||eUNLOCK||

    [HELP] random Play sound

    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
  6. #Heshan||eUNLOCK||

    [HELP] random Play sound

    Is not another mistake?
  7. #Heshan||eUNLOCK||

    [HELP] random Play sound

    local endmusic = { "endr1.ogg", "endr2.ogg", "endr3.ogg", "endr4.ogg", "endr5.ogg" } endRoundOgg = playSound(endmusic[ math.random (#endmusic)] I want to add random endroudn musics for stealth pro gamemode. i want to know this code is true or false or need help for do it pls help me
  8. #Heshan||eUNLOCK||

    [HELP] MYSQL Error

    bro this is erro of mysql house system cant fix the prblem eror is cant connect local mysql server through socket 111 -- MySQL Housesystem created & released by Noneatme(MuLTi), Do not remove credits! -- -- All Rights go to Noneatme -- --[[ Total time token: - 3 hour - 1.5 hour ________ 4.5 hours ]] ------------------------ -- CONNECTION HANDLER -- ------------------------ -- Here you can change some settings -- -- FIRST CONNECTION -- local mysqlhost1 = "199.99.888.666" local mysqluser1 = "root" local mysqlpassword1 = "asdf" local mysqldatabase1 = "dbs_housesystem2" -- SECOND CONNECTION, OPTIONAL IF CONNECTION 1 DON'T WORK local mysqlhost2 = "localhost" local mysqluser2 = "root" local mysqlpassword2 = "asdf" local mysqldatabase2 = "dbs_housesystem2" local dbpTime = 500 -- How many Miliseconds will use the dbPoll function for waiting for a result local max_player_houses = 2 -- Define the buyable houses per player local sellhouse_value = 80 -- The ammount in percent that you get back if you sell a house local open_key = "F7" -- Define the key for the infomenue and the housepanel -- I don't know whats the right time for that -- ----------------------------------------------------------------- -- IF YOU CAN'T WRITE IN LUA, DO NOT EDIT ANYTHING ABOVE HERE! -- ----------------------------------------------------------------- -- EVENTS -- addEvent("onHouseSystemHouseCreate", true) addEvent("onHouseSystemHouseLock", true) addEvent("onHouseSystemHouseDeposit", true) addEvent("onHouseSystemHouseWithdraw", true) addEvent("onHouseSystemWeaponDeposit", true) addEvent("onHouseSystemWeaponWithdraw", true) addEvent("onHouseSystemRentableSwitch", true) addEvent("onHouseSystemRentalprice", true) addEvent("onHouseSystemTenandRemove", true) addEvent("onHouseSystemInfoBuy", true) addEvent("onHouseSystemInfoRent", true) addEvent("onHouseSystemInfoEnter", true) local handler -- local only, we don't need a global handler local saveableValues = { ["MONEY"] = "MONEY", ["WEAP1"] = "WEAP1", ["WEAP2"] = "WEAP2", ["WEAP3"] = "WEAP3", ["LOCKED"] = "LOCKED", ["OWNER"] = "OWNER", ["RENTABLE"] = "RENTABLE", ["RENTALPRICE"] = "RENTALPRICE", ["RENT1"] = "RENT1", ["RENT2"] = "RENT2", ["RENT3"] = "RENT3", ["RENT4"] = "RENT4", ["RENT5"] = "RENT5", } local created = false -- DONT EDIT local houseid = 0 -- Define the Houseid, local house = {} -- The House array local houseData = {} -- The House Data arry local houseInt = {} -- The House Interior array local houseIntData = {} -- The House Interior Data Array xD local buildStartTick local buildEndTick local rentTimer -- STARTUP EVENT HANDLER -- addEventHandler("onResourceStart", getResourceRootElement(), function() handler = dbConnect("mysql", "dbname="..mysqldatabase1..";host="..mysqlhost1, mysqluser1, mysqlpassword1,"autoreconnect=1") -- If the Handler 1 dont work if not(handler) then outputServerLog("[HOUSESYSTEM]MySQL handler 1 not accepted! Trying secondary handler...") handler = dbConnect("mysql", "dbname="..mysqldatabase2..";host="..mysqlhost2, mysqluser2, mysqlpassword2, "autoreconnect=1") if not(handler) then outputServerLog("[HOUSESYSTEM]MySQL handler 2 not accepted! Shutting down...") cancelEvent() else outputServerLog("[HOUSESYSTEM]MySQL handler 2 accepted!") housesys_startup() end else outputServerLog("[HOUSESYSTEM]MySQL handler 1 accepted!") housesys_startup() end end) -- SHUTDOWN EVENT HANDLER -- addEventHandler("onResourceStop", getResourceRootElement(), function() -- Free the arrays -- for index, houses in pairs(house) do houses = nil end for index, houseDatas in pairs(houseData) do houseDatas = nil end for index, houseInts in pairs(houseInt) do houseInts = nil end for index, houseIntDatas in pairs(houseIntData) do houseIntDatas = nil end houseid = 0 created = false end) -------------- -- COMMANDS -- -------------- -- /unrent -- addCommandHandler("unrent", function(thePlayer) if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false) then local id = tonumber(getElementData(thePlayer, "house:lastvisit")) if(isPlayerRentedHouse(thePlayer, id) == false) then outputChatBox("You are not tenad of this house!", thePlayer, 255, 0, 0) return end local sucess = removeHouseTenand(id, thePlayer) if(sucess == true) then outputChatBox("You have sucessfull terminate the tenancy!", thePlayer, 0, 255, 0) else outputChatBox("An error occurred!", thePlayer, 255, 0, 0) end end end) -- /rent -- addCommandHandler("rent", function(thePlayer) if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false) then local id = tonumber(getElementData(thePlayer, "house:lastvisit")) if(houseData[id]["OWNER"] == getPlayerName(thePlayer)) then outputChatBox("You can't rent here! It's your house!", thePlayer, 255, 0, 0) return end if(tonumber(houseData[id]["RENTABLE"]) ~= 1) then outputChatBox("This house is not rentable!", thePlayer, 255, 0, 0) return end if(getPlayerRentedHouse(thePlayer) ~= false) then outputChatBox("You are allready a tenand in a house! Use /unrent first.", thePlayer, 255, 0, 0) return end local sucess = addHouseTenand(thePlayer, id) if(sucess == true) then outputChatBox("You are now tenand this house!", thePlayer, 0, 255, 0) else outputChatBox("You can't rent this house!", thePlayer, 255, 0, 0) end end end) -- /createhouse -- addCommandHandler("createhouse", function(thePlayer) if(hasObjectPermissionTo ( thePlayer, "function.kickPlayer", false ) ) then if(getElementInterior(thePlayer) ~= 0) then outputChatBox("You are not outside!", thePlayer, 255, 0, 0) return end if(isPedInVehicle(thePlayer) == true) then outputChatBox("Please exit your vehicle.", thePlayer, 255, 0, 0) return end -- INSERT SECURITY OPTIONS LIKE ADMINLEVEL HERE( if(adminlevel > :~) then ...) triggerClientEvent(thePlayer, "onClientHouseSystemGUIStart", thePlayer) else outputChatBox("You are not an admin!", thePlayer, 255, 0, 0) end end) -- /in -- addCommandHandler("in", function(thePlayer) if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false) then local house = getElementData(thePlayer, "house:lastvisit") if(house) then local id = tonumber(house) if(tonumber(houseData[id]["LOCKED"]) == 0) or (houseData[id]["OWNER"] == getPlayerName(thePlayer)) or (isPlayerRentedHouse(thePlayer, id) == true) then local int, intx, inty, intz, dim = houseIntData[id]["INT"], houseIntData[id]["X"], houseIntData[id]["Y"], houseIntData[id]["Z"], id setElementData(thePlayer, "house:in", true) setInPosition(thePlayer, intx, inty, intz, int, false, dim) unbindKey(thePlayer, open_key, "down", togglePlayerInfomenue, id) setElementData(thePlayer, "house:lastvisitINT", id) if(houseData[id]["OWNER"] == getPlayerName(thePlayer)) or (isPlayerRentedHouse(thePlayer, id) == true) then bindKey(thePlayer, open_key, "down", togglePlayerHousemenue, id) end else outputChatBox("You don't have the housekey for this House!", thePlayer, 255, 0, 0) end end end end) -- /out -- addCommandHandler("out", function(thePlayer) if(getElementData(thePlayer, "house:lastvisitINT")) and (getElementData(thePlayer, "house:lastvisitINT") ~= false) then local house = getElementData(thePlayer, "house:lastvisitINT") if(house) then local id = tonumber(house) local x, y, z = houseData[id]["X"], houseData[id]["Y"], houseData[id]["Z"] setElementData(thePlayer, "house:in", false) setInPosition(thePlayer, x, y, z, 0, false, 0) end end end) -- /buyhouse -- addCommandHandler("buyhouse", function(thePlayer) if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false) then local house = getElementData(thePlayer, "house:lastvisit") if(house) then local id = house local owner = houseData[id]["OWNER"] if(owner ~= "no-one") then outputChatBox("You can't buy this house!", thePlayer, 255, 0, 0) else local houses = 0 for index, col in pairs(getElementsByType("colshape")) do if(getElementData(col, "house") == true) and (houseData[getElementData(col, "ID")]["OWNER"] == getPlayerName(thePlayer)) then houses = houses+1 if(houses == max_player_houses) then outputChatBox("You have allready "..max_player_houses.." houses! Sell a house to buy this one.", thePlayer, 255, 0, 0) return end end end local money = getPlayerMoney(thePlayer) local price = houseData[id]["PRICE"] if(money < price) then outputChatBox("You have not enought money! You need "..(price-money).."$ more!", thePlayer, 255, 0, 0) return end setHouseData(id, "OWNER", getPlayerName(thePlayer)) givePlayerMoney(thePlayer, -price) outputChatBox("Congratulations! You bought the house!", thePlayer, 0, 255, 0) setElementModel(houseData[id]["PICKUP"], 1272) setElementModel(houseData[id]["BLIP"], 32) end end end end) -- /sellhouse -- addCommandHandler("sellhouse", function(thePlayer) if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false) then local house = getElementData(thePlayer, "house:lastvisit") if(house) then local id = house local owner = houseData[id]["OWNER"] if(owner ~= getPlayerName(thePlayer)) then outputChatBox("You can't sell this house!", thePlayer, 255, 0, 0) else local price = houseData[id]["PRICE"] setHouseData(id, "OWNER", "no-one") setHouseData(id, "RENTABLE", 0) setHouseData(id, "RENTALPRICE", 0) for i = 1, 5, 1 do setHouseData(id, "RENT"..i, "no-one") end givePlayerMoney(thePlayer, math.floor(price/100*sellhouse_value)) outputChatBox("You sucessfull sold this house and got $"..math.floor(price/100*sellhouse_value).." back!", thePlayer, 0, 255, 0) setElementModel(houseData[id]["PICKUP"], 1273) setElementModel(houseData[id]["BLIP"], 31) end end end end) -- /deletehouse -- addCommandHandler("deletehouse", function(thePlayer, cmd, id) if(hasObjectPermissionTo ( thePlayer, "function.kickPlayer", false ) ) then id = tonumber(id) if not(id) then return end if not(house[id]) then outputChatBox("There is no house with the ID "..id.."!", thePlayer, 255, 0, 0) return end local query = dbQuery(handler, "DELETE FROM houses WHERE ID = '"..id.."';") local result = dbPoll(query, dbpTime) if(result) then destroyElement(houseData[id]["BLIP"]) destroyElement(houseData[id]["PICKUP"]) destroyElement(houseIntData[id]["PICKUP"]) houseData[id] = nil houseIntData[id] = nil destroyElement(house[id]) destroyElement(houseInt[id]) outputChatBox("House "..id.." destroyed sucessfully!", thePlayer, 0, 255, 0) house[id] = false else error("House ID "..id.." has been created Ingame, but House is not in the database! WTF") end else outputChatBox("You are not an admin!", thePlayer, 255, 0, 0) end end) -- /househelp -- addCommandHandler("househelp", function(thePlayer) outputChatBox("/buyhouse, /sellhouse, /rent", thePlayer, 0, 255, 255) outputChatBox("/unrent, /in, /out", thePlayer, 0, 255, 255) outputChatBox("For Admins: /createhouse, /deletehouse [id]", thePlayer, 0, 255, 255) end) -- INSERT INTO dbs_housesystem.houses (X, Y, Z, INTERIOR, INTX, INTY, INTZ, MONEY, WEAP1, WEAP2, WEAP3) values("0.1", "0.1", "0.1", "5", "0.2", "0.2", "0.2", "2000", "46,1", "22,200", "25, 200") -------------------- -- BIND FUNCTIONS -- -------------------- function togglePlayerInfomenue(thePlayer, key, state, id) if(id) then local locked = houseData[id]["LOCKED"] local rentable = houseData[id]["RENTABLE"] local rentalprice = houseData[id]["RENTALPRICE"] local owner = houseData[id]["OWNER"] local price = houseData[id]["PRICE"] local x, y, z = getElementPosition(house[id]) local house = getPlayerRentedHouse(thePlayer) if(house ~= false) then house = true end local isrentedin = isPlayerRentedHouse(thePlayer, id) triggerClientEvent(thePlayer, "onClientHouseSystemInfoMenueOpen", thePlayer, owner, x, y, z, price, locked, rentable, rentalprice, id, house, isrentedin) end end function togglePlayerHousemenue(thePlayer, key, state, id) if(id) then if(getElementInterior(thePlayer) ~= 0) then local locked = houseData[id]["LOCKED"] local money = houseData[id]["MONEY"] local weap1 = houseData[id]["WEAPONS"][1] local weap2 = houseData[id]["WEAPONS"][2] local weap3 = houseData[id]["WEAPONS"][3] local rentable = houseData[id]["RENTABLE"] local rent = houseData[id]["RENTALPRICE"] local tenands = getHouseTenands(id) local owner = false if(getPlayerName(thePlayer) == houseData[id]["OWNER"]) then owner = true end local canadd = canAddHouseTenand(id) triggerClientEvent(thePlayer, "onClientHouseSystemMenueOpen", thePlayer, owner, locked, money, weap1, weap2, weap3, id, rentable, rent, tenands, canadd) end else triggerClientEvent(thePlayer, "onClientHouseSystemMenueOpen", thePlayer ) end end ------------------------------- -- HOUSE CREATION ON STARTUP -- ------------------------------- -- BUILDHOUSE FUNCTION -- local function buildHouse(id, x, y, z, interior, intx, inty, intz, money, weapons, locked, price, owner, rentable, rentalprice, rent1, rent2, rent3, rent4, rent5) if(id) and (x) and(y) and (z) and (interior) and (intx) and (inty) and (intz) and (money) and (weapons) then houseid = id house[id] = createColSphere(x, y, z, 1.5) -- This is the house, hell yeah houseData[id] = {} local house = house[id] -- I'm too lazy... setElementData(house, "house", true) -- Just for client code only local houseIntPickup = createPickup(intx, inty, intz, 3, 1318, 100) setElementInterior(houseIntPickup, interior) setElementDimension(houseIntPickup, id) houseInt[id] = createColSphere(intx, inty, intz, 1.5) -- And this is the Exit setElementInterior(houseInt[id], interior) setElementDimension(houseInt[id], id) -- The House Dimension is the house ID setElementData(houseInt[id], "house", false) -------------------- -- EVENT HANDLERS -- -------------------- -- IN -- addEventHandler("onColShapeHit", house, function(hitElement) if(getElementType(hitElement) == "player") then setElementData(hitElement, "house:lastvisit", id) bindKey(hitElement, open_key, "down", togglePlayerInfomenue, id) outputChatBox("Press "..open_key.." to open the information-gui for this house.", hitElement, 0, 255, 255) end end) addEventHandler("onColShapeLeave", house, function(hitElement) if(getElementType(hitElement) == "player") then setElementData(hitElement, "house:lastvisit", false) unbindKey(hitElement, open_key, "down", togglePlayerInfomenue, id) --outputChatBox(id) end end) -- OUT -- addEventHandler("onColShapeHit", houseInt[id], function(hitElement, dim) if(dim == true) then if(getElementType(hitElement) == "player") then unbindKey(hitElement, open_key, "down", togglePlayerInfomenue, id) setElementData(hitElement, "house:lastvisitINT", id) if(houseData[id]["OWNER"] == getPlayerName(hitElement)) or (isPlayerRentedHouse(hitElement, id) == true) then bindKey(hitElement, open_key, "down", togglePlayerHousemenue, id) end --outputChatBox(id) end end end) addEventHandler("onColShapeLeave", houseInt[id], function(hitElement, dim) if(dim == true) then if(getElementType(hitElement) == "player") then setElementData(hitElement, "house:lastvisitINT", false) if(houseData[id]["OWNER"] == getPlayerName(hitElement)) or (isPlayerRentedHouse(hitElement, id) == true) then unbindKey(hitElement, open_key, "down", togglePlayerHousemenue, id) end --outputChatBox(id) end end end) -- Set data for HOUSE -- houseData[id]["HOUSE"] = house houseData[id]["DIM"] = id houseData[id]["MONEY"] = money houseData[id]["WEAPONS"] = weapons houseData[id]["INTHOUSE"] = houseInt[id] houseData[id]["LOCKED"] = locked houseData[id]["PRICE"] = price houseData[id]["OWNER"] = owner houseData[id]["X"] = x houseData[id]["Y"] = y houseData[id]["Z"] = z houseData[id]["RENTABLE"] = rentable houseData[id]["RENTALPRICE"] = rentalprice houseData[id]["RENT1"] = rent1 houseData[id]["RENT2"] = rent2 houseData[id]["RENT3"] = rent3 houseData[id]["RENT4"] = rent4 houseData[id]["RENT5"] = rent5 -- HOUSE PICKUP -- local housePickup if(owner ~= "no-one") then housePickup = createPickup(x, y, z-0.5, 3, 1272, 100) else housePickup = createPickup(x, y, z-0.5, 3, 1273, 100) end -- HOUSE BLIP -- local houseBlip if(owner ~= "no-one") then houseBlip = createBlip(x, y, z, 32, 2, 255, 0, 0, 255, 0, 50) else houseBlip = createBlip(x, y, z, 31, 2, 255, 0, 0, 255, 0, 50) end -- SET THE DATA -- houseData[id]["PICKUP"] = housePickup houseData[id]["BLIP"] = houseBlip setElementData(house, "PRICE", price) setElementData(house, "OWNER", owner) setElementData(house, "LOCKED", locked) setElementData(house, "ID", id) setElementData(house, "RENTABLE", rentable) setElementData(house, "RENTALPRICE", rentalprice) -- SET DATA FOR HOUSEINTERIOR -- houseIntData[id] = {} houseIntData[id]["OUTHOUSE"] = houseData[id]["HOUSE"] houseIntData[id]["INT"] = interior houseIntData[id]["X"] = intx houseIntData[id]["Y"] = inty houseIntData[id]["Z"] = intz houseIntData[id]["PICKUP"] = houseIntPickup outputServerLog("House with ID "..id.." created sucessfully!") buildEndTick = getTickCount() -- TRIGGER TO ALL CLIENTS THAT THE HOUSE HAS BEEN CREATEEEEEEEEEEEEEEEEEEEEEEED -- setTimer(triggerClientEvent, 1000, 1, "onClientHouseSystemColshapeAdd", getRootElement(), house) else if not(id) then error("Arguments @buildHouse not valid! There is no Houseid!") else error("Arguments @buildHouse not valid! Houseid = "..id) end end end -- TAKE PLAYER RENT -- local function takePlayerRent() for index, player in pairs(getElementsByType("player")) do if(getPlayerRentedHouse(player) ~= false) then local id = getPlayerRentedHouse(player) local owner = houseData[id]["OWNER"] local rentable = tonumber(houseData[id]["RENTABLE"]) if(rentable == 1) then local rentprice = tonumber(houseData[id]["RENTALPRICE"]) takePlayerMoney(player, rentprice) -- Takes the player money for the rent outputChatBox("You paid $"..rentprice.." rentalprice!", player, 255, 255, 0) if(getPlayerFromName(owner)) then givePlayerMoney(getPlayerFromName(owner), rentprice) -- Gives the owner the rentalprice outputChatBox("You got $"..rentprice.." from a tenand of your house!", getPlayerFromName(owner), 255, 255, 0) end end end end end -- HOUSE DATABASE EXECUTION -- function housesys_startup() if(created == true) then error("Houses Allready created!") return end buildStartTick = getTickCount() local query = dbQuery(handler, "SELECT * FROM houses;" ) local result, numrows = dbPoll(query, dbpTime) if (result and numrows > 0) then for index, row in pairs(result) do local id = row['ID'] local x, y, z = row['X'], row['Y'], row['Z'] local int, intx, inty, intz = row['INTERIOR'], row['INTX'], row['INTY'], row['INTZ'] local money, weap1, weap2, weap3 = row['MONEY'], row['WEAP1'], row['WEAP2'], row['WEAP3'] local locked = row['LOCKED'] local price = row['PRICE'] local owner = row['OWNER'] local rentable = row['RENTABLE'] local rentalprice = row['RENTALPRICE'] local rent1, rent2, rent3, rent4, rent5 = row['RENT1'],row['RENT2'], row['RENT3'], row['RENT4'], row['RENT5'] local weapontable = {} weapontable[1] = weap1 weapontable[2] = weap2 weapontable[3] = weap3 buildHouse(id, x, y, z, int, intx, inty, intz, money, weapontable, locked, price, owner, rentable, rentalprice, rent1, rent2, rent3, rent4, rent5) end dbFree(query) else error("Houses Table not Found/empty!") end created = true setTimer(function() local elapsed = (buildEndTick-buildStartTick) outputServerLog("It took "..(elapsed/1000).." seconds to build all houses.") end, 1000, 1) rentTimer = setTimer(takePlayerRent, 60*60*1000, -1) end -- House Data array set -- function setHouseData(ID, typ, value) -- Security array -- houseData[ID][typ] = value setElementData(house[ID], typ, value) if(saveableValues[typ]) then local query = dbQuery(handler, "UPDATE houses SET "..saveableValues[typ].." = '"..value.."' WHERE ID = '"..ID.."';" ) local result = dbPoll(query, dbpTime) if(result) then dbFree(query) else error("Can't save Data: "..typ.." with the value: "..value.." for house ID "..ID.."!") end end end -------------------- -- EVENT HANDLERS -- -------------------- -- INFO RENT - addEventHandler("onHouseSystemInfoRent", getRootElement(), function(id, value) if(houseData[id]) then if(value == true) then executeCommandHandler("rent", source) else executeCommandHandler("unrent", source) end end end) -- INFO ENTER -- addEventHandler("onHouseSystemInfoEnter", getRootElement(), function(id) if(houseData[id]) then executeCommandHandler("in", source) end end) -- INFO BUY -- addEventHandler("onHouseSystemInfoBuy", getRootElement(), function(id, value) if(houseData[id]) then if(value == true) then executeCommandHandler("buyhouse", source) else executeCommandHandler("sellhouse", source) end end end) -- TENAND REMOVE -- addEventHandler("onHouseSystemTenandRemove", getRootElement(), function(id, value) if(houseData[id]) then local sucess = removeHouseTenand(id, value) if(sucess == true) then outputChatBox("You sucessfull removed the tenand "..value.."!", source, 0, 255, 0) triggerClientEvent(source, "onClientHouseSystemMenueUpdate", source, "TENANDS", getHouseTenands(id)) end end end) -- SET RENTALPRICE -- addEventHandler("onHouseSystemRentalprice", getRootElement(), function(id, value) if(houseData[id]) then local oldvalue = tonumber(houseData[id]["RENTALPRICE"]) if(oldvalue < value) then local tenands = getHouseTenands(id) local users = {} for i = 1, 5, 1 do if(tenands[i] ~= "no-one") then users[i] = tenands[i] end end if(#users > 0) then outputChatBox("You can't change the rentalprice to a highter value because there are tenands in your house!", source, 255, 0, 0) return end end setHouseData(id, "RENTALPRICE", value) outputChatBox("You sucessfull set the rentalprice to $"..value.."!", source, 0, 255, 0) triggerClientEvent(source, "onClientHouseSystemMenueUpdate", source, "RENTALPRICE", value) end end) -- RENTABLE SWITCH -- addEventHandler("onHouseSystemRentableSwitch", getRootElement(), function(id) if(houseData[id]) then local state = tonumber(houseData[id]["RENTABLE"]) if(state == 0) then setHouseData(id, "RENTABLE", 1) triggerClientEvent(source, "onClientHouseSystemMenueUpdate", source, "RENTABLE", true) outputChatBox("The house is now rentable!", source, 0, 255, 0) else setHouseData(id, "RENTABLE", 0) triggerClientEvent(source, "onClientHouseSystemMenueUpdate", source, "RENTABLE", false) outputChatBox("The house is no longer rentable!", source, 0, 255, 0) end end end) -- CREATE HOUSE -- addEventHandler("onHouseSystemHouseCreate", getRootElement(), function(x, y, z, int, intx, inty, intz, price) local query = dbQuery(handler, "INSERT INTO houses (X, Y, Z, INTERIOR, INTX, INTY, INTZ, PRICE) values ('"..x.."', '"..y.."', '"..z.."', '"..int.."', '"..intx.."', '"..inty.."', '"..intz.."', '"..price.."');") local result, numrows = dbPoll(query, dbpTime) if(result) then local newid = houseid+1 outputChatBox("House "..newid.." created sucessfully!", source, 0, 255, 0) local weapontable = {} weapontable[1] = 0 weapontable[2] = 0 weapontable[3] = 0 buildHouse(newid, x, y, z, int, intx, inty, intz, 0, weapontable, 0, price, "no-one", 0, 0, "no-one", "no-one", "no-one", "no-one", "no-one") else outputChatBox("An Error occurred while creating the house!", source, 255, 0, 0) error("House "..(houseid+1).." could not create!") end end) -- WITHDRAW WEAPON -- addEventHandler("onHouseSystemWeaponWithdraw", getRootElement(), function(id, value) local weapons = houseData[id]["WEAPONS"] if(gettok(weapons[value], 1, ",")) then local weapon, ammo = gettok(weapons[value], 1, ","), gettok(weapons[value], 2, ",") giveWeapon(source, weapon, ammo, true) outputChatBox("You sucessfull withdraw your weapon slot "..value.."!", source, 0, 255, 0) weapons[value] = 0 setHouseData(id, "WEAPONS", weapons) setHouseData(id, "WEAP1", weapons[1]) setHouseData(id, "WEAP2", weapons[2]) setHouseData(id, "WEAP3", weapons[3]) triggerClientEvent(source, "onClientHouseSystemMenueUpdate", source, "WEAPON", value, 0) end end) -- DEPOSIT WEAPON -- addEventHandler("onHouseSystemWeaponDeposit", getRootElement(), function(id, value) local weapons = houseData[id]["WEAPONS"] if(tonumber(weapons[value]) == 0) then local weapon = getPedWeapon(source) local ammo = getPedTotalAmmo(source) if(weapon) and (ammo) and(weapon ~= 0) and (ammo ~= 0) then weapons[value] = weapon..", "..ammo takeWeapon(source, weapon) outputChatBox("You sucessfull deposit your weapon "..getWeaponNameFromID(weapon).." into your weaponbox!", source, 0, 255, 0) setHouseData(id, "WEAPONS", weapons) setHouseData(id, "WEAP1", weapons[1]) setHouseData(id, "WEAP2", weapons[2]) setHouseData(id, "WEAP3", weapons[3]) triggerClientEvent(source, "onClientHouseSystemMenueUpdate", source, "WEAPON", value, weapons[value]) else outputChatBox("You don't have a weapon!", source, 255, 0, 0) end else outputChatBox("There is allready a weapon in that slot!", source, 255, 0, 0) end end) -- LOCK HOUSE -- addEventHandler("onHouseSystemHouseLock", getRootElement(), function(id) local state = tonumber(houseData[id]["LOCKED"]) if(state == 1) then setHouseData(id, "LOCKED", 0) outputChatBox("The house has been unlocked.", source, 0, 255, 0) triggerClientEvent(source, "onClientHouseSystemMenueUpdate", source, "LOCKED", 0) else setHouseData(id, "LOCKED", 1) outputChatBox("The house has been locked!", source, 0, 255, 255) triggerClientEvent(source, "onClientHouseSystemMenueUpdate", source, "LOCKED", 1) end end) -- DEPOSIT MONEY -- addEventHandler("onHouseSystemHouseDeposit", getRootElement(), function(id, value) if(value > getPlayerMoney(source)-1) then return end setHouseData(id, "MONEY", tonumber(houseData[id]["MONEY"])+value) outputChatBox("You sucessfull insert "..value.."$ into your cashbox!", source, 0, 255, 0) triggerClientEvent(source, "onClientHouseSystemMenueUpdate", source, "MONEY", tonumber(houseData[id]["MONEY"])) givePlayerMoney(source, -value) end) -- WITHDRAW MONEY -- addEventHandler("onHouseSystemHouseWithdraw", getRootElement(), function(id, value) local money = tonumber(houseData[id]["MONEY"]) if(money < value) then outputChatBox("You don't have so much money in your cashbox!", source, 255, 0, 0) return end setHouseData(id, "MONEY", tonumber(houseData[id]["MONEY"])-value) outputChatBox("You sucessfull toke "..value.."$ out of your cashbox!", source, 0, 255, 0) triggerClientEvent(source, "onClientHouseSystemMenueUpdate", source, "MONEY", money-value) givePlayerMoney(source, value) end) ---------------------------- -- SETTINGS AND FUNCTIONS -- ---------------------------- -- FADE PLAYERS POSITION -- local fadeP = {} function setInPosition(thePlayer, x, y, z, interior, typ, dim) if not(thePlayer) then return end if (getElementType(thePlayer) == "vehicle") then return end if(isPedInVehicle(thePlayer)) then return end if not(x) or not(y) or not(z) then return end if not(interior) then interior = 0 end if(fadeP[thePlayer] == 1) then return end fadeP[thePlayer] = 1 fadeCamera(thePlayer, false) setElementFrozen(thePlayer, true) setTimer( function() fadeP[thePlayer] = 0 setElementPosition(thePlayer, x, y, z) setElementInterior(thePlayer, interior) if(dim) then setElementDimension(thePlayer, dim) end fadeCamera(thePlayer, true) if not(typ) then setElementFrozen(thePlayer, false) else if(typ == true) then setTimer(setElementFrozen, 1000, 1, thePlayer, false) end end end, 1000, 1) end -- canAddHouseTenand -- Checks if there is a free slot in the house function canAddHouseTenand(id) if not(houseData[id]) then return false end for i = 1, 5, 1 do local name = houseData[id]["RENT"..i] if(name == "no-one") then return true, i end end return false; end -- addHouseTenand -- Adds a player to a house as tenand function addHouseTenand(player, id) if not(houseData[id]) then return false end for i = 1, 5, 1 do local name = houseData[id]["RENT"..i] if(name == "no-one") then setHouseData(id,"RENT"..i, getPlayerName(player)) return true, i end end return false; end -- removeHouseTenand -- Removes a player from a house function removeHouseTenand(id, player) if not(houseData[id]) then return false end if(type(player) == "string") then for i = 1, 5, 1 do local name = houseData[id]["RENT"..i] if(name == player) then setHouseData(id,"RENT"..i,"no-one") return true end end else for i = 1, 5, 1 do local name = houseData[id]["RENT"..i] if(name == getPlayerName(player)) then setHouseData(id,"RENT"..i,"no-one") return true end end end return false; end -- getHouseTenands(houseid) -- Returns a table within all tenands in this house function getHouseTenands(id) if not(houseData[id]) then return false end local rent = {} for i = 1, 5, 1 do rent[i] = houseData[id]["RENT"..i] end return rent; end -- getPlayerRentedHouse -- Gets the House where a player is rented in -- function getPlayerRentedHouse(thePlayer) for index, house in pairs(getElementsByType("colshape")) do if(getElementData(house, "house") == true) and (getElementData(house, "ID")) then local id = tonumber(getElementData(house, "ID")) if not(id) then return false end local rent = {} for i = 1, 5, 1 do rent[i] = houseData[id]["RENT"..i] end for index, player in pairs(rent) do if(player == getPlayerName(thePlayer)) then return id; end end end end return false; end -- isPlayerRentedHouse -- Checks if a player is rented in a specific house function isPlayerRentedHouse(thePlayer, id) if not(houseData[id]) then return false end local rent = {} for i = 1, 5, 1 do rent[i] = houseData[id]["RENT"..i] end for index, player in pairs(rent) do if(player == getPlayerName(thePlayer)) then return true; end end return false; end
  9. #Heshan||eUNLOCK||

    [HELP] MYSQL Error

    any problem this code ? pls help me handler = dbConnect("mysql", "dbname="..mysqldatabase2..";host="..mysqlhost2, mysqluser2, mysqlpassword2,";unix_socket="/var/run/mysqld/mysqld.sock, "autoreconnect=1")
  10. All Credits Goes to First developer team in PTPM This is the Protect the Prime Minister server created earlier by the ptpm open source project. What is the PTPM Protect the Prime Minister(PTPM) is a team based gamemode that promotes teamwork and strategy over the conventional deathmatch tactics. It was first created in SA-MP in mid 2006 and ran as a successful server for several years, but later migrated and was reimplemented in the more powerful Multi Theft Auto engine. The aim for the Good Guys is to protect the (PM) for the duration of the round. The aim for the Bad Guysis to kill the PM before the end of the round. General PTPM gameplay can be thought of as an open world attack and defend. Often, the Good Guys will choose a location in the map to defend and the Bad Guys will assault it and attempt to kill the protected Prime Minister. If the PM leaves the hideout and heads out into the roads, the Bad Guys will hunt him down while the Good Guys attempt to keep them away. Rounds usually last for 15 minutes, depending on the map. You can see the time left on the timer in the top center of the screen. The round will end if one of the following happens: The round timer reaches 0:00 Prime Minister is Killed Once the round is over you will be able to vote on the next map, and after a short transition period the new map will begin. How to play The game has several character classes Prime Minister Bodyguards Police Terrorists Psychopaths All classes in the same team spawn in the same "base". Within each team the different classes have different weapons, and some classes have special "abilities" that will help their teammates. You can chat privately with your teammates by pressing Maps There are many maps in the PTPM mode, each with different locations and features, requiring tactics to be varied depending on which map is being played. Some are very close quarters and play out like a traditional TDM mode, while others are larger open worlds with more options for strategies. Within the map you are blocked from going too far away by the map boundaries, shown as red lines on the F11 map or on the radar Objectives Some maps also have a series of objectives for the PM to complete, marked on the map by red blips. In these maps, rather than simply staying alive the PM must complete all the objectives within the round time or he will lose. The current objective will be shown on the radar as a red blip and announced on the screen. Unlike tasks, no information about the time needed to complete the objective will be shown to the Terrorists so they must act fast to stop the PM. once an objective is completed, an additional3 minutes will be added to the round timer and the next objective will activate. Pickups Most maps will have weapon and armour pickups hidden around the world. These are often different to the weapons that you spawn with, and allow you to gain an advantage that you would not otherwise have. Some weapons are good for specific purposes and will help to counter well coordinated enemies. For example, Grenades are good against large groups of players, especially inside interior buildings. Sniper riflesare good against a PM that is well defended in a hideout, that cannot be assaulted easily in the normal way. ome maps contain Heavy Weapon pickups (minigun, rocket launcher) as well as regular weapons. These are usually heavily limited by long respawn timers and well hidden. They will offer a significant advantage to anyone that can find them. Safe Zones Some maps have Safe Zones represented by blue blips on the map and blue markers in the world. Dangerous vehicles cannot enter the safe zone (e.g. Hydras, Tanks), so they can be used to keep away from their powerful weapons. However, safe zones are hard to defend on the ground and will act as a focus point for Terrorist attacks. Teams Prime minister - The Prime Minister is the primary class in PTPM. He is the VIP that all the other Good Guys (Bodyguards and Police) must protect, and the Bad Guys (Terrorists) must kill. He has very little firepower and relies on the protection of his loyal team. To play the Prime Minister well you will need a strong knowledge of the map, knowing good hideout locations and how best to escape and avoid Terrorist attacks. You will need to be a good communicator, and you should instruct your team in where you will be going, what you will be doing and how they can best protect you. Body Guards - his is the primary protection force for the Prime Minister. Bodyguards should stick close to the Prime Minister wherever he goes, riding in the same car if possible, and be willing to put themselves in danger to protect the Prime Minister's life. They are not well suited for hunting down Terrorists, and will often have a less substantial weapon loadout. Police - This is the primary attack force for the Prime Minister. The Police are more heavily armed than the Bodyguards and should assault Terrorists as they come close, chasing them down and ensuring they do not make it through to the Prime Minister. If the Prime Minister has laid out instructions for the round, such as defending a particular hideout, the Police are the ones that should act on those instructions. Terrorist - The Terrorists have only a single goal: kill the Prime Minister before the time runs out. They should work closely with the other terrorists to co-ordinate their attacks to achieve maximum impact. If the Prime Minister is defending a location on the map, Terrorists should think carefully about how best to assault. Often, hideouts used by the PM will have back entrances or weak spots that can be exploited if the Good Guys are distracted. If they are defending well, Terrorists should group together and assault as a team to ensure they can break through the defensive lines. Phychopath - Psychopaths have no team and no loyalty. They will attack anyone. Beware Clases Each team within PTPM has multiple classes (characters) that you can choose from. Each class will usually have a unique weapon loadout and a unique skin, while some will additionally have unique abilities. Medics - Most maps have a single Medic class per team, with special abilities allowing them to heal other players, and regenerate their own health. Usually they will spawn with less weaponry than standard classes, so they will need extra protection from their team. Medics have a slightly paler colour so you can identify them on the radar and in the chat.To heal another player walk up to them and type /heal This will transfer some health from the medic onto the target player. Medics will automatically passively heal nearby teammates that are hurt at a rate of 1hp/second. While inside an Ambulance, the passive healing rate is increased to 2hp/second for anybody else inside or very close by. When a medic has lost some health, they will slowly regenerate at a rate of 2hp/second. By coordinating with another medic and healing each other, medics can regenerate all their health very quickly. Maps There are many maps in the PTPM mode, each with different locations and features, requiring tactics to be varied depending on which map is being played. Each map is designed to have a unique feature, distinct from all the others. Current Map List Los Santos Los Santos with Hydras San Fierro Las Venturas Las Venturas with Objectives Area 51 Countryside Desert Factory Mt. Chiliad Bayside Air Assault Join the server IP- 139.99.101.38:22005 Teasmepak 3 - 139.99.101.38 We Are eUNLOCK TEAM
  11. #Heshan||eUNLOCK||

    What happened to ptpm?

    139.99.101.38:22005 i opened a server ptpm
  12. #Heshan||eUNLOCK||

    [HELP] password based gate system

    i knwo but i want to setup close butten function
  13. #Heshan||eUNLOCK||

    [Help] about close butten

  14. #Heshan||eUNLOCK||

    [HELP] password based gate system

    i have not better knowledge about scripting somthing i know i will help you. if you know my problem's answer pls help to improve my knowledge about lua
  15. #Heshan||eUNLOCK||

    [HELP] password based gate system

    I maked a Password based gate script with dx and normal gui pic This resource is working properly but i have a problem iwant to setup close butten and gui visible set to marker pls help me this is client side GUIEditor = { button = {}, edit = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.button[1] = guiCreateButton(534, 370, 265, 54, "OPEN THE GATE", false) GUIEditor.button[2] = guiCreateButton(872, 429, 62, 37, "Close", false) GUIEditor.edit[1] = guiCreateEdit(463, 269, 250, 43, "", false) addEventHandler ( "onClientGUIClick", GUIEditor.button[1], checkPassword ) guiEditSetMasked ( GUIEditor.edit[1], true ) end ) password = "1234" function checkPassword () local text = guiGetText ( GUIEditor.edit[1] ) if text == password then triggerServerEvent ( "openGate", resourceRoot) else outputChatBox ( "Password Incorrect!" ) end end this is the server side local gate = createObject(980,-2423.94385, -609.48846, 132.56250, 0, 0, 0) function open() moveObject(gate, 980,-2414.95703, -603.12976, 132.56250, 0, 0, 0) end addEvent( "openGate", true ) addEventHandler( "openGate", resourceRoot, open ) <meta> <meta> <info type="script" name="psswd based gate" author="heshan" version="1.0.0"></info> <script src="my2.lua" type="client" ></script> <script src="my2s.lua" type="server" ></script> </meta> pls help