HeK Posted March 25, 2012 Share Posted March 25, 2012 I have some problems with the "Spawn" resource by 50p, sometimes when a player dies or changes team he doesn't go to the exact team he choosed or he was. He just goes white and no Team. Screenshot: Scripts client/server (theres a lot of luas there, i just put the main ones): Client: g_Me = getLocalPlayer( ); g_root = getRootElement( ); g_ResRoot = getResourceRootElement( ); screenSize = { guiGetScreenSize( ) }; --local stripHeight = .15 * (screenSize[ 2 ]*2); letterBox = { stripHeight = screenSize[ 2 ] * .15, stripAlpha = .93, -- 0-1 animLength = 01, -- seconds animStartTick = 0, animFinishTick = 0, keepAnimating = true, flyIn = function ( ) letterBox.animStartTick = 0; addEventHandler( "onClientRender", g_root, animateLetterBox_flyIn ); setTempPedRotating( true ); end, flyOut = function ( ) letterBox.animStartTick = 0; setTempPedRotating( false ); removeEventHandler( "onClientRender", g_root, animateLetterBox_flyIn ) addEventHandler( "onClientRender", g_root, animateLetterBox_flyOut ); end, } local pedRot = 0; allHUDElements = { "ammo", "area_name", "armour", "breath", "clock", "health", "money", "radar", "vehicle_name", "weapon", } iconWidths = { [0] = 21, [1] = 15, [2] = 97, [3] = 55, [4] = 83, [5] = 72, [6] = 55, [7] = 138, [8] = 104, [9] = 59, [10] =40 , [11] =31 , [12] =41 , [14] =10 , [15] =71 , [16] =13 , [17] =10 , [18] =4 , [19] =17, [22] =35 , [23] =50 , [24] =37 , [25] =75 , [26] =67 , [27] =66 , [28] =17 , [29] =35 , [30] =70 , [31] =71 , [32] =22 , [33] =75 , [34] =86 , [35] =74 , [36] =75 , [37] =19 , [38] =54 , [39] =8, [42] = 14, } icons = { [0] = ":killmessages/icons/fist.png", [1] = ":killmessages/icons/brassknuckle.png", [2] = ":killmessages/icons/golfclub.png", [3] = ":killmessages/icons/nitestick.png", [4] = ":killmessages/icons/knifecur.png", [5] = ":killmessages/icons/bat.png", [6] = ":killmessages/icons/shovel.png", [7] = ":killmessages/icons/poolcue.png", [8] = ":killmessages/icons/katana.png", [9] = ":killmessages/icons/chnsaw.png", [10] = ":killmessages/icons/gun_dildo1.png", [11] = ":killmessages/icons/gun_dildo2.png", [12] = ":killmessages/icons/gun_vibe1.png", [14] = ":killmessages/icons/flowera.png", [15] = ":killmessages/icons/gun_cane.png", [16] = ":killmessages/icons/grenade.png", [17] = ":killmessages/icons/teargas.png", [18] = ":killmessages/icons/molotov.png", [19] = ":killmessages/icons/explosion.png", [22] = ":killmessages/icons/colt45.png", [23] = ":killmessages/icons/Silenced.png", [24] = ":killmessages/icons/desert_eagle.png", [25] = ":killmessages/icons/chromegun.png", [26] = ":killmessages/icons/sawnoff.png", [27] = ":killmessages/icons/shotgspa.png", [28] = ":killmessages/icons/micro_uzi.png", [29] = ":killmessages/icons/mp5lng.png", [30] = ":killmessages/icons/ak47.png", [31] = ":killmessages/icons/m4.png", [32] = ":killmessages/icons/tec9.png", [33] = ":killmessages/icons/cuntgun.png", [34] = ":killmessages/icons/sniper.png", [35] = ":killmessages/icons/rocketla.png", [36] = ":killmessages/icons/heatseek.png", [37] = ":killmessages/icons/flame.png", [38] = ":killmessages/icons/minigun.png", [39] = ":killmessages/icons/satchel.png", [42] = ":killmessages/icons/fireextinguisher.png", }; classGroups = { }; classesInfo = { }; classesWeapons = { }; classesSkins = { }; addEventHandler( "onClientResourceStart", getResourceRootElement(), function ( ) fadeCamera( true ); setTimer( setCameraMatrix, 50, 1, 1967.71, 1342.9, 26.63, 2034.47, 1343.02, 20.01 ); --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 ); setElementFrozen( tempPed, true ); setPedAnimation( tempPed, "ped", "gang_gunstand ", -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 Link to comment
Jaysds1 Posted March 25, 2012 Share Posted March 25, 2012 Sorry, I really suggest telling 50p that... Link to comment
HeK Posted March 25, 2012 Author Share Posted March 25, 2012 Maybe i'll PM him, don't really wanna bother him, but maybe it's the only solution. Thanks anyway. Link to comment
Jaysds1 Posted March 25, 2012 Share Posted March 25, 2012 Maybe i'll PM him, don't really wanna bother him, but maybe it's the only solution. Thanks anyway. No problem Link to comment
drk Posted March 25, 2012 Share Posted March 25, 2012 Maybe you can get the player team when he dies then when he spawns again set the team again, no? Link to comment
Jaysds1 Posted March 25, 2012 Share Posted March 25, 2012 Maybe you can get the player team when he dies then when he spawns again set the team again, no? but, what if the player chose another team? The script won't really work. Link to comment
50p Posted March 26, 2012 Share Posted March 26, 2012 The script was originally created so you can choose your skin every time you die. This is why it removed you from the team. It is supposed to show the spawn selection screen after you die and then you click "spawn" and it should assign you to the selected team. If I get a chance, I will make it more dynamic/configurable resource. Like spawn protection mode, respawn after dying without showing spawn selection screen, team protection (for clans, admins, etc.). Link to comment
Gamekiller Posted March 28, 2012 Share Posted March 28, 2012 This is just because... the Menu had 3 Catagory's that where not city's it where Muncipal, Gangs, and ...... in Muncipal you found diffrent Class name's Police emergency .... That's why it cant create multiple teams.... Link to comment
HeK Posted March 28, 2012 Author Share Posted March 28, 2012 Ok, Thanks 50p and Gamekiller. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now