Jump to content

Solved


1LoL1

Recommended Posts

Hello, anyone can help me with this code? :( or how to change ACTIVE only to "VIP" and when i dont have VIP text will NOT ACTIVE

          
local C8 = guiCreateLabel(80,25,500,500,"ACTIVE",false,VipWindow) 
guiSetFont(C8, "default-bold-small") 
guiLabelSetColor(C8, 0, 255, 0) 
else 
local C8 = guiCreateLabel(80,25,500,500,"NOT ACTIVE", false,VipWindow) 
guiSetFont(C8, "default-bold-small") 
guiLabelSetColor(C8, 255, 0, 0) 
end 

Edited by Guest
Link to comment

create the label then set the text if the player's vip status is changed

function asdf() 
    local C8 = guiCreateLabel(80,25,500,500,"",false,VipWindow) 
  
    if getElementData(localPlayer, "vip") then-- If the player is vip then put this label 
        guiSetFont(C8, "default-bold-small") 
        guiLabelSetColor(C8, 0, 255, 0) 
        guiSetText(C8,"ACTIVE") 
    else-- else if the player isn't vip put this label 
        guiSetFont(C8, "default-bold-small") 
        guiLabelSetColor(C8, 255, 0, 0) 
        guiSetText(C8,"NOT ACTIVE") 
    end 
end 

Link to comment
create the label then set the text if the player's vip status is changed
function asdf() 
    local C8 = guiCreateLabel(80,25,500,500,"",false,VipWindow) 
  
    if getElementData(localPlayer, "vip") then-- If the player is vip then put this label 
        guiSetFont(C8, "default-bold-small") 
        guiLabelSetColor(C8, 0, 255, 0) 
        guiSetText(C8,"ACTIVE") 
    else-- else if the player isn't vip put this label 
        guiSetFont(C8, "default-bold-small") 
        guiLabelSetColor(C8, 255, 0, 0) 
        guiSetText(C8,"NOT ACTIVE") 
    end 
end 

this is when player is in acl.xml in "VIP" ?

Link to comment

and why this not work? :(

  
if getElementData(localPlayer, "lang") == "EN" then 
local C1 = guiCreateLabel(10,50,500,500,"",false,VipWindow) 
guiSetText (C1, "TEST1") 
guiLabelSetColor ( C1, 0, 255, 0 ) 
guiSetFont(C1, "default-bold-small") 
else 
local C1 = guiCreateLabel(10,50,500,500,"",false,VipWindow) 
guiSetText (C1, "TEST2") 
guiLabelSetColor ( C1, 0, 255, 0 ) 
guiSetFont(C1, "default-bold-small") 
  

i change language to "else" but text is again in EN i must restart resource when i want to change language.

Link to comment

If you are using the acl for a vip group you need to trigger it from the server side then send the info to client side

so the server file you would need to check if the player is in an acl group, I just used a timer for example!:

  
setTimer(function() 
    for i,plr in pairs(getElementsByType"player")do 
        inAcl = x 
        if isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount ( thePlayer ) ), aclGetGroup ( "vip" ) ) then 
            inAcl = true 
        else  
            inAcl = false 
        end 
        triggerClientEvent( plr, "aaaaaa", plr, inAcl) 
    end 
end,5000,0) 
  

when the client file is triggered it will be updated

function asdf(vip) 
    local C8 = guiCreateLabel(80,25,500,500,"",false,VipWindow) 
  
    if vip then-- If the player is vip then put this label 
        guiSetFont(C8, "default-bold-small") 
        guiLabelSetColor(C8, 0, 255, 0) 
        guiSetText(C8,"ACTIVE") 
    else-- else if the player isn't vip put this label 
        guiSetFont(C8, "default-bold-small") 
        guiLabelSetColor(C8, 255, 0, 0) 
        guiSetText(C8,"NOT ACTIVE") 
    end 
end 
addEvent("aaaaaa",true) 
addEventHandler( "aaaaaa", root, asdf ) 

edit: I'm not that good with acl... i barely use it :D

