Jump to content

[ Resolvido ] Tempo VIP


Recommended Posts

No script que você passou não está sendo utilizado setElementData/getElementData, e sim, setAccountData/getAccountData

Tente:

local time = getRealTime() 
local timeSS = time.timestamp 
local vipRemain = getAccountData (getPlayerAccount(localPlayer), "donator") 
local remainingTime = (vipRemain - timeSS) 

Link to comment

Você deve utilizar triggerClientEvent / triggerServerEvent pois getAccountData é uma função do lado server e você deseja obter seu valor no lado client. Ex:

Client:

triggerServerEvent("callGetVip", localPlayer) 
  
addEvent("SendVip",true) 
addEventHandler( "SendVip", localPlayer, 
    function(tempo) 
        outputChatBox(tempo) 
    end 
) 
  

Server:

addEvent("callGetVip",true) 
addEventHandler( "callGetVip", root, 
    function() 
        local tempo = getAccountData (getPlayerAccount(client), "donator") 
        triggerClientEvent ("SendVip", client, tempo) 
    end 
) 

Link to comment
No lado client nao tem por o triggerserverevent dentro da function ? e no lado server tambem?

Sim, no lado client o trigger deve estar de preferência na parte que abre o painel, o evento "SendVip" fica fora de qualquer função, porém o que retornar dela você armazena em um variável global, para poder utiliza-la na exibição onde pretender. E o evento "callGetVip" deixa como está, não precisa adicionar no bloco de nenhuma função

E como coloco no começo do painel onde tinha aqueles local ?

Não entendi.

Link to comment

Não acostuma :v

