Jump to content

Recommended Posts

Bom Estou criando um sistema de entrar ne um team por gui mas ocorreu um erro que eu nao estou sabendo resolver

marker=createMarker(2257.91870 ,-1089.82178, 40.60156,"Cylinder", 2, 6, 240, 226, 255) 
GUIEditor_Button = {} 
    GUIEditor_Memo = {} 
    GUIEditor_Label = {} 
      
    function guiMyCwindow(w,h,t) 
      local x,y = guiGetScreenSize() 
      return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) 
    end 
      
    vagosjob = guiMyCwindow(320,350,"ALLIANCE VAGOS") 
    guiSetVisible(Vagosjob, false) 
    GUIEditor_Button[1] = guiCreateButton(22,300,108,37,"Entrar  Aliança",false,vagosjob) 
    GUIEditor_Label[1] = guiCreateLabel(193,-103,5,5,"",false,vagosjob) 
    GUIEditor_Button[2] = guiCreateButton(171,300,108,37,"Nao Entrar Aliança",false,vagosjob) 
    guiCreateLabel(13, 30, 300, 18, "Voce esta prestes a fazer alinça com os vagos",false,vagosjob) 
    guiCreateLabel(13, 45, 300, 18, "voce poderar ter varias vantagens",false,vagosjob) 
    guiCreateLabel(13, 60, 300, 18, "com esta aliança ",false,vagosjob) 
    guiCreateLabel(13, 75, 300, 18, "seja bem vindo",false,vagosjob) 
    
    guiCreateLabel(13, 230, 300, 18, "aliança",false,vagosjob) 
    guiCreateLabel(144, 307, 20, 18, "Ou",false,vagosjob) 
     
      
    function vagosjob(hitElement) 
  
         if getElementType(hitElement) == "player" and (hitElement == localPlayer) then 
              if not guiGetVisible(vagosjob) then 
                   guiSetVisible(vagosjob, true) 
                   showCursor(true) 
              end 
         end 
    end 
     
    addEventHandler("onClientMarkerHit", marker, vagosjob) 
      
    function vagosleave(leaveElement) 
         if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then 
              if guiGetVisible(vagosjob) then 
                   guiSetVisible(vagosjob, false) 
                   showCursor(false) 
              end 
         end 
    end 
    addEventHandler("onClientMarkerLeave", marker, vagosleave) 
      
    function joinVagos() 
         triggerServerEvent("setVagos",localPlayer) 
         guiSetVisible(Vagosjob, false) 
         showCursor(false) 
    end 
    addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinVagos, false) 
      
    function removeVagoWindow() 
         guiSetVisible(vagosjob, false) 
         showCursor(false) 
    end 
    addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeVagoWindow, false) 
    addEventHandler("onClientPlayerDamage", localPlayer, 
function(attacker, weapon, bodypart, loss) 
team = getPlayerTeam(attacker) 
    if (attacker and getElementType(attacker) == "player" and weapon == 41 and team and getTeamName(team) == "Vagos")  
        cancelEvent()  
        if (not isTimer(pause)) then  
            local health = getElementHealth(localPlayer) 
            if (health < 99) then 
            triggerServerEvent("Vagos:healing", localPlayer, attacker)  
            pause = setTimer(function() end, 1000, 1)  
            end 
        end 
    end 

ERROR

ATtempt to call global guigetscreensize a nill value 

Link to comment

Linha 12:

-- Você usou: 
guiSetVisible(Vagosjob, false) 
-- O correto seria: 
guiSetVisible(vagosjob, false ) 
-- ( tudo com letra minuscula, igual vc definiu na linha 11 ) 

Linha 62:

--Faltou um then na condição. 
if (attacker and getElementType(attacker) == "player" and weapon == 41 and team and getTeamName(team) == "Vagos") 
-- Correto: 
if (attacker and getElementType(attacker) == "player" and weapon == 41 and team and getTeamName(team) == "Vagos") then 

Linha 72:

-- Faltou um end: 
end ) 

Linha 25 a 33:

--Na linha 25 vc define vagosjob como o nome de uma função, depois na linha 28 e 29 tenta checar a visibilidade de 'vagosjob', mude o nome da função... 
vagosjob = guiMyCwindow(320,350,"ALLIANCE VAGOS") -- Linha 11 
function vagosjob(hitElement) 

Linha 49:

guiSetVisible(Vagosjob, false) 
-- Novamente vc tinha definido vagosjob tudo minusculo antes. 
guiSetVisible(vagosjob, false) 

Erro relacionado a função guiGetScreenSize não deu aqui, veja se seu script ta definido como client no meta.xml.

Link to comment

O Erro Resolveu Mas Ja Tentei De tudo mas esse nao resolve

addEventHandler("onClientPlayerDamage", localPlayer, 
function(attacker, weapon, bodypart, loss) 
team = getPlayerTeam(attacker) 
if (attacker and getElementType(attacker) == "player" and weapon == 41 and team and getTeamName(team) == "Vagos") then 
        cancelEvent() 
        if (not isTimer(pause)) then  
            local health = getElementHealth(localPlayer) 
            if (health < 99) then 
            triggerServerEvent("Vagos:healing", localPlayer, attacker)  
            pause = setTimer(function() end, 1000, 1) 
              
            end 
        end 
    end 
end 
end) 

ERROR

b.lua:8 expected to close at line 65 near end 

Link to comment
addEventHandler("onClientPlayerDamage", localPlayer, 
function(attacker, weapon, bodypart, loss) 
    team = getPlayerTeam(attacker) 
    if ( attacker and getElementType(attacker) == "player" and weapon == 41 and team and getTeamName(team) == "Vagos" ) then 
        cancelEvent() 
        if (not isTimer(pause)) then 
            local health = getElementHealth(localPlayer) 
            if (health < 99) then 
                triggerServerEvent("Vagos:healing", localPlayer, attacker) 
                pause = setTimer(function() end, 1000, 1) 
            end 
        end 
    end 
end) 

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...