Link to comment
Put the full code
function CreateShopWindow() 
    VipWindow = guiCreateWindow(350,225,320,375,"TEST",false) 
    guiSetAlpha ( VipWindow, 5.00 ) 
         
        if getElementData(localPlayer, "lang") == "EN" then 
        local C1 = guiCreateLabel(10,50,500,500,"",false,VipWindow) 
        guiSetText (C1, "TEST1") 
        guiLabelSetColor ( C1, 0, 255, 0 ) 
        guiSetFont(C1, "default-bold-small") 
        local C2 = guiCreateLabel(10,75,500,500,"",false,VipWindow) 
        guiSetText (C2, "TEST2") 
        guiLabelSetColor ( C2, 0, 255, 0 ) 
        local C3 = guiCreateLabel(10,100,500,500,"",false,VipWindow) 
        guiSetText (C3, "TEST3") 
        guiLabelSetColor ( C3, 0, 255, 0 ) 
        local C4 = guiCreateLabel(10,125,500,500,"",false,VipWindow) 
        guiSetText (C4, "TEST4") 
        guiLabelSetColor ( C4, 0, 255, 0 ) 
        local C5 = guiCreateLabel(10,150,500,500,"",false,VipWindow) 
        guiSetText (C5, "TEST5") 
        guiLabelSetColor ( C5, 0, 255, 0 ) 
        local C6 = guiCreateLabel(10,175,500,500,"",false,VipWindow) 
        guiSetText (C6, "TEST6") 
        guiLabelSetColor ( C6, 0, 255, 0 ) 
        local C7 = guiCreateLabel(10,25,500,500,"",false,VipWindow) 
        guiSetText (C7, "TEST7") 
        guiSetFont(C7, "default-bold-small") 
        local C8 = guiCreateLabel(80,25,500,500,"",false,VipWindow) 
        guiSetText (C8, "TEST8") 
        guiSetFont(C8, "default-bold-small") 
        guiLabelSetColor(C8, 255, 0, 0) 
        guiCreateStaticImage(10, 225, 20, 16, ":admin/client/images/flags/test.png",false,VipWindow) 
        test9 = guiCreateLabel(40, 225, 500, 500, "TEST9",false,VipWindow) 
        guiSetText (text9, "TEST") 
        guiSetFont(test9, "default-bold-small") 
        guiCreateStaticImage(10, 250, 20, 16, ":admin/client/images/flags/test.png",false,VipWindow) 
        test10 = guiCreateLabel(40,250, 500, 500, "TEST10",false,VipWindow) 
        setGuiText (text10, "TEST10") 
        guiSetFont(test10, "default-bold-small") 
        local C9 = guiCreateLabel(10, 350, 500, 500, "",false,VipWindow) 
        guiSetText (C9, "TEST11") 
        guiSetFont(C9, "default-bold-small") 
        local C10 = guiCreateLabel(10, 295, 500, 500, "",false,VipWindow) 
        guiSetText (C10, "TEST12") 
        guiSetFont(C10, "default-bold-small") 
        local C11 = guiCreateLabel(10, 315, 500, 500, "",false,VipWindow) 
        guiSetText (C11, "TEST13") 
        guiSetFont(C11, "default-bold-small") 
    else 
        local C1 = guiCreateLabel(10,50,500,500,"",false,VipWindow) 
        guiSetText (C1, "TEST1")  
        guiLabelSetColor ( C1, 0, 255, 0 ) 
        guiSetFont(C1, "default-bold-small") 
        local C2 = guiCreateLabel(10,75,500,500,"",false,VipWindow) 
        guiSetText (C2, "TEST2") 
        guiLabelSetColor ( C2, 0, 255, 0 ) 
        local C3 = guiCreateLabel(10,100,500,500,"",false,VipWindow) 
        guiSetText (C3, "TEST3") 
        guiLabelSetColor ( C3, 0, 255, 0 ) 
        local C4 = guiCreateLabel(10,125,500,500,"",false,VipWindow) 
        guiSetText (C4, "TEST4") 
        guiLabelSetColor ( C4, 0, 255, 0 ) 
        local C5 = guiCreateLabel(10,150,500,500,"",false,VipWindow) 
        guiSetText (C5, "TEST5") 
        guiLabelSetColor ( C5, 0, 255, 0 ) 
        local C6 = guiCreateLabel(10,175,500,500,"",false,VipWindow) 
        guiSetText (C6, "TEST6") 
        guiLabelSetColor ( C6, 0, 255, 0 ) 
        local C7 = guiCreateLabel(10,25,500,500,"",false,VipWindow) 
        guiSetText (C7, "TEST7") 
        guiSetFont(C7, "default-bold-small") 
        local C8 = guiCreateLabel(80,25,500,500,"", false,VipWindow) 
        guiSetText (C8, "TEST8") 
        guiSetFont(C8, "default-bold-small") 
        guiLabelSetColor(C8, 0, 255, 0) 
        guiCreateStaticImage(10, 225, 20, 16, ":admin/client/images/flags/cz.png",false,VipWindow) 
        local TesT = guiCreateLabel(40, 225, 500, 500, "",false,VipWindow) 
        guiSetText (TesT, "TesT") 
        guiSetFont(TesT, "default-bold-small") 
        guiCreateStaticImage(10, 250, 20, 16, ":admin/client/images/flags/sk.png",false,VipWindow) 
        local tESt = guiCreateLabel(40, 250, 500, 500, "",false,VipWindow) 
        guiSetText (tESt, "TEST") 
        guiSetFont(tESt, "default-bold-small") 
        local C9 = guiCreateLabel(10, 350, 500, 500, "",false,VipWindow) 
        guiSetText (C9, "TEST9") 
        guiSetFont(C9, "default-bold-small") 
        local C10 = guiCreateLabel(10, 295, 500, 500, "",false,VipWindow) 
        guiSetText (C10, "TEST10") 
        guiSetFont(C10, "default-bold-small") 
        local C11 = guiCreateLabel(10, 315, 500, 500, "",false,VipWindow) 
        guiSetText (C11, "TEST11") 
        guiSetFont(C11, "default-bold-small") 
        end 
  
  
    guiWindowSetSizable(VipWindow,false) 
    guiSetVisible(VipWindow,false) 