painelplayer = false 
tempovip = 0
function viplayer ()
        local time = getRealTime()
        local timeSS = time.timestamp
        local remainingTime = (tempovip - timeSS)
        dxDrawLine(320 - 1, 270 - 1, 320 - 1, 526, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(489, 270 - 1, 320 - 1, 270 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(320 - 1, 526, 489, 526, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(489, 526, 489, 270 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawRectangle(320, 270, 169, 256, tocolor(0, 0, 0, 182), false)
        --dxDrawImage(342, 274, 174, 189, ":[bNG]Hud/img/perso.png", 0, 0, 0, tocolor(0, 0, 0, 254), false)
        --dxDrawImage(297, 378, 209, 182, ":[bNG]Hud/img/carrim.png", 0, 0, 0, tocolor(0, 0, 0, 254), false)
        dxDrawLine(491 - 1, 189 - 1, 491 - 1, 570, tocolor(0, 0, 0, 253), 1, false)
        dxDrawLine(960, 189 - 1, 491 - 1, 189 - 1, tocolor(0, 0, 0, 253), 1, false)
        dxDrawLine(491 - 1, 570, 960, 570, tocolor(0, 0, 0, 253), 1, false)
        dxDrawLine(960, 570, 960, 189 - 1, tocolor(0, 0, 0, 253), 1, false)
        dxDrawRectangle(491, 189, 469, 381, tocolor(0, 0, 0, 182), false)
        dxDrawLine(509 - 1, 294 - 1, 509 - 1, 350, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(630, 294 - 1, 509 - 1, 294 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(509 - 1, 350, 630, 350, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(630, 350, 630, 294 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawRectangle(509, 294, 121, 56, tocolor(0, 0, 0, 120), false)--jetpack
        dxDrawLine(509 - 1, 368 - 1, 509 - 1, 424, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(630, 368 - 1, 509 - 1, 368 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(509 - 1, 424, 630, 424, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(630, 424, 630, 368 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawRectangle(509, 368, 121, 56, tocolor(0, 0, 0, 120), false)--Invisivel
        dxDrawLine(506 - 1, 443 - 1, 506 - 1, 499, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(627, 443 - 1, 506 - 1, 443 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(506 - 1, 499, 627, 499, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(627, 499, 627, 443 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawRectangle(506, 443, 121, 56, tocolor(0, 0, 0, 120), false)--velo3x
        dxDrawRectangle(835, 202, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawRectangle(629, 295, 74, 55, tocolor(197, 0, 0, 247), false)--off 1
        dxDrawRectangle(629, 369, 74, 55, tocolor(197, 0, 0, 247), false)--off 2
        dxDrawRectangle(629, 443, 74, 55, tocolor(197, 0, 0, 247), false)--off 3
        dxDrawLine(823 - 1, 294 - 1, 823 - 1, 350, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(944, 294 - 1, 823 - 1, 294 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(823 - 1, 350, 944, 350, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(944, 350, 944, 294 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawRectangle(823, 294, 121, 56, tocolor(0, 0, 0, 120), false)--skin
        dxDrawLine(823 - 1, 368 - 1, 823 - 1, 424, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(944, 368 - 1, 823 - 1, 368 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(823 - 1, 424, 944, 424, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(944, 424, 944, 368 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawRectangle(823, 368, 121, 56, tocolor(0, 0, 0, 120), false)--kit
        dxDrawLine(823 - 1, 442 - 1, 823 - 1, 498, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(944, 442 - 1, 823 - 1, 442 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(823 - 1, 498, 944, 498, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(944, 498, 944, 442 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawRectangle(823, 442, 121, 56, tocolor(0, 0, 0, 120), false)--info
        dxDrawText("JetPack", 544, 313, 646, 345, tocolor(254, 254, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("Invisivel", 544, 386, 646, 418, tocolor(254, 254, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("Velocidade 3x", 527, 463, 629, 495, tocolor(254, 254, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("Informaçoes", 848, 460, 950, 492, tocolor(254, 254, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("KIT VIP", 863, 386, 965, 418, tocolor(254, 254, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("Skin VIP", 858, 313, 960, 345, tocolor(254, 254, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("OFF", 656, 313, 758, 345, tocolor(255, 255, 255, 247), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("OFF", 656, 386, 758, 418, tocolor(255, 255, 255, 247), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("OFF", 656, 463, 758, 495, tocolor(255, 255, 255, 247), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawLine(490 - 1, 544 - 1, 490 - 1, 570, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(960, 544 - 1, 490 - 1, 544 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(490 - 1, 570, 960, 570, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(960, 570, 960, 544 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawRectangle(490, 544, 470, 26, tocolor(0, 0, 0, 247), false)
        dxDrawText("Tempo VIP : "..secondsToTimeDesc(remainingTime), 573, 550, 680, 577, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("V.I.P", 665, 197, 888, 260, tocolor(0, 0, 0, 255), 4.10, "default", "left", "top", false, false, false, false, false)
                dxDrawLine(489, 268, 961, 268, tocolor(0, 0, 0, 255), 1, false)
                end
    painelcarro = false
    function vipcarro()
        dxDrawLine(320 - 1, 270 - 1, 320 - 1, 526, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(489, 270 - 1, 320 - 1, 270 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(320 - 1, 526, 489, 526, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(489, 526, 489, 270 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawRectangle(320, 270, 169, 256, tocolor(0, 0, 0, 182), false)
        --dxDrawImage(342, 274, 174, 189, ":[bNG]Hud/img/perso.png", 0, 0, 0, tocolor(0, 0, 0, 254), false)
        --dxDrawImage(297, 378, 209, 182, ":[bNG]Hud/img/carrim.png", 0, 0, 0, tocolor(0, 0, 0, 254), false)
        dxDrawLine(491 - 1, 189 - 1, 491 - 1, 570, tocolor(0, 0, 0, 253), 1, false)
        dxDrawLine(960, 189 - 1, 491 - 1, 189 - 1, tocolor(0, 0, 0, 253), 1, false)
        dxDrawLine(491 - 1, 570, 960, 570, tocolor(0, 0, 0, 253), 1, false)
        dxDrawLine(960, 570, 960, 189 - 1, tocolor(0, 0, 0, 253), 1, false)
        dxDrawRectangle(491, 189, 469, 381, tocolor(0, 0, 0, 182), false)
        dxDrawLine(489, 269, 960, 270, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(509 - 1, 294 - 1, 509 - 1, 350, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(630, 294 - 1, 509 - 1, 294 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(509 - 1, 350, 630, 350, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(630, 350, 630, 294 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawRectangle(509, 294, 121, 56, tocolor(0, 0, 0, 120), false)--Indestrutivel
        dxDrawLine(509 - 1, 368 - 1, 509 - 1, 424, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(630, 368 - 1, 509 - 1, 368 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(509 - 1, 424, 630, 424, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(630, 424, 630, 368 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawRectangle(509, 368, 121, 56, tocolor(0, 0, 0, 120), false)--Invisivel
        dxDrawLine(506 - 1, 443 - 1, 506 - 1, 499, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(627, 443 - 1, 506 - 1, 443 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(506 - 1, 499, 627, 499, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(627, 499, 627, 443 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawRectangle(506, 443, 121, 56, tocolor(0, 0, 0, 120), false)--Rainbow
        dxDrawRectangle(629, 295, 74, 55, tocolor(197, 0, 0, 247), false)--off1
        dxDrawRectangle(629, 369, 74, 55, tocolor(197, 0, 0, 247), false)--off2
        dxDrawRectangle(629, 443, 74, 55, tocolor(197, 0, 0, 247), false)--off3
        dxDrawLine(823 - 1, 294 - 1, 823 - 1, 350, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(944, 294 - 1, 823 - 1, 294 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(823 - 1, 350, 944, 350, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(944, 350, 944, 294 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawRectangle(823, 294, 121, 56, tocolor(0, 0, 0, 120), false)
        dxDrawLine(823 - 1, 368 - 1, 823 - 1, 424, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(944, 368 - 1, 823 - 1, 368 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(823 - 1, 424, 944, 424, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(944, 424, 944, 368 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawRectangle(823, 368, 121, 56, tocolor(0, 0, 0, 120), false)
        dxDrawLine(823 - 1, 442 - 1, 823 - 1, 498, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(944, 442 - 1, 823 - 1, 442 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(823 - 1, 498, 944, 498, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(944, 498, 944, 442 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawRectangle(823, 442, 121, 56, tocolor(0, 0, 0, 120), false)
        dxDrawText("Indestrutivel", 534, 313, 636, 345, tocolor(254, 254, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("Invisivel", 544, 386, 646, 418, tocolor(254, 254, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("Rainbow", 538, 463, 640, 495, tocolor(254, 254, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("Construçao", 852, 463, 954, 495, tocolor(254, 254, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("Construçao", 852, 386, 954, 418, tocolor(254, 254, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("Carro VIP", 858, 313, 960, 345, tocolor(254, 254, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("OFF", 656, 313, 758, 345, tocolor(255, 255, 255, 247), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("OFF", 656, 386, 758, 418, tocolor(255, 255, 255, 247), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("OFF", 656, 463, 758, 495, tocolor(255, 255, 255, 247), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawLine(490 - 1, 544 - 1, 490 - 1, 570, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(960, 544 - 1, 490 - 1, 544 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(490 - 1, 570, 960, 570, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(960, 570, 960, 544 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawRectangle(490, 544, 470, 26, tocolor(0, 0, 0, 247), false)
        dxDrawText("Tempo VIP : 0 dias, 0 horas, 0 minutos, 0 segundos", 573, 550, 680, 577, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("V.I.P", 665, 197, 888, 260, tocolor(0, 0, 0, 255), 4.10, "default", "left", "top", false, false, false, false, false)
        end
 
    function abrir()
if painelplayer == false then
triggerServerEvent("callGetVip", localPlayer)
painelplayer = true
showCursor (true)
addEventHandler("onClientRender", root, viplayer)
removeEventHandler ("onClientRender", root, vipcarro)
painelcarro = false
else
painelplayer = false
showCursor (false)
removeEventHandler("onClientRender", root, viplayer)
removeEventHandler("onClientRender", root, vipcarro)
painelcarro = false
end
end
bindKey ("h", "down", abrir)
 
addEvent("SendVip",true)
addEventHandler( "SendVip", localPlayer,
    function(tempo)
        tempovip = tempo
    end
)
 
function player()
if painelcarro == true then
if ( isCursorOnElement (342, 274, 174, 189) ) then
removeEventHandler ("onClientRender", getRootElement(), viplayer)
removeEventHandler ("onClientRender", getRootElement(), vipcarro)
painelplayer = false
painelcarro = false
showCursor (false)
addEventHandler ("onClientRender", getRootElement(), viplayer)
painelplayer = true
showCursor (true)
end
end
end
addEventHandler ("onClientClick", root, player)
 
function carro()
if painelplayer == true then
if ( isCursorOnElement (297, 378, 209, 182) ) then
removeEventHandler ("onClientRender", getRootElement(), viplayer)
painelplayer = false
showCursor (false)
addEventHandler ("onClientRender", getRootElement(), vipcarro)
painelcarro = true
showCursor (true)
end
end
end
addEventHandler ("onClientClick", root, carro)
 
function jpack (_,state)
     if painelplayer == true then
      if ( state == "down" ) then
       if ( isCursorOnElement (509, 294, 121, 56) ) then
           triggerServerEvent ("jetpack", localPlayer)
               end
          end
     end
end
addEventHandler ("onClientClick", root, jpack)
 
function jpack2 (_,state)
     if painelplayer == true then
      if ( state == "down" ) then
       if ( isCursorOnElement (629, 295, 74, 55) ) then
           triggerServerEvent ("jetpack1", localPlayer)
               end
          end
     end
end
addEventHandler ("onClientClick", root, jpack2)
 
function sivel (_,state)
     if painelplayer == true then
      if ( state == "down" ) then
       if ( isCursorOnElement (509, 368, 121, 56) ) then
           triggerServerEvent ("invi", localPlayer)
               end
          end
     end
end
addEventHandler ("onClientClick", root, sivel)
 
function offsivel (_,state)
     if painelplayer == true then
      if ( state == "down" ) then
       if ( isCursorOnElement (629, 369, 74, 55) ) then
           triggerServerEvent ("offinvi", localPlayer)
               end
          end
     end
end
addEventHandler ("onClientClick", root, offsivel)
 
function tresx (_,state)
     if painelplayer == true then
      if ( state == "down" ) then
       if ( isCursorOnElement (506, 443, 121, 56) ) then
           triggerServerEvent ("3x", localPlayer)
               end
          end
     end
end
addEventHandler ("onClientClick", root, tresx)
 
function tresx1 (_,state)
     if painelplayer == true then
      if ( state == "down" ) then
       
Link to comment

rafaelel, Não é necessário editar todas suas mensagens após resolver o problema.

Lembre-se também, que o seu tópico pode ajudar outras pessoas que também tenham um problema relacionado ao seu.

Além disso, você está quebrando esta regra do fórum:

By posting to this board, you agree to let any posted code stay visible until decided otherwise by the administrators.
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...