Jump to content

help [Gui]


sckatchof

Recommended Posts

hi guys i have problem when i do /changepw nothing it show why ?

Client Side :

screenWidth,screenHeight = guiGetScreenSize() 
mainWidth = 320 
mainHeight = 300 
  
windowChangepw  =  guiCreateWindow(screenWidth/2-mainWidth/2,screenHeight/2-mainHeight/2,mainWidth,mainHeight,"Change Password",true) 
TextLabeOld     =  guiCreateLabel(9,40,84,18,"Old Password :",false,windowChangepw) 
TextLabelNewPW  =  guiCreateLabel(9,71,90,19,"New Password :",false,windowChangepw) 
editOldpw       =  guiCreateEdit(95,37,196,24,"",false,windowChangepw) 
editNewpw       =  guiCreateEdit(99,68,196,24,"",false,windowChangepw) 
ButtonChange    =  guiCreateButton(27,130,113,25,"Change it!",false,windowChangepw) 
ButtonCancel    =  guiCreateButton(252,130,113,25,"Cancel",false,windowChangepw) 
  
        guiSetVisible(windowChangepw, false) 
        guiWindowSetMovable(windowChangepw,false) 
        guiWindowSetSizable(windowChangepw,false) 
        guiLabelSetColor(TextLabeOld,150,100,0) 
  
addEventHandler( "onClientGUIClick", ButtonCancel, hidewindow ) 
addEventHandler( "onClientGUIClick", ButtonChange, Changepsw) 
  
.. 
.. 
function changePw() 
    guiSetInputEnabled(true) 
    guiSetVisible(windowChangepw, true) 
    showCursor(true) 
end 
.. 
.. 
addCommandHandler("changepw", changePw) 

Link to comment

  
screenWidth,screenHeight = guiGetScreenSize() 
mainWidth = 320 
mainHeight = 300 
  
windowChangepw  =  guiCreateWindow(screenWidth/2-mainWidth/2,screenHeight/2-mainHeight/2,mainWidth,mainHeight,"Change Password",true) 
TextLabeOld     =  guiCreateLabel(9,40,84,18,"Old Password :",false,windowChangepw) 
TextLabelNewPW  =  guiCreateLabel(9,71,90,19,"New Password :",false,windowChangepw) 
editOldpw       =  guiCreateEdit(95,37,196,24,"",false,windowChangepw) 
editNewpw       =  guiCreateEdit(99,68,196,24,"",false,windowChangepw) 
ButtonChange    =  guiCreateButton(27,130,113,25,"Change it!",false,windowChangepw) 
ButtonCancel    =  guiCreateButton(252,130,113,25,"Cancel",false,windowChangepw) 
  
        guiSetVisible(windowChangepw, false) 
        guiWindowSetMovable(windowChangepw,false) 
        guiWindowSetSizable(windowChangepw,false) 
        guiLabelSetColor(TextLabeOld,150,100,0) 
  
addEventHandler( "onClientGUIClick", ButtonCancel, hidewindow ) 
addEventHandler( "onClientGUIClick", ButtonChange, Changepsw) 
  
function changePw() 
    guiSetInputEnabled(true) 
    guiSetVisible(windowChangepw, true) 
    showCursor(true) 
end 
addCommandHandler("changepw", changePw) 

Next time use /debugscript 3

Link to comment

function loldd() 
if source == ButtonCancel then 
    guiSetInputEnabled(true) 
    guiSetVisible(windowChangepw, false) 
    showCursor(false) 
end 
addEventHandler( "onClientGUIClick", getRootElement(), loldd ) 
  
function changePw() 
    guiSetInputEnabled(false) 
    guiSetVisible(windowChangepw, true) 
    showCursor(true) 
end 
addCommandHandler("changepw", changePw) 
  
screenWidth,screenHeight = guiGetScreenSize() 
mainWidth = 320 
mainHeight = 300 
  
