iPrestege Posted February 15, 2013 Posted February 15, 2013 You mean you want to make it with editbox ? or gridlist using table?
Shazzimal Posted February 15, 2013 Author Posted February 15, 2013 gridlist using table, so they can chose out of 10 skins or wathever
iPrestege Posted February 15, 2013 Posted February 15, 2013 gridlist using table, so they can chose out of 10 skins or wathever You can choose the skin you want set it but edit box will be better for you . U kunt kiezen voor de huid die u wilt instellen, maar edit box zal beter voor je.
Shazzimal Posted February 15, 2013 Author Posted February 15, 2013 what is editbox, don't translate, couse translations from english to dutch are rubbish.!
iPrestege Posted February 15, 2013 Posted February 15, 2013 Np . i mean box same when you try to login to the forum you can but the number you want i mean skin id .
iPrestege Posted February 15, 2013 Posted February 15, 2013 Learn For GUIEditor And You Will Know What I Mean .
Shazzimal Posted February 15, 2013 Author Posted February 15, 2013 Np . i mean box same when you try to login to the forum you can but the number you want i mean skin id . Ps. I mean this sentence is a bit strange!
iPrestege Posted February 15, 2013 Posted February 15, 2013 You beginner you have to learn a little about GUI and then begin programming .
Shazzimal Posted February 15, 2013 Author Posted February 15, 2013 got this as output from GUIEditor: GUIEditor = { gridlist = {}, button = {}, memo = {}, window = {}, } GUIEditor.window[1] = guiCreateWindow(387, 207, 243, 312, "Select a skin please", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.gridlist[1] = guiCreateGridList(9, 25, 135, 269, false, GUIEditor.window[1]) guiGridListAddColumn(GUIEditor.gridlist[1], "Skin-name", 0.9) for i = 1, 10 do guiGridListAddRow(GUIEditor.gridlist[1]) end guiGridListSetItemText(GUIEditor.gridlist[1], 0, 1, "CJ", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 1, 1, "Hooker", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 2, 1, "Firefighter", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 3, 1, "Gangster", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 4, 1, "School Girl", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 5, 1, "Ninja", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 6, 1, "Mafia", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 7, 1, "Farmer", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 8, 1, "Chicken", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 9, 1, "Elvis", false, false) GUIEditor.button[1] = guiCreateButton(153, 251, 77, 26, "Select", false, GUIEditor.window[1]) GUIEditor.memo[1] = guiCreateMemo(155, 66, 73, 127, "You can change the skin, when you login and when you die.", false, GUIEditor.window[1])
iPrestege Posted February 15, 2013 Posted February 15, 2013 == Client Side == GUIEditor = { gridlist = {}, button = {}, memo = {}, window = {}, } GUIEditor.window[1] = guiCreateWindow(387, 207, 243, 312, "Select a skin please", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.gridlist[1] = guiCreateGridList(9, 25, 135, 269, false, GUIEditor.window[1]) local Column = guiGridListAddColumn(GUIEditor.gridlist[1], "Skin Name", 0.4) local Column1 = guiGridListAddColumn(GUIEditor.gridlist[1], "id", 0.4) GUIEditor.button[1] = guiCreateButton(153, 251, 77, 26, "Select", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") GUIEditor.memo[1] = guiCreateMemo(155, 66, 73, 127, "You can change the skin, when you login and when you die.", false, GUIEditor.window[1]) Skins = { {"CJ",skinid}, {"Hooker",skinid}, {"Firefighter",skinid}, {"Gangster",skinid}, {"SchoolGirl",skinid}, {"Ninja",skinid}, {"Mafia",skinid}, {"Farmer",skinid}, {"Chicken",skinid}, {"Elvis",skinid} } for i,v in ipairs (Skins) do local row = guiGridListAddRow (GUIEditor.gridlist[1]) guiGridListSetItemText (GUIEditor.gridlist[1], row, 1, v[1], false, true) guiGridListSetItemText (GUIEditor.gridlist[1], row, 2, v[2], false, true) end addEventHandler("onClientGUIClick",root, function() if (source == GUIEditor.button[1]) then local row,Column = guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ) local id = tostring ( guiGridListGetItemText(GUIEditor.gridlist[1], row, 2 )) if ( row and Column and row ~= -1 and Column ~= -1 ) then triggerServerEvent("onChose", localPlayer, id) end end end ) == Server Side == addEvent("onChose", true) addEventHandler("onChose", root, function(id) setElementModel(source,tonumber(id)) end ) Has not been tested but should work!
Shazzimal Posted February 15, 2013 Author Posted February 15, 2013 but my script that should give all admins skin 286, doesn't work i tryed to change but always doesn't work: rootElement = getRootElement() function setAdminSkin() if hasObjectPermissionTo(thePlayer, "command.ban", false) then setElementModel(thePlayer, 286) outputChatBox("Welcome admin, your skin has been set to: Admin server skin.",thePlayer) end end addEvent("setAdminSkin", true) addEventHandler("onPlayerSpawn", rootElement, setAdminSkin) allready fixed, now going to try it.
BlueBerry Posted February 15, 2013 Posted February 15, 2013 This should work function setAdminSkin(thePlayer) if hasObjectPermissionTo(thePlayer, "command.ban", true) then setPlayerSkin(thePlayer, 286) outputChatBox("Welcome admin, your skin has been set to: Admin server skin.",thePlayer) end end
Shazzimal Posted February 15, 2013 Author Posted February 15, 2013 THANKS, i forgot thePlayer at the function and some other stuff
Shazzimal Posted February 15, 2013 Author Posted February 15, 2013 @Bluebarry Your script doesn't work. But doesn't matter.
iPrestege Posted February 15, 2013 Posted February 15, 2013 function setAdminSkin() if hasObjectPermissionTo(source, "command.ban", true) then setElementModel(source,268) outputChatBox("Welcome admin, your skin has been set to: Admin server skin.",source,255,0,0) end end
Shazzimal Posted February 15, 2013 Author Posted February 15, 2013 @Mr.Pres[T]ege The script doesn't show up a GUI. What i've got in the files: meta.xml <meta> <info author="Shazzimal" name="SkinChooser" disc="When you log on, you can select a skin, admin does automaticaly get skin ID286." Version="1.1"/> <script src="server.lua" type="server"/> <script src="gui.lua" type="client"/> </meta> gui.lua GUIEditor = { gridlist = {}, button = {}, memo = {}, window = {}, } GUIEditor.window[1] = guiCreateWindow(387, 207, 243, 312, "Select a skin please", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.gridlist[1] = guiCreateGridList(9, 25, 135, 269, false, GUIEditor.window[1]) local Column = guiGridListAddColumn(GUIEditor.gridlist[1], "Skin Name", 0.4) local Column1 = guiGridListAddColumn(GUIEditor.gridlist[1], "id", 0.4) GUIEditor.button[1] = guiCreateButton(153, 251, 77, 26, "Select", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") GUIEditor.memo[1] = guiCreateMemo(155, 66, 73, 127, "You can change the skin, when you login and when you die.", false, GUIEditor.window[1]) Skins = { {"CJ",0}, {"Hooker",178}, {"Firefighter",277}, {"Gangster",115}, {"SchoolGirl",152}, {"Ninja",204}, {"Mafia",166}, {"Farmer",161}, {"Chicken",167}, {"Elvis",82} } for i,v in ipairs (Skins) do local row = guiGridListAddRow (GUIEditor.gridlist[1]) guiGridListSetItemText (GUIEditor.gridlist[1], row, 1, v[1], false, true) guiGridListSetItemText (GUIEditor.gridlist[1], row, 2, v[2], false, true) end addEventHandler("onClientGUIClick",root, function() if (source == GUIEditor.button[1]) then local row,Column = guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ) local id = tostring ( guiGridListGetItemText(GUIEditor.gridlist[1], row, 2 )) if ( row and Column and row ~= -1 and Column ~= -1 ) then triggerServerEvent("onPlayerLogin", localPlayer, id) end end end ) server.lua addEvent("onPlayerLogin", true) addEventHandler("onPlayerLogin", root, function(id) setElementModel(source,tonumber(id)) end ) It does show up a GUI but when i select one and click the select button, nothing happens. And i must first pres t, so i get a cursor, and then i can select things. But doesn't work.
iPrestege Posted February 15, 2013 Posted February 15, 2013 == Client Side == GUIEditor = { gridlist = {}, button = {}, memo = {}, window = {}, } GUIEditor.window[1] = guiCreateWindow(387, 207, 243, 312, "Select a skin please", false) guiSetVisible(GUIEditor.window[1], false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.gridlist[1] = guiCreateGridList(9, 25, 135, 269, false, GUIEditor.window[1]) local Column = guiGridListAddColumn(GUIEditor.gridlist[1], "Skin Name", 0.4) local Column1 = guiGridListAddColumn(GUIEditor.gridlist[1], "id", 0.4) GUIEditor.button[1] = guiCreateButton(153, 251, 77, 26, "Select", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") GUIEditor.memo[1] = guiCreateMemo(155, 66, 73, 127, "You can change the skin, when you login and when you die.", false, GUIEditor.window[1]) Skins = { {"CJ",0}, {"Hooker",178}, {"Firefighter",277}, {"Gangster",115}, {"SchoolGirl",152}, {"Ninja",204}, {"Mafia",166}, {"Farmer",161}, {"Chicken",167}, {"Elvis",82} } for i,v in ipairs (Skins) do local row = guiGridListAddRow (GUIEditor.gridlist[1]) guiGridListSetItemText (GUIEditor.gridlist[1], row, 1, v[1], false, true) guiGridListSetItemText (GUIEditor.gridlist[1], row, 2, v[2], false, true) end addEventHandler("onClientGUIClick",root, function() if (source == GUIEditor.button[1]) then local row,Column = guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ) local id = tostring ( guiGridListGetItemText(GUIEditor.gridlist[1], row, 2 )) if ( row and Column and row ~= -1 and Column ~= -1 ) then triggerServerEvent("onClick", localPlayer, id) end end end ) addEvent("show",true) addEventHandler("show",root, function () guiSetVisible(GUIEditor.window[1], true) showCursor(true) end) == Server Side == addEvent("onClick", true) addEventHandler("onClick", root, function(id) setElementModel(source,tonumber(id)) end ) addEventHandler("onPlayerLogin", root, function () triggerClientEvent("show",root) end) Login To The Server And The GUI Will Start .
Shazzimal Posted February 15, 2013 Author Posted February 15, 2013 Okk, i am going to test it tomorow.
iPrestege Posted February 15, 2013 Posted February 15, 2013 Ok No Problem But i test it and it works .
Shazzimal Posted February 16, 2013 Author Posted February 16, 2013 It works, i am now going to add some things and it's ready. THANKS
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