gghvcffcv Posted February 26, 2014 Share Posted February 26, 2014 Hello guys i got a problem with this spawn panel, the problem is when a player joins on the server Spawn menu is visible so Player cannot get his last position on Log off addEventHandler( "onClientResourceStart", getResourceRootElement(), function ( ) fadeCamera( true ); setTimer( setCameraMatrix, 50, 1, 276.4677, -2120.869140, 47.17161, 472.4726, -1758.045898, 5.5713 ); --letterBox.flyIn( ); preloadClassesInfo( ); createClassSelectionWnd( ); createGroupSelectionWnd( ); createClassDescriptionWnd( ); createClassWeaponWnd( ); --setTimer( createTempPed, 100, 1 ); showCursor( true); showSpawnMenu( false, true ); --showHUDComponents( allHUDElements ); end ); function createTempPed( model ) -- 7474 - object id -- 8661 local x, y, z = getWorldFromScreenPosition( screenSize[ 1 ] - gridList:Size(false) / 2 - 70, ( screenSize[ 2 ]/2) --[[/ 1.6 ) * .8]], 10 ); local cX, cY, cZ = getCameraMatrix( ); x, y, z = getWorldFromScreenPosition( screenSize[ 1 ] - gridList:Size(false) / 2 - 70, ( screenSize[ 2 ]/2 )--[[ / 1.6 ) * .8]], 10 ) g_ground = createObject( 7474, x, y, z - 1.02, 0, 0, 90 ); tempPed = createPed( 0 and model or 0, x, y, z ); setPedRotation( tempPed, pedRot ); setPedFrozen( tempPed, true ); setPedAnimation( tempPed, "dancing", "dnce_m_b", -1, true, true, false ) --setPedAnimation( tempPed, "cop_ambient", "Coplook_nod", -1, true, true, false ) --setPedRotation( tempPed, 90 ); setElementAlpha( g_ground, 0 ); setTempPedRotating( true ); end function destroyTempPed( ) if tempPed then destroyElement( g_ground ); destroyElement( tempPed ); g_ground = nil; tempPed = nil; end end function setTempPedRotating( rotate ) if ( ( rotate ) and ( not pedRotating ) ) then addEventHandler( "onClientRender", g_root, rotatePed ); pedRotating = true; elseif ( not rotate ) then removeEventHandler( "onClientRender", g_root, rotatePed ); pedRotating = nil; end end function rotatePed( ) if tempPed then pedRot = pedRot + 1; setPedRotation( tempPed, pedRot ); end end function preloadClassesInfo( ) local groups = getElementsByType( "category" ); for _, group in ipairs( groups ) do table.insert( classGroups, Group:New( group ) ); end end function hideHUDComponents( components ) for i, comp in pairs( components ) do showPlayerHudComponent( comp, false ); end --showChat( false ); end function showHUDComponents( components ) for i, comp in pairs( components ) do showPlayerHudComponent( comp, true ); end --showChat( true ); end --addEventHandler( "onClientRender", getRootElement(), function animateLetterBox_flyIn ( ) if letterBox.animStartTick == 0 then letterBox.animStartTick = getTickCount(); letterBox.animFinishTick = letterBox.animStartTick + letterBox.animLength * 1000; letterBox.keepAnimating = true; end local stripH; local currentStripHeight = letterBox.stripHeight; if letterBox.keepAnimating then local currentTick = getTickCount(); local percentage = ( ( letterBox.animLength * 1000 ) - ( letterBox.animFinishTick - currentTick ) ) / ( letterBox.animLength * 1000 ); currentStripHeight = letterBox.stripHeight * percentage; if currentStripHeight > letterBox.stripHeight then currentStripHeight = letterBox.stripHeight; letterBox.keepAnimating = false; end end dxDrawRectangle( -1, -1, screenSize[ 1 ] + 1, currentStripHeight, tocolor( 0,0,0,255 * letterBox.stripAlpha ), false ); dxDrawLine( -1, screenSize[ 2 ], screenSize[ 1 ] + 1, screenSize[ 2 ], tocolor( 0, 0, 0, 255 * letterBox.stripAlpha ), currentStripHeight*2, false ); end --) function animateLetterBox_flyOut ( ) if letterBox.animStartTick == 0 then letterBox.animStartTick = getTickCount(); letterBox.animFinishTick = letterBox.animStartTick + letterBox.animLength * 1000; letterBox.keepAnimating = true; end local stripH; local currentStripHeight = 0; if letterBox.keepAnimating then local currentTick = getTickCount(); local percentage = ( ( letterBox.animLength * 1000 ) - ( letterBox.animFinishTick - currentTick ) ) / ( letterBox.animLength * 1000 ); currentStripHeight = letterBox.stripHeight - ( letterBox.stripHeight * percentage ); --outputDebugString( tostring( currentStripHeight ) ); if currentStripHeight < 0 then currentStripHeight = 0; letterBox.keepAnimating = false; removeEventHandler( "onClientRender", g_root, animateLetterBox_flyOut ); end end dxDrawRectangle( -1, -1, screenSize[ 1 ] + 1, currentStripHeight, tocolor( 0,0,0,255 * letterBox.stripAlpha ), false ); dxDrawLine( -1, screenSize[ 2 ], screenSize[ 1 ] + 1, screenSize[ 2 ], tocolor( 0, 0, 0, 255 * letterBox.stripAlpha ), currentStripHeight*2, false ); end addEvent( "spawn_SpawnedSuccessfully", true ) addEventHandler( "spawn_SpawnedSuccessfully", g_root, function ( ) letterBox.flyOut( ); hideSpawnMenu( ); showHUDComponents( allHUDElements ); showCursor( false ); previousClass = -1; destroyTempPed( ); end ) addEvent( "spawn_FailedToSpawn", true ); addEventHandler( "spawn_FailedToSpawn", g_root, function( restricted, gang ) if not restricted then fadeCamera(true) outputChatBox( "You failed to spawn. Try different skin.", 200, 40, 0 ); else fadeCamera(true) outputChatBox("No Perteneces A ".. gang .." !",255,0,0) end end ) --[[================================================================================]]-- --[[================================================================================]]-- --[[================================================================================]]-- function callServerFunc( funcName, ... ) triggerServerEvent( "_serverCallFunction", root, funcName, ... ) end addEvent( "_clientCallFunction", true ) addEventHandler( "_clientCallFunction", root, function( funcName, ... ) _G[ funcName ](...) end ) Link to comment
Hell-Mate Posted February 27, 2014 Share Posted February 27, 2014 Its visible when the resource starts because you wrote this line onClientResourceStart, you should remove this line and replace it with any other Event like onClientMarkerHit or whatever and dont forget to create the marker .. Link to comment
Recommended Posts