sckatchof Posted March 16, 2012 Share Posted March 16, 2012 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
GanJaRuleZ Posted March 16, 2012 Share Posted March 16, 2012 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
sckatchof Posted March 16, 2012 Author Share Posted March 16, 2012 thanks for help but still dont work Link to comment
GanJaRuleZ Posted March 16, 2012 Share Posted March 16, 2012 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
sckatchof Posted March 16, 2012 Author Share Posted March 16, 2012 tnx but dont work idk why. Link to comment
GanJaRuleZ Posted March 16, 2012 Share Posted March 16, 2012 use : setAccountPassword Link to comment
Sparrow Posted March 16, 2012 Share Posted March 16, 2012 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
GanJaRuleZ Posted March 16, 2012 Share Posted March 16, 2012 Meh , right , sorry i cannot focus. Link to comment
sckatchof Posted March 16, 2012 Author Share Posted March 16, 2012 use : setAccountPassword I Use it and what i want why gui dose not show . Link to comment
sckatchof Posted March 16, 2012 Author Share Posted March 16, 2012 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
Sparrow Posted March 16, 2012 Share Posted March 16, 2012 (edited) 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 March 16, 2012 by Guest Link to comment
sckatchof Posted March 16, 2012 Author Share Posted March 16, 2012 still dont show just Cursor Show when i write the command Link to comment
sckatchof Posted March 16, 2012 Author Share Posted March 16, 2012 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
Sparrow Posted March 16, 2012 Share Posted March 16, 2012 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
drk Posted March 16, 2012 Share Posted March 16, 2012 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
Castillo Posted March 16, 2012 Share Posted March 16, 2012 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
sckatchof Posted March 16, 2012 Author Share Posted March 16, 2012 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
Castillo Posted March 16, 2012 Share Posted March 16, 2012 Show us how you trigger the event: "submitChangepw". Link to comment
sckatchof Posted March 16, 2012 Author Share Posted March 16, 2012 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
Castillo Posted March 16, 2012 Share Posted March 16, 2012 You added a event handler for: "clientSubmitChangepw" function, right? if you can, post the whole client side. Link to comment
sckatchof Posted March 16, 2012 Author Share Posted March 16, 2012 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
Castillo Posted March 16, 2012 Share Posted March 16, 2012 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
sckatchof Posted March 16, 2012 Author Share Posted March 16, 2012 thank you for help snake but i have WARNIG at line 12 Link to comment
Castillo Posted March 16, 2012 Share Posted March 16, 2012 Could you post the warnings/errors you got? Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now