Jump to content

guiCreateButton (Help)


Dannz0r

Recommended Posts

Well I made a Userpanel and I need help with a button to save something that you type in the (guiCreateEdit) Field, well the button is easy to make, its done already, but I can't get the button function saving what's inside the (guiCreateEdit) to SQL, the server-side is done I made and It has a function name but I can't do the last bit, making the button function to save it to SQL.

Text:

gui["label_31"] = guiCreateLabel(15,50,500,14, "Contact Info:", false, gui["tab_5"]) 
guiSetFont(gui["label_31"], "default-bold-small") 
guiLabelSetHorizontalAlign(gui["label_31"], "left", false) 
guiLabelSetVerticalAlign(gui["label_31"], "center") 

Line Edit:

gui["lineEdit"] = guiCreateEdit(12,70,80,23, "", false, gui["tab_5"]) 
guiEditSetMaxLength(gui["lineEdit"], 32767) 
guiEditSetReadOnly(gui["lineEdit"], false) 

Button:

gui["info.contact_1"] = guiCreateButton(26,100 ,50 ,14 , "Save" , false , gui["tab_5"]) 

The Function name to save it to SQL:

 executeSQLUpdate ( "PersonalInfo", "Edit6 = '"..edit6.."'","serial = '" .. serial .. "'") 
 setElementData ( source ,"info.contact",edit6,true) 

24ni8n5.png

Link to comment

-- client side

addEventHandler("onClientGUIClick",getRootElement(), 
function () 
if (source == gui["info.contact_1"]) then 
local info = guiGetText(gui["lineEdit"]) 
triggerServerEvent("onUpdateInfo",getLocalPlayer(),info) 
  end 
end) 

-- server side

addEvent("onUpdateInfo",true) 
addEventHandler("onUpdateInfo",getRootElement(), 
function (info) 
local serial = getPlayerSerial(source) 
executeSQLUpdate ( "PersonalInfo", "Edit6 = '"..info.."'","serial = '" .. serial .. "'") 
 setElementData ( source ,"info.contact",edit6,true) 
end) 

Link to comment

Sorry for double-post but what I want to do is, whats gonna be wrote in the 'guiCreateEdit' to be saved in that field and when you connect back or logout/logged-in, what you wrote in that 'guiCreateEdit' to still be in there and when you click to be able to edit and save.

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