KraZ Posted January 13, 2012 Share Posted January 13, 2012 hey, im new to lua scripting and i was wondering if you guys could help me out, by creating the rest of my script and tell me how you did it and what does what so i can learn myself. This is my scripit, i want to be able to bind it to the F9 key so i can close and open it, and also i want it so it will pop up everytime you log in, if anyone could help me and link me to a few tutorials (Don't do complicated ones, because most of the scripting tutorials ive seen are hard to follow. function welcomegui GUIEditor_Window = {} GUIEditor_TabPanel = {} GUIEditor_Tab = {} GUIEditor_Memo = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(78,70,642,498,"",false) GUIEditor_Image[1] = guiCreateStaticImage(0.2555,0.0462,0.4782,0.2369,"images/KraZWorld.png",true,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(0.0187,0.2671,0.9626,0.253,"KraZ'World is a MTA:SA Roleplay server based on the real world. We aim to create a laidback server fun for everyone with tons of jobs and activites throughout. We noticed that most RPG server admins were being a bit rough on their players and not playing their role as admin. When we choose staff we only pick the people who are serious but also give chance. This roleplay server is owned by [staff]KraZ and no one else you can find the staff members and other information below.\n\nWebsite & Forums:: [url=http://www.KraZKraft.co.uk]www.KraZKraft.co.uk[/url]",true,GUIEditor_Window[1]) GUIEditor_TabPanel[1] = guiCreateTabPanel(0.0187,0.5422,0.9626,0.4257,true,GUIEditor_Window[1]) GUIEditor_Tab[1] = guiCreateTab("Commands:",GUIEditor_TabPanel[1]) GUIEditor_Memo[2] = guiCreateMemo(0.0065,0.0372,0.9871,0.9415,"Commands are features you can access in-game to give to easier access to items/cars/objects.\nYou can also use commands for fun features which will be listed below. Commands can be used by going to your chatbox (T - Deafult) and typing the commands like so: (Say:/Commandname) then by pressing enter.\nCommands availible:\n/reconnect\n\n[More commands will be added soon]",true,GUIEditor_Tab[1]) GUIEditor_Tab[2] = guiCreateTab("Rules:",GUIEditor_TabPanel[1]) GUIEditor_Memo[3] = guiCreateMemo(0.0065,0.0319,0.9871,0.9468,"Rules are Rules, All rules must be followed or you can face up to a month in ban or jail time. You can appeal permanent bans on the forums.\n\n1. - No Deathmatching (Deathmatching is allowed to a certain extent for example if you are a police officer going for somone wanted or if you'r a criminal and you want to go turf wars, We do allow some deathmatching but not always depends which staff member you get when the report is filed\nJail time for this offence: 800 minutes)\n\n2. - No Bug Abuse/Mods/Cheats (Using cheats or mods or abusing a bug are a serious offence on KraZ'World and you can get up to a month ban for using them, We do allow some mods like: e.g car mods, Skin mods, Jail time for this offence: MONTH BAN)\n\n3. - Listen To Staff Members (Staff members are located with the [staff] Tag, Listen to these people and do not ignore them, Jail time for this offence: 500 minutes)\n\n4. - Use /local chat before using Global, (Don't go abusing globalchat, use /local chat first\nJail time for this offence: 100 minutes)\n\n5. - Do not abuse the /support chat (/Support chat is only if you need support please no advertising or general conversation. Jail time for this offence: 200 minutes)\n\n6. - No Spamming Chat (Do not spam chat with the same sentance or advertising of anykind,\n Jail time for this offence: 300 minutes\n",true,GUIEditor_Tab[2]) GUIEditor_Tab[3] = guiCreateTab("Getting Started:",GUIEditor_TabPanel[1]) GUIEditor_Memo[4] = guiCreateMemo(0.0049,0.0213,0.9887,0.9574,"Okay, This tab is like a tutorial for new beginners, First off you'r going to want to get a job to earn some money, Do this by walking into a red marker, Pick a skin and accept the job, For this example i will post some jobs below,\n\nBus Driving - \nYou can get this job by going to unity station in Los Santos and picking the skin required for that job, Then you will need to get in a bus by entering a yellow marker and then drive to the bus stops, Simple.\n\nPolice/Medic - \nYou can get this job by going into the Red marker at a police station or hospital, pick the skin required get a car/ambulance then drive off and look for wanted players/low health players.\n\nPilot - \nGo to any airport except for the Abandoned one in Las Venturas, Go into the Red Marker and pick the skin required for the job, get in a plane by entering a yellow marker, and do your job as a pilot.\n\nJobs can be located by pressing F11 and looking for the job marker on the minimap (Jobs are Yellow blips on the minimap and the Large map)\n\n",true,GUIEditor_Tab[3]) GUIEditor_Tab[4] = guiCreateTab("Support:",GUIEditor_TabPanel[1]) GUIEditor_Memo[5] = guiCreateMemo(0.0049,0.0213,0.9903,0.9574,"If you need support its fairly simple just follow the instructions below:\n\nIf you need support fast, type this command into the chatbox - /Support yourmessagehere\n\nIf you need support but on something a staff member can help on go to the website and forums and post in the Support category of the forum.\n\nIf you need help on any other category ask some players of KraZ'World,",true,GUIEditor_Tab[4]) GUIEditor_Tab[5] = guiCreateTab("Staff Members:",GUIEditor_TabPanel[1]) GUIEditor_Memo[6] = guiCreateMemo(0.0049,0.016,0.9903,0.266,"There are 3 types of staff members: The following ranks and staff members are \nModerators, SuperModerators, Admins Below in the next box:",true,GUIEditor_Tab[5]) GUIEditor_Memo[7] = guiCreateMemo(0.0049,0.2819,0.9903,0.6755,"KraZ - [Admin] Dylan - [Admin] Taran - [Admin]\n\n\n",true,GUIEditor_Tab[5]) GUIEditor_Tab[6] = guiCreateTab("Donation Information:",GUIEditor_TabPanel[1]) GUIEditor_Memo[8] = guiCreateMemo(0.0049,0.0266,0.9903,0.9521,"Donating helps the server pay for fees and more, therfore you will recive more privlages than most players, you can donate by visiting the website and forums and clicking the donate button there.\n\n[NOTE]: To get the privlages you want you must donate over 7.50 British Pounds Sterlin.\n\nDonating helps us alot, feel free to help us out by donating after you have donating 7.50, If you donate over a certain ammount we will decide if you should be ranked as [staff]\n\n",true,GUIEditor_Tab[6]) guiSetVisible(GUIEditor_Window[1],true) end Thanks, if i dont reply email me at: [email protected] Link to comment
Kenix Posted January 13, 2012 Share Posted January 13, 2012 (edited) function welcomegui( ) GUIEditor_Window = {} GUIEditor_TabPanel = {} GUIEditor_Tab = {} GUIEditor_Memo = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(78,70,642,498,"",false) GUIEditor_Image[1] = guiCreateStaticImage(0.2555,0.0462,0.4782,0.2369,"images/KraZWorld.png",true,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(0.0187,0.2671,0.9626,0.253,"KraZ'World is a MTA:SA Roleplay server based on the real world. We aim to create a laidback server fun for everyone with tons of jobs and activites throughout. We noticed that most RPG server admins were being a bit rough on their players and not playing their role as admin. When we choose staff we only pick the people who are serious but also give chance. This roleplay server is owned by [staff]KraZ and no one else you can find the staff members and other information below.\n\nWebsite & Forums:: [url=http://www.KraZKraft.co.uk]http://www.KraZKraft.co.uk[/url]",true,GUIEditor_Window[1]) GUIEditor_TabPanel[1] = guiCreateTabPanel(0.0187,0.5422,0.9626,0.4257,true,GUIEditor_Window[1]) GUIEditor_Tab[1] = guiCreateTab("Commands:",GUIEditor_TabPanel[1]) GUIEditor_Memo[2] = guiCreateMemo(0.0065,0.0372,0.9871,0.9415,"Commands are features you can access in-game to give to easier access to items/cars/objects.\nYou can also use commands for fun features which will be listed below. Commands can be used by going to your chatbox (T - Deafult) and typing the commands like so: (Say:/Commandname) then by pressing enter.\nCommands availible:\n/reconnect\n\n[More commands will be added soon]",true,GUIEditor_Tab[1]) GUIEditor_Tab[2] = guiCreateTab("Rules:",GUIEditor_TabPanel[1]) GUIEditor_Memo[3] = guiCreateMemo(0.0065,0.0319,0.9871,0.9468,"Rules are Rules, All rules must be followed or you can face up to a month in ban or jail time. You can appeal permanent bans on the forums.\n\n1. - No Deathmatching (Deathmatching is allowed to a certain extent for example if you are a police officer going for somone wanted or if you'r a criminal and you want to go turf wars, We do allow some deathmatching but not always depends which staff member you get when the report is filed\nJail time for this offence: 800 minutes)\n\n2. - No Bug Abuse/Mods/Cheats (Using cheats or mods or abusing a bug are a serious offence on KraZ'World and you can get up to a month ban for using them, We do allow some mods like: e.g car mods, Skin mods, Jail time for this offence: MONTH BAN)\n\n3. - Listen To Staff Members (Staff members are located with the [staff] Tag, Listen to these people and do not ignore them, Jail time for this offence: 500 minutes)\n\n4. - Use /local chat before using Global, (Don't go abusing globalchat, use /local chat first\nJail time for this offence: 100 minutes)\n\n5. - Do not abuse the /support chat (/Support chat is only if you need support please no advertising or general conversation. Jail time for this offence: 200 minutes)\n\n6. - No Spamming Chat (Do not spam chat with the same sentance or advertising of anykind,\n Jail time for this offence: 300 minutes\n",true,GUIEditor_Tab[2]) GUIEditor_Tab[3] = guiCreateTab("Getting Started:",GUIEditor_TabPanel[1]) GUIEditor_Memo[4] = guiCreateMemo(0.0049,0.0213,0.9887,0.9574,"Okay, This tab is like a tutorial for new beginners, First off you'r going to want to get a job to earn some money, Do this by walking into a red marker, Pick a skin and accept the job, For this example i will post some jobs below,\n\nBus Driving - \nYou can get this job by going to unity station in Los Santos and picking the skin required for that job, Then you will need to get in a bus by entering a yellow marker and then drive to the bus stops, Simple.\n\nPolice/Medic - \nYou can get this job by going into the Red marker at a police station or hospital, pick the skin required get a car/ambulance then drive off and look for wanted players/low health players.\n\nPilot - \nGo to any airport except for the Abandoned one in Las Venturas, Go into the Red Marker and pick the skin required for the job, get in a plane by entering a yellow marker, and do your job as a pilot.\n\nJobs can be located by pressing F11 and looking for the job marker on the minimap (Jobs are Yellow blips on the minimap and the Large map)\n\n",true,GUIEditor_Tab[3]) GUIEditor_Tab[4] = guiCreateTab("Support:",GUIEditor_TabPanel[1]) GUIEditor_Memo[5] = guiCreateMemo(0.0049,0.0213,0.9903,0.9574,"If you need support its fairly simple just follow the instructions below:\n\nIf you need support fast, type this command into the chatbox - /Support yourmessagehere\n\nIf you need support but on something a staff member can help on go to the website and forums and post in the Support category of the forum.\n\nIf you need help on any other category ask some players of KraZ'World,",true,GUIEditor_Tab[4]) GUIEditor_Tab[5] = guiCreateTab("Staff Members:",GUIEditor_TabPanel[1]) GUIEditor_Memo[6] = guiCreateMemo(0.0049,0.016,0.9903,0.266,"There are 3 types of staff members: The following ranks and staff members are \nModerators, SuperModerators, Admins Below in the next box:",true,GUIEditor_Tab[5]) GUIEditor_Memo[7] = guiCreateMemo(0.0049,0.2819,0.9903,0.6755,"KraZ - [Admin] Dylan - [Admin] Taran - [Admin]\n\n\n",true,GUIEditor_Tab[5]) GUIEditor_Tab[6] = guiCreateTab("Donation Information:",GUIEditor_TabPanel[1]) GUIEditor_Memo[8] = guiCreateMemo(0.0049,0.0266,0.9903,0.9521,"Donating helps the server pay for fees and more, therfore you will recive more privlages than most players, you can donate by visiting the website and forums and clicking the donate button there.\n\n[NOTE]: To get the privlages you want you must donate over 7.50 British Pounds Sterlin.\n\nDonating helps us alot, feel free to help us out by donating after you have donating 7.50, If you donate over a certain ammount we will decide if you should be ranked as [staff]\n\n",true,GUIEditor_Tab[6]) guiSetVisible( GUIEditor_Window[1],false ) end bindKey( "F9","down", function( ) if guiGetVisible( GUIEditor_Window[1] ) then guiSetVisible( GUIEditor_Window[1],false ) else guiSetVisible( GUIEditor_Window[1],true ) end end ) welcomegui( ) https://wiki.multitheftauto.com/wiki/Scr ... troduction https://wiki.multitheftauto.com/wiki/Int ... ng_the_GUI Edited January 13, 2012 by Guest Link to comment
KraZ Posted January 13, 2012 Author Share Posted January 13, 2012 it doesnt seem to work is my meta correct? "KraZ" name="WelcomeGui" version="1.0.0" type="script"/> Link to comment
mjau Posted January 13, 2012 Share Posted January 13, 2012 when inganme testing it do /debugscript 3 and tell us the errors you get... Link to comment
Klesh Posted January 13, 2012 Share Posted January 13, 2012 Next time set your gui variable, its more easier to find errosr if you have them. Gui scripts always are client side. Ps: Any error on debug? Link to comment
codeluaeveryday Posted January 13, 2012 Share Posted January 13, 2012 Working: GUIEditor_Window = {} GUIEditor_TabPanel = {} GUIEditor_Tab = {} GUIEditor_Memo = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(78,70,642,498,"",false) guiSetVisible( GUIEditor_Window[1],false ) showCursor(false) GUIEditor_Image[1] = guiCreateStaticImage(0.2555,0.0462,0.4782,0.2369,"images/KraZWorld.png",true,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(0.0187,0.2671,0.9626,0.253,"KraZ'World is a MTA:SA Roleplay server based on the real world. We aim to create a laidback server fun for everyone with tons of jobs and activites throughout. We noticed that most RPG server admins were being a bit rough on their players and not playing their role as admin. When we choose staff we only pick the people who are serious but also give chance. This roleplay server is owned by [staff]KraZ and no one else you can find the staff members and other information below.\n\nWebsite & Forums:: [url=http://www.KraZKraft.co.uk]http://www.KraZKraft.co.uk[/url]",true,GUIEditor_Window[1]) GUIEditor_TabPanel[1] = guiCreateTabPanel(0.0187,0.5422,0.9626,0.4257,true,GUIEditor_Window[1]) GUIEditor_Tab[1] = guiCreateTab("Commands:",GUIEditor_TabPanel[1]) GUIEditor_Memo[2] = guiCreateMemo(0.0065,0.0372,0.9871,0.9415,"Commands are features you can access in-game to give to easier access to items/cars/objects.\nYou can also use commands for fun features which will be listed below. Commands can be used by going to your chatbox (T - Deafult) and typing the commands like so: (Say:/Commandname) then by pressing enter.\nCommands availible:\n/reconnect\n\n[More commands will be added soon]",true,GUIEditor_Tab[1]) GUIEditor_Tab[2] = guiCreateTab("Rules:",GUIEditor_TabPanel[1]) GUIEditor_Memo[3] = guiCreateMemo(0.0065,0.0319,0.9871,0.9468,"Rules are Rules, All rules must be followed or you can face up to a month in ban or jail time. You can appeal permanent bans on the forums.\n\n1. - No Deathmatching (Deathmatching is allowed to a certain extent for example if you are a police officer going for somone wanted or if you'r a criminal and you want to go turf wars, We do allow some deathmatching but not always depends which staff member you get when the report is filed\nJail time for this offence: 800 minutes)\n\n2. - No Bug Abuse/Mods/Cheats (Using cheats or mods or abusing a bug are a serious offence on KraZ'World and you can get up to a month ban for using them, We do allow some mods like: e.g car mods, Skin mods, Jail time for this offence: MONTH BAN)\n\n3. - Listen To Staff Members (Staff members are located with the [staff] Tag, Listen to these people and do not ignore them, Jail time for this offence: 500 minutes)\n\n4. - Use /local chat before using Global, (Don't go abusing globalchat, use /local chat first\nJail time for this offence: 100 minutes)\n\n5. - Do not abuse the /support chat (/Support chat is only if you need support please no advertising or general conversation. Jail time for this offence: 200 minutes)\n\n6. - No Spamming Chat (Do not spam chat with the same sentance or advertising of anykind,\n Jail time for this offence: 300 minutes\n",true,GUIEditor_Tab[2]) GUIEditor_Tab[3] = guiCreateTab("Getting Started:",GUIEditor_TabPanel[1]) GUIEditor_Memo[4] = guiCreateMemo(0.0049,0.0213,0.9887,0.9574,"Okay, This tab is like a tutorial for new beginners, First off you'r going to want to get a job to earn some money, Do this by walking into a red marker, Pick a skin and accept the job, For this example i will post some jobs below,\n\nBus Driving - \nYou can get this job by going to unity station in Los Santos and picking the skin required for that job, Then you will need to get in a bus by entering a yellow marker and then drive to the bus stops, Simple.\n\nPolice/Medic - \nYou can get this job by going into the Red marker at a police station or hospital, pick the skin required get a car/ambulance then drive off and look for wanted players/low health players.\n\nPilot - \nGo to any airport except for the Abandoned one in Las Venturas, Go into the Red Marker and pick the skin required for the job, get in a plane by entering a yellow marker, and do your job as a pilot.\n\nJobs can be located by pressing F11 and looking for the job marker on the minimap (Jobs are Yellow blips on the minimap and the Large map)\n\n",true,GUIEditor_Tab[3]) GUIEditor_Tab[4] = guiCreateTab("Support:",GUIEditor_TabPanel[1]) GUIEditor_Memo[5] = guiCreateMemo(0.0049,0.0213,0.9903,0.9574,"If you need support its fairly simple just follow the instructions below:\n\nIf you need support fast, type this command into the chatbox - /Support yourmessagehere\n\nIf you need support but on something a staff member can help on go to the website and forums and post in the Support category of the forum.\n\nIf you need help on any other category ask some players of KraZ'World,",true,GUIEditor_Tab[4]) GUIEditor_Tab[5] = guiCreateTab("Staff Members:",GUIEditor_TabPanel[1]) GUIEditor_Memo[6] = guiCreateMemo(0.0049,0.016,0.9903,0.266,"There are 3 types of staff members: The following ranks and staff members are \nModerators, SuperModerators, Admins Below in the next box:",true,GUIEditor_Tab[5]) GUIEditor_Memo[7] = guiCreateMemo(0.0049,0.2819,0.9903,0.6755,"KraZ - [Admin] Dylan - [Admin] Taran - [Admin]\n\n\n",true,GUIEditor_Tab[5]) GUIEditor_Tab[6] = guiCreateTab("Donation Information:",GUIEditor_TabPanel[1]) GUIEditor_Memo[8] = guiCreateMemo(0.0049,0.0266,0.9903,0.9521,"Donating helps the server pay for fees and more, therfore you will recive more privlages than most players, you can donate by visiting the website and forums and clicking the donate button there.\n\n[NOTE]: To get the privlages you want you must donate over 7.50 British Pounds Sterlin.\n\nDonating helps us alot, feel free to help us out by donating after you have donating 7.50, If you donate over a certain ammount we will decide if you should be ranked as [staff]\n\n",true,GUIEditor_Tab[6]) bindKey("F9","down", function() if guiGetVisible(GUIEditor_Window[1]) == true then guiSetVisible(GUIEditor_Window[1], false) showCursor(false) elseif guiGetVisible(GUIEditor_Window[1]) == false then guiSetVisible(GUIEditor_Window[1], true) showCursor(true) end end ) Also make sure you stop helpmanager from getting in the way Link to comment
codeluaeveryday Posted January 13, 2012 Share Posted January 13, 2012 I updated code I beat kenix to a working script lol... Also kenix's script he replied with doesnt set a cursor. Just use mine lol. His time: Last edited by Kenix on Sat Jan 14, 2012 3:38 am, edited 1 time in total. My time: by csmit195 on Sat Jan 14, 2012 3:35 am Link to comment
Kenix Posted January 13, 2012 Share Posted January 13, 2012 This code is same you just create outside function and create a cursor ( and check window showing ). He can create it. P.S If you need show code you need use tabulation otherwise user can't understand your code. Link to comment
codeluaeveryday Posted January 13, 2012 Share Posted January 13, 2012 Ok good point... Ill have to force that as a habit. thanks for the idea. And your first code was bugged, now u fixed it. Link to comment
KraZ Posted January 13, 2012 Author Share Posted January 13, 2012 im sick and tired of lazy and hard admins on Roleplay servers, and you both clearly understand lua scripting, i only understand bits but if you want we could work on a roleplay server? i could do all the graphics. trailers and website and you guys could work on scripts? what you say? Link to comment
KraZ Posted January 13, 2012 Author Share Posted January 13, 2012 I just cant do what you guys do, anyone you can give me a presonal tutorial? like screen share and talk the same time? look i have followed the instructions on how to make a login screen but i tried making the login screen myself in guieditor, and i have no idea how to get it to start on server join, and how to link the edit boxes with the /login username password command, HELP ME! And please put down any SIMPLE tutorials that may help a beginner. heres my gui with no added commands or events. addEventHandler("onClientResourceStart",resourceRoot, function() GUIEditor_Memo = {} Login_window = guiCreateWindow(191,106,422,357,"Login/Register",false) 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) 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) 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) 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 ) Link to comment
codeluaeveryday Posted January 14, 2012 Share Posted January 14, 2012 You really need to learn LUA. This should help you. I finished your script. I can see your new. Your resource will need admin rights in the ACL! Client: addEventHandler("onClientResourceStart",resourceRoot, 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! 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 ) addEvent("onClientLoginHide",true) addEventHandler("onClientLoginHide",getRootElement(), function() showCursor(false) guiSetVisible(Register_Window, false) guiSetVisible(Login_window, false) guiSetInputEnabled(false) end ) Server: addEvent("loginFromClient",true) -- Adds the event to be triggered! addEventHandler("loginFromClient",getRootElement(), -- When the event is triggered, this function will also be triggered! function(user,pass) -- Received user and pass data! local account = getAccount ( user, pass ) if account then -- Checks if login returned true, or is accepted! local isLoginAccepted = logIn(source, account, pass) -- Adds a variable to login! if isLoginAccepted then outputChatBox("You have successfully logged into "..user.."'s account!",source, 0,255,0,true) -- Outputs a success message if the player logged in! triggerClientEvent ("onClientLoginHide", getRootElement()) end else outputChatBox(user.."'s account does not exist! Please register!",source, 200,20,0,true) -- Outputs a fail message! end end ) addEvent("registerFromClient",true) -- Adds the event to be triggered! addEventHandler("registerFromClient",getRootElement(), -- When the event is triggered, this function will also be triggered! function(user1,pass1) -- Received user and pass data from the register GUI! local account1 = getAccount ( user1, pass1 ) local isRegisterAccepted = addAccount(user1,pass1) -- Adds a variable to addAccount! if isRegisterAccepted then -- Checks if addAccount returned true, or is accepted! outputChatBox("You have successfully registered "..user1.."'s account!",source, 0,255,0,true) -- Outputs a success message if the player registered! else -- If it failed, the account is already registered! outputChatBox(user1.."'s account already exists!",source, 200,20,0,true) -- Outputs a fail message! end end ) 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