Jump to content

papam77

Members
  • Posts

    517
  • Joined

  • Last visited

Everything posted by papam77

  1. It looks as here: http://www.img.tpx.cz/uploads/LikeApro.png = 1920x1080 http://www.img.tpx.cz/uploads/gta_sa%20 ... -05-19.png 1024x768
  2. addEventHandler("onClientResourceStart", resourceRoot, function() end ) function RelativeToAbsolute( X, Y ) rX, rY = guiGetScreenSize() local x = X*rX local y = Y*rY return x, y end addEventHandler("onClientRender",getRootElement(), function( ) local x,y = RelativeToAbsolute(0.00, -0.90) dxDrawImage(0, 0, 1920, 1080, "img/lobby-bg.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) end ) If i have this he still see it as already saw. Is any function how can set it to max resolution on every monitor ?
  3. And i have background pic 1920x1080 but i wanna it for everybody. My friend with smaller resolution see it too big
  4. papam77

    bindKey

    I don't asked you what i am doing
  5. Oh this ? GUIEditor = { button = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.button[1] = guiCreateButton(451, 205, 388, 289, "", false) guiSetAlpha(GUIEditor.button[1], 0.28) end ) Exactly and make the alpha 0 and make the buttons relative !! from the guieditor options . kk ty
  6. Oh this ? GUIEditor = { button = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.button[1] = guiCreateButton(451, 205, 388, 289, "", false) guiSetAlpha(GUIEditor.button[1], 0.28) end )
  7. Thank you work it And how can use dxDrawImage as button ?
  8. I don't understand how to use it
  9. What happened ? Text isn't on my monitor...
  10. Hello. Is possible to make as in html if yes how can make center in lua ?I wanna add to center this dxDrawText("Choose an arena", 2+160/2, 15, 160, 24, tocolor(255, 255, 255, 255), 3.00, "bankgothic", "left", "top", false, false, true, false, false)
  11. papam77

    bindKey

    Doesn't work when i press f1 nothing happend
  12. papam77

    bindKey

    Hello, i have lobby but i wanna when player press F1 he will see lobby again if is ingame Here is part of code local Lobby ------------------------------------------------- -- Bind Key ------------------------------------------------- function bindTheKeys ( player, commandName ) bindKey ( player, "F1", "down", showLobby ) end ------------------------------------------------- -- Components ------------------------------------------------- showCursor ( true ) showChat ( true ) showPlayerHudComponent ( source, "ammo", false ) showPlayerHudComponent ( source, "weapon", false ) ------------------------------------------------- -- Background and Images ------------------------------------------------- addEventHandler("onClientResourceStart", resourceRoot, function() end ) addEventHandler("onClientRender", root, function() dxDrawImage(0, 0, 1920, 1080, "img/lobby-bg.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawText("Choose an arena", 2+160/2, 15, 160, 24, tocolor(255, 255, 255, 255), 3.00, "bankgothic", "left", "top", false, false, true, false, false) end ) But it doesn't work
  13. http://www.img.tpx.cz/uploads/hasugbsofdfp.png
  14. Hello, i have one code but i wanna block loading from map music from map and etc... in my script. How can do it ? ------------------------------------------------- -- Components ------------------------------------------------- showCursor ( true ) showChat ( true ) showPlayerHudComponent ( source, "ammo", false ) showPlayerHudComponent ( source, "weapon", false ) ------------------------------------------------- -- Background and Images ------------------------------------------------- addEventHandler("onClientResourceStart", resourceRoot, function() end ) addEventHandler("onClientRender", root, function() dxDrawImage(0, 0, 1920, 1080, "img/lobby-bg.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawText("Choose an arena", 514, 0, 1720, 189, tocolor(255, 255, 255, 255), 3.00, "bankgothic", "left", "top", false, false, true, false, false) end ) Because i hear song from map and see map changing icon.
  15. And how can set max slots for arena ?
  16. And how can add gamemode to it ?
  17. Hello, how can make in my lobby move to arena ? I have button but i need for button function move to arena with dimension = 5 in gamemode called "[dm]"
  18. local g_Root = getRootElement() local g_ResRoot = getResourceRootElement(getThisResource()) local soundVolume = 0.0 function vratitHlasitost () for i, sound in ipairs(getElementsByType("sound")) do setSoundVolume(sound, 1) end end addEvent ( "playSound", true ) addEventHandler ( "playSound", root, function ( ) if ( isElement ( song ) ) then destroyElement ( song ) end song = playSound ( "endsong/song.mp3" ) setSoundVolume(sound, soundVolume) setTimer(vratitHlasitost, 5000, 1) end ) addCommandHandler("soundvolume", function(cmd, value) soundVolume = value/100 outputConsole("set sound volume to "..value.."%") end ) And doesn't work
  19. Meta: path: /s1.hrajminecraft.cz_22003/mods/deathmatch/resources/[eag]/main_eag/sound script: addEventHandler("onClientPlayerWasted", localPlayer, function() playSound("sound.mp3") end ) And doesn't work
  20. Hello, how can do when player dead will play any sound ?
  21. Ty, and next ask. Why i see only one text ? respawn_c.lua local screen_width, screen_height = guiGetScreenSize() local RESPAWN_KEY = "g" local showRespawn = false local text = "#5F02FABored ? \"{SMILIES_PATH}/icon_sad.gif\" alt=\"\" title=\"Sad\" /> #FFFFFFPress #FF7700*G*#ffffff and play #5F02FAagain !" local scale = 0.9 local font = "bankgothic" local textWidth = dxGetTextWidth(text:gsub("#%x%x%x%x%x%x", ""), scale, font) local fontHeight = dxGetFontHeight(scale, font) local color = tocolor(255, 128, 0, 255) setElementData(getLocalPlayer(), "respawn.playing", false, true) local running = false local vehicleData = {} local SAVE_INTER = 22500 local saveTimer = nil local reset = true -- reset timer local lastSaved = 0 -- When element data for the player changes, bind or unbind key. addEventHandler("onClientElementDataChange", getLocalPlayer(), function(dataName, oldValue) if(getElementType(source) ~= "player" or dataName ~= "state")then return end local newValue = getElementData(source, dataName) if(newValue == "dead")then reset =true setTimer(function() if(#vehicleData > 0 and running)then showRespawn = true setElementData(getLocalPlayer(), "respawn.playing", false, true) bindKey(RESPAWN_KEY, "up", respawn) end end, 3000, 1) else unbindKey(RESPAWN_KEY, "up", respawn) showRespawn = false setElementData(getLocalPlayer(), "respawn.playing", false, true) end if(newValue == "alive" and oldValue ~= "alive")then reset = false end end) -- respawn player, later add "checkpoints" function respawn() reset = false unbindKey(RESPAWN_KEY, "up", respawn) showRespawn = false setElementData(getLocalPlayer(), "respawn.playing", true, true) local index = #vehicleData local index2 = #vehicleData -- Save memory and go back to later saved positions if dying too fast. local timeWasted = math.floor((getTickCount() - lastSaved)/1000) if(timeWasted <= 7 and index > 1)then table.remove(vehicleData, index) index = #vehicleData outputDebugString("Vehicle data num: "..index.." removed respawn.") end outputDebugString("Respawning with vehicle data index: "..index) triggerServerEvent("onClientRequestRespawn", getLocalPlayer(), vehicleData[index]) if(index2 > 1 and index == index2)then table.remove(vehicleData, index) outputDebugString("Vehicle data num: "..index.." removed.") end end addEventHandler("onClientRender", getRootElement(), function() if(reset)then resetTimer(saveTimer) end -- Dont show text if player is not allowed to respawn. if not showRespawn then return end local x, y = screen_width/2 - textWidth/2, screen_height * 0.98 - fontHeight/2 dxDrawColoredText(text, x, y, screen_width, screen_height, color, scale, font) end) -- Save vehicle data, to later spawn with that data. function saveVehicleData() local vehicle = getPedOccupiedVehicle(getLocalPlayer()) if(not running or showRespawn or (not vehicle) or reset)then return end local mode = getElementModel(vehicle) if(mode == 425)then return end local lastSaved = getTickCount() local index = #vehicleData + 1 vehicleData[index] = {} local posX, posY, posZ = getElementPosition(vehicle) local rotX, rotY, rotZ = getElementRotation(vehicle) local velX, velY, velZ = getElementVelocity(vehicle) local turnVelX, turnVelY, turnVelZ = getVehicleTurnVelocity(vehicle) local health = getElementHealth(vehicle) local model = getElementModel(vehicle) -- Later add worldSpecialProperty too. vehicleData[index].posX = posX vehicleData[index].posY = posY vehicleData[index].posZ = posZ vehicleData[index].rotX = rotX vehicleData[index].rotY = rotY vehicleData[index].rotZ = rotZ vehicleData[index].velX = velX vehicleData[index].velY = velY vehicleData[index].velZ = velZ vehicleData[index].turnVelX = turnVelX vehicleData[index].turnVelY = turnVelY vehicleData[index].turnVelZ = turnVelZ vehicleData[index].health = health vehicleData[index].model = model vehicleData[index].dimension = getElementDimension(vehicle) vehicleData[index].nitro = nil local upgrades = getVehicleUpgrades(vehicle) for upgradeKey, upgradeValue in ipairs(upgrades) do if(tonumber(upgradeValue) >= 1008 and tonumber(upgradeValue) <= 1010)then vehicleData[index].nitro = tonumber(upgradeValue) end end outputDebugString("Vehicle data num: "..index.." saved.") end saveTimer = setTimer(saveVehicleData, SAVE_INTER, 0) function saveRespawnToSpawnpoint(player) local vehicle = getPedOccupiedVehicle(player) local index = #vehicleData + 1 vehicleData[index] = {} local spawn = getElementsByType("spawnpoint") local posX, posY, posZ = getElementData(spawn[1], "posX"), getElementData(spawn[1], "posY"), getElementData(spawn[1], "posZ") local rotX, rotY, rotZ = getElementData(spawn[1], "rotX"), getElementData(spawn[1], "rotY"), getElementData(spawn[1], "rotZ") local velX, velY, velZ = 0, 0, 0 local turnVelX, turnVelY, turnVelZ = 0, 0, 0 local health = getElementHealth(vehicle) local model = getElementData(spawn[1], "vehicle") -- Later add worldSpecialProperty too. vehicleData[index].posX = posX vehicleData[index].posY = posY vehicleData[index].posZ = posZ vehicleData[index].rotX = rotX vehicleData[index].rotY = rotY vehicleData[index].rotZ = rotZ vehicleData[index].velX = velX vehicleData[index].velY = velY vehicleData[index].velZ = velZ vehicleData[index].turnVelX = turnVelX vehicleData[index].turnVelY = turnVelY vehicleData[index].turnVelZ = turnVelZ vehicleData[index].health = health vehicleData[index].model = model vehicleData[index].dimension = getElementDimension(vehicle) end addEvent("onClientRaceStateChanging", true) addEventHandler("onClientRaceStateChanging", getRootElement(), function(newState, oldState) if(newState == "Running")then local state = tostring(getElementData(getLocalPlayer(), "state")) if(state == "waiting")then --[[ reset = false running = true vehicleData = {} saveRespawnToSpawnpoint(getLocalPlayer()) showRespawn = true setElementData(getLocalPlayer(), "respawn.playing", false, true) bindKey(RESPAWN_KEY, "up", respawn) --]] elseif(state == "alive" or state == "not ready")then reset = false running = true for i = 1, #vehicleData do table.remove(vehicleData, i) end vehicleData = {} saveVehicleData() end end if(newState == "PostFinish" or newState == "NoMap")then reset = true running = false unbindKey(RESPAWN_KEY, "up", respawn) showRespawn = false setElementData(getLocalPlayer(), "respawn.playing", false, true) end end) addEventHandler("onClientPlayerWasted", getLocalPlayer(), function() if(source ~= getLocalPlayer())then return end reset = true setElementData(getLocalPlayer(), "respawn.playing", false, true) setTimer(function() --local state = getElementData(getLocalPlayer(), "respawn.playing") or true if(#vehicleData > 0 and running)then showRespawn = true setElementData(getLocalPlayer(), "respawn.playing", false, true) bindKey(RESPAWN_KEY, "up", respawn) end end, 3000, 1) end) local unfreeze = {} addEvent("clientUnfreezeOnReady", true) addEventHandler("clientUnfreezeOnReady", getRootElement(), function(vehicle, vehData) -- source is the vehicle to unfreeze unfreeze.vehicle = vehicle unfreeze.health = vehData.health unfreeze.dim = vehData.dimension unfreeze.x, unfreeze.y, unfreeze.z = vehData.posX, vehData.posY, vehData.posZ unfreeze.vx, unfreeze.vy, unfreeze.vz = vehData.velX, vehData.velY, vehData.velZ unfreeze.tx, unfreeze.ty, unfreeze.tz = vehData.turnVelX, vehData.turnVelY, vehData.turnVelZ setElementFrozen(vehicle, false) addEventHandler("onClientRender", getRootElement(), unfreezeOnReady) end) function unfreezeOnReady() setElementHealth(unfreeze.vehicle, unfreeze.health) setElementPosition(unfreeze.vehicle, unfreeze.x, unfreeze.y, unfreeze.z) if(not isElementFrozen(unfreeze.vehicle))then setElementDimension(unfreeze.vehicle, unfreeze.dim) setElementVelocity(unfreeze.vehicle, unfreeze.vx, unfreeze.vy, unfreeze.vz) setVehicleTurnVelocity(unfreeze.vehicle, unfreeze.tx, unfreeze.ty, unfreeze.tz) removeEventHandler("onClientRender", getRootElement(), unfreezeOnReady) end end function dxDrawColoredText(text, left, top, right, bottom, color, scale, font, alignX, alignY, clip, wordBreak, postGUI) -- Making them optional. right = right or screen_width bottom = bottom or screen_height while(left < 0) do left = screen_width - math.abs(left) end while(top < 0) do top = screen_height - math.abs(top) end while(right < 0) do right = screen_width - math.abs(right) end while(bottom < 0) do bottom = screen_height -
  22. Hello, i wanna change position for text "Bored ? Press *G* and play again" but i can't find coordinations in this script. local screen_width, screen_height = guiGetScreenSize() local RESPAWN_KEY = "g" local showRespawn = false local text = "#5F02FABored ? #FFFFFFPress #FF7700*G*#ffffff and play #5F02FAagain !" local scale = 0.9 local font = "bankgothic" local textWidth = dxGetTextWidth(text:gsub("#%x%x%x%x%x%x", ""), scale, font) local fontHeight = dxGetFontHeight(scale, font) local color = tocolor(255, 128, 0, 255) setElementData(getLocalPlayer(), "respawn.playing", false, true) local running = false local vehicleData = {} local SAVE_INTER = 22500 local saveTimer = nil local reset = true -- reset timer local lastSaved = 0 -- When element data for the player changes, bind or unbind key. addEventHandler("onClientElementDataChange", getLocalPlayer(), function(dataName, oldValue) if(getElementType(source) ~= "player" or dataName ~= "state")then return end local newValue = getElementData(source, dataName) if(newValue == "dead")then reset =true setTimer(function() if(#vehicleData > 0 and running)then showRespawn = true setElementData(getLocalPlayer(), "respawn.playing", false, true) bindKey(RESPAWN_KEY, "up", respawn) end end, 3000, 1) else unbindKey(RESPAWN_KEY, "up", respawn) showRespawn = false setElementData(getLocalPlayer(), "respawn.playing", false, true) end if(newValue == "alive" and oldValue ~= "alive")then reset = false end end) -- respawn player, later add "checkpoints" function respawn() reset = false unbindKey(RESPAWN_KEY, "up", respawn) showRespawn = false setElementData(getLocalPlayer(), "respawn.playing", true, true) local index = #vehicleData local index2 = #vehicleData -- Save memory and go back to later saved positions if dying too fast. local timeWasted = math.floor((getTickCount() - lastSaved)/1000) if(timeWasted <= 7 and index > 1)then table.remove(vehicleData, index) index = #vehicleData outputDebugString("Vehicle data num: "..index.." removed respawn.") end outputDebugString("Respawning with vehicle data index: "..index) triggerServerEvent("onClientRequestRespawn", getLocalPlayer(), vehicleData[index]) if(index2 > 1 and index == index2)then table.remove(vehicleData, index) outputDebugString("Vehicle data num: "..index.." removed.") end end addEventHandler("onClientRender", getRootElement(), function() if(reset)then resetTimer(saveTimer) end -- Dont show text if player is not allowed to respawn. if not showRespawn then return end local x, y = screen_width/2 - textWidth/2, screen_height * 0.75 - fontHeight/2 dxDrawColoredText(text, x, y, screen_width, screen_height, color, scale, font) end) -- Save vehicle data, to later spawn with that data. function saveVehicleData() local vehicle = getPedOccupiedVehicle(getLocalPlayer()) if(not running or showRespawn or (not vehicle) or reset)then return end local mode = getElementModel(vehicle) if(mode == 425)then return end local lastSaved = getTickCount() local index = #vehicleData + 1 vehicleData[index] = {} local posX, posY, posZ = getElementPosition(vehicle) local rotX, rotY, rotZ = getElementRotation(vehicle) local velX, velY, velZ = getElementVelocity(vehicle) local turnVelX, turnVelY, turnVelZ = getVehicleTurnVelocity(vehicle) local health = getElementHealth(vehicle) local model = getElementModel(vehicle) -- Later add worldSpecialProperty too. vehicleData[index].posX = posX vehicleData[index].posY = posY vehicleData[index].posZ = posZ vehicleData[index].rotX = rotX vehicleData[index].rotY = rotY vehicleData[index].rotZ = rotZ vehicleData[index].velX = velX vehicleData[index].velY = velY vehicleData[index].velZ = velZ vehicleData[index].turnVelX = turnVelX vehicleData[index].turnVelY = turnVelY vehicleData[index].turnVelZ = turnVelZ vehicleData[index].health = health vehicleData[index].model = model vehicleData[index].dimension = getElementDimension(vehicle) vehicleData[index].nitro = nil local upgrades = getVehicleUpgrades(vehicle) for upgradeKey, upgradeValue in ipairs(upgrades) do if(tonumber(upgradeValue) >= 1008 and tonumber(upgradeValue) <= 1010)then vehicleData[index].nitro = tonumber(upgradeValue) end end outputDebugString("Vehicle data num: "..index.." saved.") end saveTimer = setTimer(saveVehicleData, SAVE_INTER, 0) function saveRespawnToSpawnpoint(player) local vehicle = getPedOccupiedVehicle(player) local index = #vehicleData + 1 vehicleData[index] = {} local spawn = getElementsByType("spawnpoint") local posX, posY, posZ = getElementData(spawn[1], "posX"), getElementData(spawn[1], "posY"), getElementData(spawn[1], "posZ") local rotX, rotY, rotZ = getElementData(spawn[1], "rotX"), getElementData(spawn[1], "rotY"), getElementData(spawn[1], "rotZ") local velX, velY, velZ = 0, 0, 0 local turnVelX, turnVelY, turnVelZ = 0, 0, 0 local health = getElementHealth(vehicle) local model = getElementData(spawn[1], "vehicle") -- Later add worldSpecialProperty too. vehicleData[index].posX = posX vehicleData[index].posY = posY vehicleData[index].posZ = posZ vehicleData[index].rotX = rotX vehicleData[index].rotY = rotY vehicleData[index].rotZ = rotZ vehicleData[index].velX = velX vehicleData[index].velY = velY vehicleData[index].velZ = velZ vehicleData[index].turnVelX = turnVelX vehicleData[index].turnVelY = turnVelY vehicleData[index].turnVelZ = turnVelZ vehicleData[index].health = health vehicleData[index].model = model vehicleData[index].dimension = getElementDimension(vehicle) end addEvent("onClientRaceStateChanging", true) addEventHandler("onClientRaceStateChanging", getRootElement(), function(newState, oldState) if(newState == "Running")then local state = tostring(getElementData(getLocalPlayer(), "state")) if(state == "waiting")then --[[ reset = false running = true vehicleData = {} saveRespawnToSpawnpoint(getLocalPlayer()) showRespawn = true setElementData(getLocalPlayer(), "respawn.playing", false, true) bindKey(RESPAWN_KEY, "up", respawn) --]] elseif(state == "alive" or state == "not ready")then reset = false running = true for i = 1, #vehicleData do table.remove(vehicleData, i) end vehicleData = {} saveVehicleData() end end if(newState == "PostFinish" or newState == "NoMap")then reset = true running = false unbindKey(RESPAWN_KEY, "up", respawn) showRespawn = false setElementData(getLocalPlayer(), "respawn.playing", false, true) end end) addEventHandler("onClientPlayerWasted", getLocalPlayer(), function() if(source ~= getLocalPlayer())then return end reset = true setElementData(getLocalPlayer(), "respawn.playing", false, true) setTimer(function() --local state = getElementData(getLocalPlayer(), "respawn.playing") or true if(#vehicleData > 0 and running)then showRespawn = true setElementData(getLocalPlayer(), "respawn.playing", false, true) bindKey(RESPAWN_KEY, "up", respawn) end end, 3000, 1) end) local unfreeze = {} addEvent("clientUnfreezeOnReady", true) addEventHandler("clientUnfreezeOnReady", getRootElement(), function(vehicle, vehData) -- source is the vehicle to unfreeze unfreeze.vehicle = vehicle unfreeze.health = vehData.health unfreeze.dim = vehData.dimension unfreeze.x, unfreeze.y, unfreeze.z = vehData.posX, vehData.posY, vehData.posZ unfreeze.vx, unfreeze.vy, unfreeze.vz = vehData.velX, vehData.velY, vehData.velZ unfreeze.tx, unfreeze.ty, unfreeze.tz = vehData.turnVelX, vehData.turnVelY, vehData.turnVelZ setElementFrozen(vehicle, false) addEventHandler("onClientRender", getRootElement(), unfreezeOnReady) end) function unfreezeOnReady() setElementHealth(unfreeze.vehicle, unfreeze.health) setElementPosition(unfreeze.vehicle, unfreeze.x, unfreeze.y, unfreeze.z) if(not isElementFrozen(unfreeze.vehicle))then setElementDimension(unfreeze.vehicle, unfreeze.dim) setElementVelocity(unfreeze.vehicle, unfreeze.vx, unfreeze.vy, unfreeze.vz) setVehicleTurnVelocity(unfreeze.vehicle, unfreeze.tx, unfreeze.ty, unfreeze.tz) removeEventHandler("onClientRender", getRootElement(), unfreezeOnReady) end end function dxDrawColoredText(text, left, top, right, bottom, color, scale, font, alignX, alignY, clip, wordBreak, postGUI) -- Making them optional. right = right or screen_width bottom = bottom or screen_height while(left < 0) do left = screen_width - math.abs(left) end while(top < 0) do top = screen_height - math.abs(top) end while(right < 0) do right = screen_width - math.abs(right) end while(bottom < 0) do bottom = screen_height -
  23. Hello i wanna delete spectate player name. << PLAYERNAME >> How can delete it ? I can't find it. ----------------------------------------------------------------------- -- Spectate ----------------------------------------------------------------------- Spectate = {} Spectate.active = false Spectate.target = nil Spectate.blockUntilTimes = {} Spectate.savePos = false Spectate.manual = false Spectate.droppedCameraTimer = Timer:create() Spectate.tickTimer = Timer:create() Spectate.fadedout = true Spectate.blockManual = false Spectate.blockManualTimer = nil Spectate.Render = false Spectate.TargetPlayer = nil -- Request to switch on function Spectate.start(type) outputDebug( 'SPECTATE', 'Spectate.start '..type ) assert(type=='manual' or type=='auto', "Spectate.start : type == auto or manual") Spectate.blockManual = false if type == 'manual' then if Spectate.active then return -- Ignore if manual request and already on end Spectate.savePos = true -- Savepos and start if manual request and was off elseif type == 'auto' then Spectate.savePos = false -- Clear restore pos if an auto spectate is requested end if not Spectate.active then Spectate._start() -- Switch on here, if was off end end -- Request to switch off function Spectate.stop(type) outputDebug( 'SPECTATE', 'Spectate.stop '..type ) assert(type=='manual' or type=='auto', "Spectate.stop : type == auto or manual") if type == 'auto' then Spectate.savePos = false -- Clear restore pos if an auto spectate is requested end if Spectate.active then Spectate._stop() -- Switch off here, if was on end end function Spectate._start() outputDebug( 'SPECTATE', 'Spectate._start ' ) triggerServerEvent('onClientNotifySpectate', g_Me, true ) assert(not Spectate.active, "Spectate._start - not Spectate.active") local screenWidth, screenHeight = guiGetScreenSize() Spectate.updateGuiFadedOut() guiLabelSetHorizontalAlign(g_GUI.speclabel, 'center') hideGUIComponents('specprevhi', 'specnexthi') if Spectate.savePos then savePosition() end Spectate.setTarget( Spectate.findNewTarget(g_Me,1) ) bindKey('arrow_l', 'down', Spectate.previous) bindKey('arrow_r', 'down', Spectate.next) MovePlayerAway.start() Spectate.setTarget( Spectate.target ) Spectate.validateTarget(Spectate.target) Spectate.tickTimer:setTimer( Spectate.tick, 500, 0 ) end -- Stop spectating. Will restore position if Spectate.savePos is set function Spectate._stop() Spectate.cancelDropCamera() Spectate.tickTimer:killTimer() triggerServerEvent('onClientNotifySpectate', g_Me, false ) outputDebug( 'SPECTATE', 'Spectate._stop ' ) assert(Spectate.active, "Spectate._stop - Spectate.active") for i,name in ipairs({'specprev', 'specprevhi', 'specnext', 'specnexthi', 'speclabel'}) do if g_GUI[name] then destroyElement(g_GUI[name]) g_GUI[name] = nil end end unbindKey('arrow_l', 'down', Spectate.previous) unbindKey('arrow_r', 'down', Spectate.next) MovePlayerAway.stop() setCameraTarget(g_Me) Spectate.target = nil Spectate.active = false Spectate.Render = false if Spectate.savePos then Spectate.savePos = false restorePosition() end end function Spectate.previous(bGUIFeedback) Spectate.setTarget( Spectate.findNewTarget(Spectate.target,-1) ) if bGUIFeedback then setGUIComponentsVisible({ specprev = false, specprevhi = true }) setTimer(setGUIComponentsVisible, 100, 1, { specprevhi = false, specprev = true }) end end function Spectate.next(bGUIFeedback) Spectate.setTarget( Spectate.findNewTarget(Spectate.target,1) ) if bGUIFeedback then setGUIComponentsVisible({ specnext = false, specnexthi = true }) setTimer(setGUIComponentsVisible, 100, 1, { specnexthi = false, specnext = true }) end end
  24. Sorry, i can't use it i am beginner
×
×
  • Create New...