windowChangepw  =  guiCreateWindow(screenWidth/2-mainWidth/2,screenHeight/2-mainHeight/2,mainWidth,mainHeight,"Change Password",true) 
TextLabeOld     =  guiCreateLabel(9,40,84,18,"Old Password :",false,windowChangepw) 
TextLabelNewPW  =  guiCreateLabel(9,71,90,19,"New Password :",false,windowChangepw) 
editOldpw       =  guiCreateEdit(95,37,196,24,"",false,windowChangepw) 
editNewpw       =  guiCreateEdit(99,68,196,24,"",false,windowChangepw) 
ButtonChange    =  guiCreateButton(27,130,113,25,"Change it!",false,windowChangepw) 
ButtonCancel    =  guiCreateButton(252,130,113,25,"Cancel",false,windowChangepw) 
guiSetVisible(windowChangepw, false) 
guiWindowSetMovable(windowChangepw,false) 
guiWindowSetSizable(windowChangepw,false) 
guiLabelSetColor(TextLabeOld,150,100,0) 
  

And you have to make for yourself the changepsw function..

Link to comment

function loldd() 
    if source == ButtonCancel then 
        guiSetInputEnabled(true) 
        guiSetVisible(windowChangepw, false) 
        showCursor(false) 
    end 
end 
addEventHandler( "onClientGUIClick", getRootElement(), loldd ) 
  
function changePw() 
    guiSetInputEnabled(false) 
    guiSetVisible(windowChangepw, true) 
    showCursor(true) 
end 
addCommandHandler("changepw", changePw) 
  
screenWidth,screenHeight = guiGetScreenSize() 
mainWidth = 320 
mainHeight = 300 
  
windowChangepw  =  guiCreateWindow(screenWidth/2-mainWidth/2,screenHeight/2-mainHeight/2,mainWidth,mainHeight,"Change Password",true) 
TextLabeOld     =  guiCreateLabel(9,40,84,18,"Old Password :",false,windowChangepw) 
TextLabelNewPW  =  guiCreateLabel(9,71,90,19,"New Password :",false,windowChangepw) 
editOldpw       =  guiCreateEdit(95,37,196,24,"",false,windowChangepw) 
editNewpw       =  guiCreateEdit(99,68,196,24,"",false,windowChangepw) 
ButtonChange    =  guiCreateButton(27,130,113,25,"Change it!",false,windowChangepw) 
ButtonCancel    =  guiCreateButton(252,130,113,25,"Cancel",false,windowChangepw) 
guiSetVisible(windowChangepw, false) 
guiWindowSetMovable(windowChangepw,false) 
guiWindowSetSizable(windowChangepw,false) 
guiLabelSetColor(TextLabeOld,150,100,0) 

you forget an 'end' to close if on line 2 ganjarulez

Link to comment
function loldd() 
    if source == ButtonCancel then 
        guiSetInputEnabled(true) 
        guiSetVisible(windowChangepw, false) 
        showCursor(false) 
    end 
end 
addEventHandler( "onClientGUIClick", getRootElement(), loldd ) 
  
function changePw() 
    guiSetInputEnabled(false) 
    guiSetVisible(windowChangepw, true) 
    showCursor(true) 
end 
addCommandHandler("changepw", changePw) 
  
screenWidth,screenHeight = guiGetScreenSize() 
mainWidth = 320 
mainHeight = 300 
  
windowChangepw  =  guiCreateWindow(screenWidth/2-mainWidth/2,screenHeight/2-mainHeight/2,mainWidth,mainHeight,"Change Password",true) 
TextLabeOld     =  guiCreateLabel(9,40,84,18,"Old Password :",false,windowChangepw) 
TextLabelNewPW  =  guiCreateLabel(9,71,90,19,"New Password :",false,windowChangepw) 
editOldpw       =  guiCreateEdit(95,37,196,24,"",false,windowChangepw) 
editNewpw       =  guiCreateEdit(99,68,196,24,"",false,windowChangepw) 
ButtonChange    =  guiCreateButton(27,130,113,25,"Change it!",false,windowChangepw) 
ButtonCancel    =  guiCreateButton(252,130,113,25,"Cancel",false,windowChangepw) 
guiSetVisible(windowChangepw, false) 
guiWindowSetMovable(windowChangepw,false) 
guiWindowSetSizable(windowChangepw,false) 
guiLabelSetColor(TextLabeOld,150,100,0) 

you forget an 'end' to close if on line 2 ganjarulez

thank sparrow for help but i still dont show .

Link to comment

try this:

screenWidth,screenHeight = guiGetScreenSize() 
mainWidth = 320 
mainHeight = 300 
  