end 
addEventHandler("onClientResourceStart", getRootElement(), CreateShopWindow) 
  
  
function ShowGUI ( ) 
    guiSetVisible ( VipWindow, not guiGetVisible ( VipWindow ) ) 
    showCursor ( not isCursorShowing( ) ) 
    local screenW,screenH=guiGetScreenSize() 
    local windowW,windowH=guiGetSize(VipWindow,false) 
    local x,y = (screenW-windowW)/2,(screenH-windowH)/2 
    guiSetPosition(VipWindow,x,y,false) 
end 
bindKey ( "F2","down", ShowGUI ) 

Link to comment
And where do you use the setElementData for "lang" ?

Because we can see you are trying to GET it but you never explained/shown us how you set that element data.

function test (button, state) 
  
if button == "left" and state == "up" then 
        setElementData(getLocalPlayer(), "lang", "EN") 
        guiSetInputEnabled(false) 
        guiSetVisible(GUIEditor_Window[1], false) 
        showCursor(false) 
    end 
end 

Link to comment

[00:28:53] WARNING: [gameplay]/BB/server.lua:4: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got nil]

[00:28:53] WARNING: [gameplay]/BB/server.lua:4: Bad argument @ 'getAccountName' [Expected account at argument 1, got boolean]

[00:28:53] ERROR: [gameplay]/BB/server.lua:4: attempt to concatenate a boolean value

Link to comment
  
setTimer(function() 
    for i,plr in pairs(getElementsByType"player")do 
        local inAcl 
        if isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount ( plr ) ), aclGetGroup ( "vip" ) ) then 
            inAcl = true 
        else 
            inAcl = false 
        end 
        triggerClientEvent( plr, "aaaaaa", plr, inAcl) 
    end 
end,5000,0) 
  

thePlayer wasn't defined. I also localized inAcl.

Link to comment
  
setTimer(function() 
    for i,plr in pairs(getElementsByType"player")do 
        local inAcl 
        if isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount ( plr ) ), aclGetGroup ( "vip" ) ) then 
            inAcl = true 
        else 
            inAcl = false 
        end 
        triggerClientEvent( plr, "aaaaaa", plr, inAcl) 
    end 
end,5000,0) 
  

thePlayer wasn't defined. I also localized inAcl.

