Gabriela20 Posted February 5, 2020 Share Posted February 5, 2020 Enfim eu sou amadora estou tentando programar um script de respawn que eu tenho queria fazer quando o player morre não ir direto pro hospital no caso queria que abrise um painel basico com botoes pra escolher o respawn tipo ls lv sf mas sem precisar apertar K se algm me ajudar tou tentando editar mas só faço bug .,. ficaria grata :3 --Meu script de respawn local groups = { { name = "Everyone", spawnData = locaisHospital } } locaisHospital = { [1] = {1177.546, -1323.826, 14.076}, [2] = {1177.546, -1323.826, 14.076}, } local function Skin( ) if eventName == 'onPlayerSpawn' then local nData = getElementData( source, 'save-skin' ) if nData then setElementModel( source, nData ) end else setElementData( source, 'save-skin', getElementModel( source ) ) end end addEventHandler( 'onPlayerWasted', root, Skin ) addEventHandler( 'onPlayerSpawn', root, Skin ) function spawn( player ) if not player or not isElement(player) or getElementType(player) ~= "player" then return end local spawned = false local acc = getPlayerAccount( player ) for i=1, #groups do if isObjectInACLGroup ( "user."..getAccountName(acc), aclGetGroup (groups[i].name)) then spawned = spawnPlayer ( player, unpack(locaisHospital [math.random (#locaisHospital)])) end end if spawned ~= true then spawnPlayer (player, unpack(locaisHospital [math.random (#locaisHospital)])) end showChat( player, true ) fadeCamera( player, true ) setCameraTarget( player, player ) end addEventHandler( "onResourceStart", resourceRoot, function() resetMapInfo() for _,player in ipairs( getElementsByType 'player' ) do spawn( player ) end end ) addEventHandler( "onPlayerJoin", root, function( ) spawn(source) setTimer(spawn, 5000, 1, source) end) addEventHandler( "onPlayerWasted", root, function( ) setTimer( spawn, 3000, 1, source ) end) --painel que tou tentando adicionar no script acima --Client local screenW,screenH = guiGetScreenSize() local resW, resH = 1365,767 local x, y = (screenW/resW), (screenH/resH) function Pdx () dxDrawRectangle(x*438, y*247, x*428, y*217, tocolor(0, 0, 0, 138), false) dxDrawRectangle(x*461, y*278, x*361, y*148, tocolor(0, 0, 0, 224), false) dxDrawText("Tele Base", x*463, y*281, x*812, y*420, tocolor(255, 255, 255, 255), x*2.00, "pricedown", "center", "center", false, false, false, false, false) end function abrir (_,state) if painel == false then showCursor(true) addEventHandler("onClientRender", root, Pdx) painel = true else showCursor(false) removeEventHandler("onClientRender", root, Pdx) painel = false end end addEvent("painelrota", true) addEventHandler("painelrota", root , abrir) function togglePanel() if getElementData(localPlayer,nomeDaACL_Comandante) then if not isEventHandlerAdded("onClientRender",root,onClientRender) then guiGridListClear(playerList) for id, player in ipairs(getElementsByType("player")) do guiGridListSetItemText(playerList, guiGridListAddRow(playerList), 1, getPlayerName(player):gsub('#%x%x%x%x%x%x', ''), false, false) end guiSetVisible(playerList,true) guiSetVisible(edit,true) aVisible = true rVisible = true addEventHandler("onClientRender",root,onClientRender) showCursor(true) else guiSetVisible(playerList,false) guiSetVisible(edit,false) removeEventHandler("onClientRender",root,onClientRender) showCursor(false) end end end function isCursorOnElement(x,y,w,h) local mx,my = getCursorPosition () local fullx,fully = guiGetScreenSize() cursorx,cursory = mx*fullx,my*fully if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then return true else return false end end function ClickTele (_,state) if painel == true then if state == "down" then if isCursorOnElement(x*461, y*278, x*361, y*148) then triggerServerEvent ("tele", localPlayer) end end end end addEventHandler ("onClientClick", root, ClickTele) --server function showPanellr(thePlayer) accountname = getAccountName(getPlayerAccount(thePlayer)) if isObjectInACLGroup("user." .. accountname, aclGetGroup("Everyone")) then ---Grupo que vai poder abrir o painel ! triggerClientEvent(thePlayer, "painelrota", getRootElement()) end end function onResStartlr() for index, player in ipairs(getElementsByType("player")) do bindKey(player, "k", "down", showPanellr)------"K" Botao Para Abrir O Painel end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), onResStartlr) function onPlayerJoinlr() bindKey(source, "k", "down", showPanellr)------"K" Botao Para Abrir O Painel end addEventHandler("onPlayerJoin", getRootElement(), onPlayerJoinlr) function cleanAlllr(player) for index, player in ipairs(getElementsByType("player")) do unbindKey(player, "k", "down", showPanellr)------"K" Botao Para Abrir O Painel end end addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), cleanAlllr) function tele () setElementPosition (source,2705.72265625, -1860.185546875, 9.495885848999) end addEvent ("tele", true) addEventHandler ("tele", getRootElement(), tele) Link to comment
Other Languages Moderators Lord Henry Posted February 5, 2020 Other Languages Moderators Share Posted February 5, 2020 (edited) Olá Senhor @Duff1995. Primeiramente, você não deveria se passar por outra pessoa. Ainda mais usando foto de alguém que nem se chama Gabriela. (https://twitter.com/isabelacrux) Peço para que evite esse comportamento aqui no fórum. Seja honesto antes de pedir ajuda. Entendo que você talvez esteja fazendo isso para ter mais atenção e receber respostas mais rápidas, mas ir pelo caminho da fraude não é a solução. Irei trancar o tópico para evitar discussões desnecessárias. Se quiser conversar sobre o caso, pode ser por privado. Edited February 5, 2020 by Lord Henry Link to comment
Recommended Posts