windowChangepw  =  guiCreateWindow(screenWidth/2-mainWidth/2,screenHeight/2-mainHeight/2,mainWidth,mainHeight,"Change Password",true) 
TextLabeOld     =  guiCreateLabel(9,40,84,18,"Old Password :",false,windowChangepw) 
TextLabelNewPW  =  guiCreateLabel(9,71,90,19,"New Password :",false,windowChangepw) 
editOldpw       =  guiCreateEdit(95,37,196,24,"",false,windowChangepw) 
editNewpw       =  guiCreateEdit(99,68,196,24,"",false,windowChangepw) 
ButtonChange    =  guiCreateButton(27,130,113,25,"Change it!",false,windowChangepw) 
ButtonCancel    =  guiCreateButton(252,130,113,25,"Cancel",false,windowChangepw) 
guiSetVisible(windowChangepw, false) 
guiWindowSetMovable(windowChangepw,false) 
guiWindowSetSizable(windowChangepw,false) 
guiLabelSetColor(TextLabeOld,150,100,0) 
  
function changePw() 
    if (windowChangepw) then 
        if (guiGetVisible(windowChangepw) == true) then   
            showCursor(false)         
            guiSetVisible (windowChangepw, false) 
        else 
            showCursor(true)         
            guiSetVisible (windowChangepw, true) 
        end 
    end 
end 
addCommandHandler("changepw", changePw) 

Edited by Guest
Link to comment
copy it again

Client Side :

screenWidth,screenHeight = guiGetScreenSize() 
mainWidth = 320 
mainHeight = 300 
  
windowChangepw  =  guiCreateWindow(screenWidth/2-mainWidth/2,screenHeight/2-mainHeight/2,mainWidth,mainHeight,"Change Password",true) 
TextLabeOld     =  guiCreateLabel(9,40,84,18,"Old Password :",false,windowChangepw) 
TextLabelNewPW  =  guiCreateLabel(9,71,90,19,"New Password :",false,windowChangepw) 
editOldpw       =  guiCreateEdit(95,37,196,24,"",false,windowChangepw) 
editNewpw       =  guiCreateEdit(99,68,196,24,"",false,windowChangepw) 
ButtonChange    =  guiCreateButton(27,130,113,25,"Change it!",false,windowChangepw) 
ButtonCancel    =  guiCreateButton(252,130,113,25,"Cancel",false,windowChangepw) 
  
        guiSetVisible(windowChangepw, false) 
        guiWindowSetMovable(windowChangepw,false) 
        guiWindowSetSizable(windowChangepw,false) 
        guiLabelSetColor(TextLabeOld,150,100,0) 
  
addEventHandler( "onClientGUIClick", ButtonCancel, hidewindow ) 
  
function changePw() 
    guiSetInputEnabled(true) 
    guiSetVisible(windowChangepw, true) 
    showCursor(true) 
end 
addCommandHandler("changepw", changePw) 

Link to comment

this may work

function blabla() 
screenWidth,screenHeight = guiGetScreenSize() 
mainWidth = 320 
mainHeight = 300 
windowChangepw  =  guiCreateWindow(screenWidth/2-mainWidth/2,screenHeight/2-mainHeight/2,mainWidth,mainHeight,"Change Password",true) 
TextLabeOld     =  guiCreateLabel(9,40,84,18,"Old Password :",false,windowChangepw) 
TextLabelNewPW  =  guiCreateLabel(9,71,90,19,"New Password :",false,windowChangepw) 
editOldpw       =  guiCreateEdit(95,37,196,24,"",false,windowChangepw) 
editNewpw       =  guiCreateEdit(99,68,196,24,"",false,windowChangepw) 
ButtonChange    =  guiCreateButton(27,130,113,25,"Change it!",false,windowChangepw) 
ButtonCancel    =  guiCreateButton(252,130,113,25,"Cancel",false,windowChangepw) 
guiSetVisible(windowChangepw, true) 
guiWindowSetMovable(windowChangepw, false) 
guiWindowSetSizable(windowChangepw, false) 
guiLabelSetColor(TextLabeOld,150,100,0) 
addEventHandler( "onClientGUIClick", ButtonCancel, hidewindow ) 
end 
  
function changeMyPw() 
    if (windowChangepw) then 
        if (guiGetVisible(windowChangepw) == true) then 
            showCursor(false) 
            guiSetVisible (windowChangepw, false) 
        elseif (guiGetVisible(windowChangepw) == false) then 
            showCursor(true) 
            guiSetVisible (windowChangepw, true) 
        end 
    end 