lol work thanks but when i delete player in acl.xml there is text ACTIVE and NOT ACTIVE too :(

Link to comment
lol work thanks but when i delete player in acl.xml there is text ACTIVE and NOT ACTIVE too :(

What you mean?

When i delete vip i see there ACTIVE and NOT ACTIVE too

or when i joined server and i have VIP i see there ACTIVE 3x and NOT ACTIVE 4x all in 1.

Link to comment

change this:

function asdf(vip) 
    local C8 = guiCreateLabel(80,25,500,500,"",false,VipWindow) 
  
    if vip then-- If the player is vip then put this label 
        guiSetFont(C8, "default-bold-small") 
        guiLabelSetColor(C8, 0, 255, 0) 
        guiSetText(C8,"ACTIVE") 
    else-- else if the player isn't vip put this label 
        guiSetFont(C8, "default-bold-small") 
        guiLabelSetColor(C8, 255, 0, 0) 
        guiSetText(C8,"NOT ACTIVE") 
    end 
end 
addEvent("aaaaaa",true) 
addEventHandler( "aaaaaa", root, asdf ) 

to this:

C8 = guiCreateLabel(80,25,500,500,"",false,VipWindow)-- putting the label outside the function so it wont be craeated each time the function is called 
function asdf(vip) 
    if vip then-- If the player is vip then put this label 
        guiSetFont(C8, "default-bold-small") 
        guiLabelSetColor(C8, 0, 255, 0) 
        guiSetText(C8,"ACTIVE") 
    else-- else if the player isn't vip put this label 
        guiSetFont(C8, "default-bold-small") 
        guiLabelSetColor(C8, 255, 0, 0) 
        guiSetText(C8,"NOT ACTIVE") 
    end 
end 
addEvent("aaaaaa",true) 
addEventHandler( "aaaaaa", root, asdf ) 

Link to comment
change this:
function asdf(vip) 
    local C8 = guiCreateLabel(80,25,500,500,"",false,VipWindow) 
  
    if vip then-- If the player is vip then put this label 
        guiSetFont(C8, "default-bold-small") 
        guiLabelSetColor(C8, 0, 255, 0) 
        guiSetText(C8,"ACTIVE") 
    else-- else if the player isn't vip put this label 
        guiSetFont(C8, "default-bold-small") 
        guiLabelSetColor(C8, 255, 0, 0) 
        guiSetText(C8,"NOT ACTIVE") 
    end 
end 
addEvent("aaaaaa",true) 
addEventHandler( "aaaaaa", root, asdf ) 

to this:

C8 = guiCreateLabel(80,25,500,500,"",false,VipWindow)-- putting the label outside the function so it wont be craeated each time the function is called 
function asdf(vip) 
    if vip then-- If the player is vip then put this label 
        guiSetFont(C8, "default-bold-small") 
        guiLabelSetColor(C8, 0, 255, 0) 
        guiSetText(C8,"ACTIVE") 
    else-- else if the player isn't vip put this label 
        guiSetFont(C8, "default-bold-small") 
        guiLabelSetColor(C8, 255, 0, 0) 
        guiSetText(C8,"NOT ACTIVE") 
    end 
end 
addEvent("aaaaaa",true) 
addEventHandler( "aaaaaa", root, asdf ) 

lol work thanks but how to change text now :D

Link to comment

ok this work but when i change language text is not changed :( i think problem is in GUI. When i want change text i must restart resource. Now its GUI:

F2 = Open

F2 = Close

i think must be:

F2 = CreateWindow

F2 = DestroyWindow

or i dont know :/

function ShowGUI ( ) 
    guiSetVisible ( VipWindow, not guiGetVisible ( VipWindow ) ) 
    showCursor ( not isCursorShowing( ) ) 
    local screenW,screenH=guiGetScreenSize() 
    local windowW,windowH=guiGetSize(VipWindow,false) 
    local x,y = (screenW-windowW)/2,(screenH-windowH)/2 
    guiSetPosition(VipWindow,x,y,false) 
end 
bindKey ( "F2","down", ShowGUI ) 

Link to comment
ok this work but when i change language text is not changed :( i think problem is in GUI. When i want change text i must restart resource. Now its GUI:

F2 = Open

F2 = Close

i think must be:

F2 = CreateWindow

F2 = DestroyWindow

or i dont know :/

I didn't get your point, explain more better

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