KraZ Posted January 14, 2012 Share Posted January 14, 2012 Im depending on the MTA Community too much and i really want someone to teach me lua, through skype or team viewer or something but if someone could just post below id be real thankfull, Also heres what im trying to make, im trying to make it so when people register an account on my server, when they login they will have a gui where they can change their skin but this is only for people who have never joined before, who just registered, if someone can fix my code i dont know what i did but thank you in advance or if you don't want to you could teach me how to while going through it your self? and if you could add some guide lines for me too look through telling me which lines do which, not tons of them but some.. addEventHandler("onClientResourceStart",resourceRoot, function() GUIEditor_Label = {} chooseskin_window = guiCreateWindow(384,52,208,513,"Choose a skin!",false) Done_button = guiCreateButton(0.2788,0.8869,0.4423,0.0955,"Done!",true,chooseskin_window) guiSetFont(Done_button,"default-bold-small") showCursor(true) end function() GUIEditor_Memo = {} Login_window = guiCreateWindow(191,106,422,357,"Login/Register",false) guiSetInputEnabled (true) -- Disables all other keys like Chat while logging in! showCursor(true) guiWindowSetMovable(Login_window,false) guiWindowSetSizable(Login_window,false) KraZWorld_image = guiCreateStaticImage(0.0853,0.0504,0.8152,0.381,"images/KraZWorld.png",true,Login_window) Username_label = guiCreateLabel(0.0711,0.4594,0.1635,0.0504,"Username:",true,Login_window) guiLabelSetColor(Username_label,255,255,255) guiLabelSetVerticalAlign(Username_label,"top") guiLabelSetHorizontalAlign(Username_label,"left",false) Username_edit = guiCreateEdit(0.2393,0.4538,0.6825,0.0672,"",true,Login_window) Password_label = guiCreateLabel(0.0711,0.5854,0.1777,0.0616,"Password:",true,Login_window) guiLabelSetColor(Password_label,255,255,255) guiLabelSetVerticalAlign(Password_label,"top") guiLabelSetHorizontalAlign(Password_label,"left",false) Password_edit = guiCreateEdit(0.2393,0.5742,0.6825,0.0728,"",true,Login_window) guiEditSetMasked (Password_edit, true) -- Masks the pass box with ***** Login_button = guiCreateButton(0.1303,0.6975,0.3649,0.1513,"Login",true,Login_window) guiSetFont(Login_button,"clear-normal") Register_button = guiCreateButton(0.5355,0.6975,0.3649,0.1513,"Register",true,Login_window) guiSetFont(Register_button,"clear-normal") Info_label = guiCreateLabel(0.2938,0.8768,0.436,0.056,"Register an account and login!",true,Login_window) guiLabelSetColor(Info_label,255,255,255) guiLabelSetVerticalAlign(Info_label,"top") guiLabelSetHorizontalAlign(Info_label,"left",false) Register_Window = guiCreateWindow(619,105,178,358,"Register",false) guiSetVisible(Register_Window,false) guiWindowSetSizable(Register_Window,false) RegisterUsername_Label = guiCreateLabel(0.3371,0.1201,0.3989,0.0503,"Username:",true,Register_Window) guiLabelSetColor(RegisterUsername_Label,255,255,255) guiLabelSetVerticalAlign(RegisterUsername_Label,"top") guiLabelSetHorizontalAlign(RegisterUsername_Label,"left",false) RegisterUsername_edit = guiCreateEdit(0.0506,0.1872,0.8989,0.067,"",true,Register_Window) RegisterPassword_label = guiCreateLabel(0.3371,0.2821,0.4326,0.0587,"Password:",true,Register_Window) guiLabelSetColor(RegisterPassword_label,255,255,255) guiLabelSetVerticalAlign(RegisterPassword_label,"top") guiLabelSetHorizontalAlign(RegisterPassword_label,"left",false) RegisterPassword_edit = guiCreateEdit(0.0506,0.3408,0.8876,0.0726,"",true,Register_Window) guiEditSetMasked (RegisterPassword_edit, true) -- Masks the pass box with ***** GUIEditor_Memo[1] = guiCreateMemo(113,-540,5,411,"",false,Register_Window) NOTE_Label = guiCreateLabel(0.1348,0.0587,0.764,0.0503,"[NOTE] Case Sensitive!",true,Register_Window) guiLabelSetColor(NOTE_Label,255,255,255) guiLabelSetVerticalAlign(NOTE_Label,"top") guiLabelSetHorizontalAlign(NOTE_Label,"left",false) RegisterRegister_Button = guiCreateButton(0.1348,0.4413,0.736,0.1173,"Register!",true,Register_Window) S1_Label = guiCreateLabel(0.0618,0.5726,0.8371,0.0503,"We Are Not Resposible for:",true,Register_Window) guiLabelSetColor(S1_Label,255,255,255) guiLabelSetVerticalAlign(S1_Label,"top") guiLabelSetHorizontalAlign(S1_Label,"left",false) S2_Label = guiCreateLabel(0.2528,0.6229,0.5169,0.0475,"Lost Passwords,",true,Register_Window) guiLabelSetColor(S2_Label,255,255,255) guiLabelSetVerticalAlign(S2_Label,"top") guiLabelSetHorizontalAlign(S2_Label,"left",false) S3_Label = guiCreateLabel(0.2079,0.6704,0.7416,0.095,"Hacked Accounts,",true,Register_Window) guiLabelSetColor(S3_Label,255,255,255) guiLabelSetVerticalAlign(S3_Label,"top") guiLabelSetHorizontalAlign(S3_Label,"left",false) S4_label = guiCreateLabel(0.0506,0.7374,0.9101,0.0419,"We suggest to prevent this",true,Register_Window) guiLabelSetColor(S4_label,255,255,255) guiLabelSetVerticalAlign(S4_label,"top") guiLabelSetHorizontalAlign(S4_label,"left",false) S5_Label = guiCreateLabel(0.0506,0.7793,0.8708,0.067,"by signing up to the forums",true,Register_Window) guiLabelSetColor(S5_Label,255,255,255) guiLabelSetVerticalAlign(S5_Label,"top") guiLabelSetHorizontalAlign(S5_Label,"left",false) S6_Label = guiCreateLabel(0.0506,0.8212,0.9438,0.0391,"with the same username and",true,Register_Window) guiLabelSetColor(S6_Label,255,255,255) guiLabelSetVerticalAlign(S6_Label,"top") guiLabelSetHorizontalAlign(S6_Label,"left",false) S7_Label = guiCreateLabel(0.0506,0.8687,0.8989,0.0475,"If you forget your password",true,Register_Window) guiLabelSetColor(S7_Label,255,255,255) guiLabelSetVerticalAlign(S7_Label,"top") guiLabelSetHorizontalAlign(S7_Label,"left",false) S8_Label = guiCreateLabel(0.0393,0.9162,0.882,0.0559,"You will be able to retrive it",true,Register_Window) guiLabelSetColor(S8_Label,255,255,255) guiLabelSetVerticalAlign(S8_Label,"top") guiLabelSetHorizontalAlign(S8_Label,"left",false) end ) addEventHandler("onClientGUIClick",getRootElement(), function() if source == Login_button then -- Checks if the login button was clicked! local getUsernameField = guiGetText(Username_edit) -- Gets the username box data when clicking login! local getPasswordField = guiGetText(Password_edit) -- Gets the password box data when clicking login! if getUsernameField and getPasswordField then -- Checks if data was successfully recieved from the fields! triggerServerEvent("loginFromClient", getLocalPlayer(), getUsernameField, getPasswordField) -- Sent username and password data to serverside! end end if source == RegisterRegister_Button then -- Checks if the register button was clicked! local getUsernameField1 = guiGetText(RegisterUsername_edit) -- Gets the username box data when clicking register! local getPasswordField1 = guiGetText(RegisterPassword_edit) -- Gets the password box data when clicking register! if getUsernameField1 and getPasswordField1 then -- Checks if data was successfully recieved from the fields! triggerServerEvent("registerFromClient", getLocalPlayer(), getUsernameField1, getPasswordField1) -- Sent username and password data to serverside! guiSetVisible(Register_Window, false) guiSetVisible(chooseskin_window) true end end if source == Register_button then -- If the register button to show the window to register was clicked if guiGetVisible(Register_Window) == true then guiSetVisible(Register_Window, false) showCursor(true) elseif guiGetVisible(Register_Window) == false then guiSetVisible(Register_Window, true) showCursor(true) end end end ) function goRight(player) local newSkin = getElementModel (localPlayer) + 1 while not setElementModel (localPlayer,newSkin) do newSkin = newSkin + 1 end end function goLeft(player) local newSkin = getElementModel (localPlayer) - 1 while not setElementModel (localPlayer,newSkin) do newSkin = newSkin - 1 end end function SkinWindow_DoneButton if source == Done_button then guiSetVisible(chooseskin_window,false) showCursor(false) end addEvent("onClientLoginHide",true) addEventHandler("onClientLoginHide",getRootElement(), function() showCursor(false) guiSetVisible(Register_Window, false) guiSetVisible(Login_window, false) guiSetInputEnabled(false) end ) addEventHandler ( "onClientGUIClick",right,goRight, false ) addEventHandler ( "onClientGUIClick",done,Done_button, false ) addEventHandler ( "onClientGUIClick",left,goLeft, false ) Link to comment
Xeno Posted January 14, 2012 Share Posted January 14, 2012 Well its simple, all you need to do is use an onClientGUIClick on the register part that navigates to the skin selection Link to comment
codeluaeveryday Posted January 14, 2012 Share Posted January 14, 2012 Lol, he made the GUI only for Login. I basically scripted all the other stuff. The login and all. Link to comment
KraZ Posted January 14, 2012 Author Share Posted January 14, 2012 i know, i should really put your name somewhere for helping, well anyways xeno i have no idea on how to lua i did try looking at your login system to see if i could see how you did it i think ive spent like 3 hours trying to get this to work, so can one of you guys give me a live tutorial? or even a video? Link to comment
KraZ Posted January 14, 2012 Author Share Posted January 14, 2012 also i have created the gui for it, but all the gui has is a window and button, no place to select skins so how the heck do you get this to work? like how do you know which codes and stuff to put where? please help, im nearly crying thats how sad i am its so complicated and so hard, but when you understand its easy, so if you could just teach me or some sort plz Link to comment
Xeno Posted January 14, 2012 Share Posted January 14, 2012 Lol, he made the GUI only for Login. I basically scripted all the other stuff. The login and all. And? I use peoples scripts on here all the time, if you dont want people to use your scripts then DON'T post them. Kieron, an onClientGUIClick is like a trigger for what happens when the button is pressed, so if I did this: function thisIsYourGUIFunction() --create gui here-- addEventHandler("onClientGUIClick", buttonname, trigger) -- Get the button name and the function name. end function trigger() outputChatBox("hello") end That outposts into the chat box "Hello" when the button is pressed Link to comment
codeluaeveryday Posted January 14, 2012 Share Posted January 14, 2012 I can see you really want to learn LUA. Recreate the Skin Selection GUI. Make sure you add a gridlist. Then you will manually have to add every skin ID. Hopefully after that someone will help you. Link to comment
KraZ Posted January 14, 2012 Author Share Posted January 14, 2012 What?!#@#"$*! Ah Jeez, i dont mean to sound rude but i dont really like asking people to do stuff for me because i wont learn anything, i am greatfull for people helping me dont get me wrong but i do want to learn so i can do it my self. where can i find all the skin ID's? Link to comment
Xeno Posted January 14, 2012 Share Posted January 14, 2012 I did not do it for you. I'm just telling you how to make Button events. Anyway skin ids here: https://wiki.multitheftauto.com/wiki/Character_Skins Link to comment
KraZ Posted January 14, 2012 Author Share Posted January 14, 2012 Lol, he made the GUI only for Login. I basically scripted all the other stuff. The login and all. And? I use peoples scripts on here all the time, if you dont want people to use your scripts then DON'T post them. i think you got it wrong Xeno, i mean i created the GUI posted my gui and he scripted it for me Link to comment
KraZ Posted January 14, 2012 Author Share Posted January 14, 2012 I did not do it for you. I'm just telling you how to make Button events.Anyway skin ids here: https://wiki.multitheftauto.com/wiki/Character_Skins also i know i preffer you not to do it for me because i wont learn nothing and i want to learn lua, badly thanks for the link. when i create a gridlist, i have to create a colum but then i have to create a row, when i try to change the title of the row it doesnt change, any reason why not? Link to comment
Xeno Posted January 14, 2012 Share Posted January 14, 2012 Because its the collumn you need to change the name of: local column = guiGridListAddColumn( playerList, "NAMEHERE", 0.85 ) And if you want people to script it for you, I would suggest finding a scripter and paying him. Link to comment
KraZ Posted January 14, 2012 Author Share Posted January 14, 2012 but like i said i want to learn how to lua, if could could just teach me what all of local and stuff mean or something it would help loads. Link to comment
Castillo Posted January 14, 2012 Share Posted January 14, 2012 http://lua-users.org/wiki/LearningLua Link to comment
Xeno Posted January 14, 2012 Share Posted January 14, 2012 And if you post your script, I can fix it for you. Link to comment
KraZ Posted January 14, 2012 Author Share Posted January 14, 2012 Thanks for the support Xeno, Add me as a forums buddy Link to comment
Xeno Posted January 14, 2012 Share Posted January 14, 2012 No problem. And your added. 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