end 
addCommandHandler("changepw", changeMyPw) 

Link to comment
local screenWidth, screenHeight = guiGetScreenSize() 
local mainWidth = 320 
local mainHeight = 300 
  
windowChangepw  =  guiCreateWindow ( screenWidth / 2 - mainWidth / 2, screenHeight / 2 - mainHeight / 2, mainWidth, mainHeight, "Change Password", false ) 
TextLabeOld     =  guiCreateLabel ( 9, 40, 84, 18, "Old Password :", false, windowChangepw ) 
TextLabelNewPW  =  guiCreateLabel ( 9, 71, 90, 19, "New Password :", false, windowChangepw ) 
editOldpw       =  guiCreateEdit ( 95, 37, 196, 24, "", false, windowChangepw ) 
editNewpw       =  guiCreateEdit ( 99, 68, 196, 24, "", false, windowChangepw ) 
ButtonChange    =  guiCreateButton ( 27, 130, 113, 25, "Change it!", false, windowChangepw ) 
ButtonCancel    =  guiCreateButton ( 252, 130, 113, 25, "Cancel", false, windowChangepw ) 
guiSetVisible ( windowChangepw, false ) 
guiWindowSetMovable ( windowChangepw, false ) 
guiWindowSetSizable ( windowChangepw, false ) 
guiLabelSetColor ( TextLabeOld, 150, 100, 0 ) 
  
addEventHandler ( "onClientGUIClick", ButtonCancel, hidewindow ) -- isn't hideWindow nil? 
  
addCommandHandler ( "changepw", 
    function ( ) 
        guiSetVisible ( windowChangepw, not guiGetVisible ( windowChangepw ) ) 
        showCursor ( not isCursorShowing ( ) ) 
        guiSetInputEnabled ( not guiGetInputEnabled ( ) ) 
    end 
) 
  

Link to comment
function createGUI() 
    screenWidth,screenHeight = guiGetScreenSize ( ) 
    mainWidth = 320 
    mainHeight = 300 
    windowChangepw  =  guiCreateWindow(screenWidth/2-mainWidth/2,screenHeight/2-mainHeight/2,mainWidth,mainHeight,"Change Password",true) 
    TextLabeOld     =  guiCreateLabel(9,40,84,18,"Old Password :",false,windowChangepw) 
    TextLabelNewPW  =  guiCreateLabel(9,71,90,19,"New Password :",false,windowChangepw) 
    editOldpw       =  guiCreateEdit(95,37,196,24,"",false,windowChangepw) 
    editNewpw       =  guiCreateEdit(99,68,196,24,"",false,windowChangepw) 
    ButtonChange    =  guiCreateButton(27,130,113,25,"Change it!",false,windowChangepw) 
    ButtonCancel    =  guiCreateButton(252,130,113,25,"Cancel",false,windowChangepw) 
     
    guiSetVisible ( windowChangepw, true ) 
    guiWindowSetMovable ( windowChangepw, false ) 
    guiWindowSetSizable ( windowChangepw, false ) 
    guiLabelSetColor ( TextLabeOld, 150, 100, 0 ) 
    addEventHandler( "onClientGUIClick", ButtonCancel, hidewindow, false ) 
end 
addEventHandler ( "onClientResourceStart", resourceRoot, createGUI ) 
  
function hidewindow ( ) 
end 
  
function changeMyPw() 
    if (windowChangepw) then 
        guiSetVisible ( windowChangepw, not guiGetVisible ( windowChangepw ) ) 
        showCursor ( guiGetVisible ( windowChangepw ) ) 
    end 
end 
addCommandHandler("changepw", changeMyPw) 

Link to comment
function createGUI() 
    screenWidth,screenHeight = guiGetScreenSize ( ) 
    mainWidth = 320 
    mainHeight = 300 
    windowChangepw  =  guiCreateWindow(screenWidth/2-mainWidth/2,screenHeight/2-mainHeight/2,mainWidth,mainHeight,"Change Password",true) 
    TextLabeOld     =  guiCreateLabel(9,40,84,18,"Old Password :",false,windowChangepw) 
    TextLabelNewPW  =  guiCreateLabel(9,71,90,19,"New Password :",false,windowChangepw) 
    editOldpw       =  guiCreateEdit(95,37,196,24,"",false,windowChangepw) 
    editNewpw       =  guiCreateEdit(99,68,196,24,"",false,windowChangepw) 
    ButtonChange    =  guiCreateButton(27,130,113,25,"Change it!",false,windowChangepw) 
    ButtonCancel    =  guiCreateButton(252,130,113,25,"Cancel",false,windowChangepw) 
     
    guiSetVisible ( windowChangepw, true ) 
    guiWindowSetMovable ( windowChangepw, false ) 
    guiWindowSetSizable ( windowChangepw, false ) 
    guiLabelSetColor ( TextLabeOld, 150, 100, 0 ) 
    addEventHandler( "onClientGUIClick", ButtonCancel, hidewindow, false ) 
