-
Posts
92 -
Joined
-
Last visited
Everything posted by Shazzimal
-
A bit late, it's almost fixed.
-
the gui for players only
-
I tried to add something, so the gui does only showup on a non-admin player. It doesn't work, i tried to add this function: hasObjectPermissionTo on this: addEvent("show",true) addEventHandler("show",root, function () guiSetVisible(GUIEditor.window[1], true) showCursor(true) end) How must i get it to work.
-
when they login and when they die, so i must add a EventHandler, isn't it?
-
But this still not work? 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
-
Thanks, it worked!!!
-
@Mr.Pres[T]ege The script works well, i added something, so when you click te select button, the window will also get away. Now i added a 2nd button, when you click on it, it will preview the skin, this is the new code. ===Server-side=== addEvent("onClick", true) addEventHandler("onClick", root, function(id) setElementModel(source,tonumber(id)) end ) addEvent("onClick[2]", true) addEventHandler("onClick[2]", root, function(id) setElementModel(source,tonumber(id)) end ) addEventHandler("onPlayerLogin", root, function () triggerClientEvent(source,"show",root) end) addEventHandler("onPlayerWasted", root, function () triggerClientEvent(source,"show",root) end) ===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[2] = guiCreateButton(156, 31, 77, 26, "Preview", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA") 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[2]",root, function() if (source == GUIEditor.button[2]) 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[2]", localPlayer, id) end end 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) guiSetVisible(GUIEditor.window[1], false) showCursor(false) end end end ) addEvent("show",true) addEventHandler("show",root, function () guiSetVisible(GUIEditor.window[1], true) showCursor(true) end) But now when i click the "preview" button, nothing will happen, how can i fix this?
-
Can you post server- and client side?
-
It works, i am now going to add some things and it's ready. THANKS
-
Okk, i am going to test it tomorow.
-
@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.
-
@Bluebarry Your script doesn't work. But doesn't matter.
-
THANKS, i forgot thePlayer at the function and some other stuff
-
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.
-
Ok, going to test
-
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])
-
Ps. I mean this sentence is a bit strange!
-
No, the script won't work if you tupe the command again. Couse of that "else" you must add a new event with command
-
ok, i am going to do that
-
i dont really understand you!
-
what is editbox, don't translate, couse translations from english to dutch are rubbish.!
-
gridlist using table, so they can chose out of 10 skins or wathever