end 
addEventHandler ( "onClientResourceStart", resourceRoot, createGUI ) 
  
function hidewindow ( ) 
end 
  
function changeMyPw() 
    if (windowChangepw) then 
        guiSetVisible ( windowChangepw, not guiGetVisible ( windowChangepw ) ) 
        showCursor ( guiGetVisible ( windowChangepw ) ) 
    end 
end 
addCommandHandler("changepw", changeMyPw) 

thank you sanke :) but why when i write old password and new password dont work ?

server side :

function passwordHandler(player, oldpassword, newpassword) 
    local account = getPlayerAccount(player) 
    if (account) then 
        if (isGuestAccount(account)) then 
            outputChatBox("You must be logged in to change your password.", player) 
            return 
        end 
        local playerName = getPlayerName(player) 
        local password_check = getAccount(playerName, oldpassword) 
        if (password_check ~= false) then 
            if (string.len(newpassword) >= 5) then 
                setAccountPassword(account, newpassword) 
                triggerClientEvent(player, "hidePasswordWindow", getRootElement()) 
            else 
                outputChatBox("Your new password must be at least 5 characters long!", player) 
            end 
        else 
            outputChatBox("Old password invalid.", player) 
        end 
    end 
end 
addEvent("submitChangepw", true) 
addEventHandler("submitChangepw", root, passwordHandler) 

Link to comment
Show us how you trigger the event: "submitChangepw".

client :

function clientSubmitChangepw(button, state) 
    if button == "left" and state == "up" then 
        local oldpassword = guiGetText(editOldpw) 
        local newpassword = guiGetText(editNewpw) 
        if oldpassword and newpassword then 
            triggerServerEvent("submitChangepw", getRootElement(), localPlayer, oldpassword, newpassword) 
        else 
            outputChatBox("Enter old and new password.") 
        end 
    end 
end 
  

Link to comment
You added a event handler for: "clientSubmitChangepw" function, right? if you can, post the whole client side.

yes ofc i added it :)

...... 
Buttonchange = guiCreateButton(210,225,136,27,"Change Password",false,WindowChangepw) 
editOldpw = guiCreateEdit(96,97,184,23,"",false,WindowChangepw) 
editNewpw = guiCreateEdit(108,129,184,23,"",false,WindowChangepw) 
.... 
function clientSubmitChangepw(button, state) 
    if button == "left" and state == "up" then 
        local oldpassword = guiGetText(editOldpw) 
        local newpassword = guiGetText(editNewpw) 
        if oldpassword and newpassword then 
            triggerServerEvent("submitChangepw", getRootElement(), localPlayer, oldpassword, newpassword) 
        else 
            outputChatBox("Enter old and new password.") 
        end 
    end 
end 
 addEventHandler( "onClientGUIClick", Buttonchange, clientSubmitChangepw, false) 

Link to comment
function passwordHandler(player, oldpassword, newpassword) 
    local account = getPlayerAccount(player) 
    if (account) then 
        if (isGuestAccount(account)) then 
            outputChatBox("You must be logged in to change your password.", player) 
            return 
        end 
        local accountName = getAccountName ( account ) 
        local password_check = getAccount(accountName, oldpassword) 
        if (password_check ~= false) then 
            if (string.len(newpassword) >= 5) then 
                setAccountPassword(account, newpassword) 
                triggerClientEvent(player, "hidePasswordWindow", getRootElement()) 
            else 
                outputChatBox("Your new password must be at least 5 characters long!", player) 
            end 
        else 
            outputChatBox("Old password invalid.", player) 
        end 
    end 
end 
addEvent("submitChangepw", true) 
addEventHandler("submitChangepw", root, passwordHandler) 

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