THE DARK KING Posted June 15, 2013 Share Posted June 15, 2013 Hi, I have this code: GUIEditor = { button = {}, window = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(0.15, 0.14, 0.69, 0.80, "Give_Panel_DayZ", true) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.button[1] = guiCreateButton(0.02, 0.06, 0.11, 0.09, "Milk", true, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(0.02, 0.17, 0.11, 0.09, "Engine", true, GUIEditor.window[1]) GUIEditor.button[3] = guiCreateButton(0.02, 0.28, 0.11, 0.09, "Tire", true, GUIEditor.window[1]) GUIEditor.button[4] = guiCreateButton(0.02, 0.39, 0.11, 0.09, "Pizza", true, GUIEditor.window[1]) end ) Now as you may have noticed there are 4 buttons, I would like to practice that at the click of the button "Milk" I do this: setElementData(getPlayerFromName ("NAMEPLAYER"), "Milk", 1) At the click of the "Engine": setElementData(getPlayerFromName ("NAMEPLAYER"), "Engine", 1) And so on ... But we need a panel to the left of where you can select the name of the player, so it enter directly in the code: setElementData (getPlayerFromName (" NAMEPLAYER[/ color]"), "Milk", 1) Could you help me with that? I'd be really grateful. thanks P.S: sorry for my bad english, beacause i'm not english. Link to comment
mcer Posted June 15, 2013 Share Posted June 15, 2013 What do u need?, I understand u want to change the nick of an user. Link to comment
THE DARK KING Posted June 15, 2013 Author Share Posted June 15, 2013 No... Can you scripting? Link to comment
iPrestege Posted June 15, 2013 Share Posted June 15, 2013 No... Can you scripting? You want to get the player name with a hex color code? Link to comment
THE DARK KING Posted June 15, 2013 Author Share Posted June 15, 2013 i want to take the name of a player through a left side panel, and once selected using one of the buttons mentioned before with their respective functions. Type: setElementData (getPlayerFromName ("NAMEPLAYER"), "Engine", 1) where engine is an object present in DayZ and 1 is the quantity Link to comment
mcer Posted June 15, 2013 Share Posted June 15, 2013 Like this? Button (Action code) addEventHandler ("onClientGUIClick", getRootElement(), function () if ( source == GUIEditor.button[1]) then setElementData(getPlayerFromName ("NAMEPLAYER"), "Milk", 1) end end ) GUIEditor.button[1] Link to comment
mcer Posted June 15, 2013 Share Posted June 15, 2013 If u speak spanish, I can read it too. Link to comment
THE DARK KING Posted June 15, 2013 Author Share Posted June 15, 2013 Is exact, but can you add a side panel from which to take the names of the players online? So to automatically add the name of the player instead of NAMEPLAYER I'm italian Link to comment
mcer Posted June 15, 2013 Share Posted June 15, 2013 U want a new GUI with the Nametag of all players replacing "Nameplayer" text? Link to comment
mcer Posted June 15, 2013 Share Posted June 15, 2013 Create the gui and i going to make the code. Link to comment
THE DARK KING Posted June 15, 2013 Author Share Posted June 15, 2013 ok: GUIEditor = { gridlist = {}, window = {}, button = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(0.15, 0.14, 0.69, 0.80, "Give_Panel_DayZ", true) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.button[1] = guiCreateButton(0.87, 0.06, 0.11, 0.09, "Milk", true, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(0.87, 0.17, 0.11, 0.09, "Engine", true, GUIEditor.window[1]) GUIEditor.button[3] = guiCreateButton(0.87, 0.28, 0.11, 0.09, "Tire", true, GUIEditor.window[1]) GUIEditor.button[4] = guiCreateButton(0.88, 0.39, 0.11, 0.09, "Pizza", true, GUIEditor.window[1]) GUIEditor.gridlist[1] = guiCreateGridList(0.03, 0.07, 0.45, 0.91, true, GUIEditor.window[1]) guiGridListAddColumn(GUIEditor.gridlist[1], "Player_Name", 0.9) guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], 0, 1, "ExampleName", false, false) end ) Link to comment
mcer Posted June 15, 2013 Share Posted June 15, 2013 ok:GUIEditor = { gridlist = {}, window = {}, button = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(0.15, 0.14, 0.69, 0.80, "Give_Panel_DayZ", true) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.button[1] = guiCreateButton(0.87, 0.06, 0.11, 0.09, "Milk", true, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(0.87, 0.17, 0.11, 0.09, "Engine", true, GUIEditor.window[1]) GUIEditor.button[3] = guiCreateButton(0.87, 0.28, 0.11, 0.09, "Tire", true, GUIEditor.window[1]) GUIEditor.button[4] = guiCreateButton(0.88, 0.39, 0.11, 0.09, "Pizza", true, GUIEditor.window[1]) GUIEditor.gridlist[1] = guiCreateGridList(0.03, 0.07, 0.45, 0.91, true, GUIEditor.window[1]) guiGridListAddColumn(GUIEditor.gridlist[1], "Player_Name", 0.9) guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], 0, 1, "ExampleName", false, false) end ) Ok i PM u when i finish, Link to comment
THE DARK KING Posted June 15, 2013 Author Share Posted June 15, 2013 Ok, This is the complete gui: GUIEditor = { gridlist = {}, window = {}, button = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(0.15, 0.14, 0.69, 0.80, "Give_Panel_DayZ", true) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.button[1] = guiCreateButton(0.87, 0.06, 0.11, 0.09, "Milk", true, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(0.87, 0.17, 0.11, 0.09, "Engine", true, GUIEditor.window[1]) GUIEditor.button[3] = guiCreateButton(0.87, 0.28, 0.11, 0.09, "Tire", true, GUIEditor.window[1]) GUIEditor.button[4] = guiCreateButton(0.88, 0.39, 0.11, 0.09, "Pizza", true, GUIEditor.window[1]) GUIEditor.gridlist[1] = guiCreateGridList(0.03, 0.07, 0.45, 0.91, true, GUIEditor.window[1]) guiGridListAddColumn(GUIEditor.gridlist[1], "Player_Name", 0.9) guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], 0, 1, "ExampleName", false, false) end ) addEventHandler ("onClientGUIClick", getRootElement(), function () if ( source == GUIEditor.button[1]) then setElementData(getPlayerFromName ("THE_DARK_KING"), "Milk", 1) end end ) addEventHandler ("onClientGUIClick", getRootElement(), function () if ( source == GUIEditor.button[2]) then setElementData(getPlayerFromName ("THE_DARK_KING"), "Engine", 1) end end ) addEventHandler ("onClientGUIClick", getRootElement(), function () if ( source == GUIEditor.button[3]) then setElementData(getPlayerFromName ("THE_DARK_KING"), "Tire", 1) end end ) addEventHandler ("onClientGUIClick", getRootElement(), function () if ( source == GUIEditor.button[4]) then setElementData(getPlayerFromName ("THE_DARK_KING"), "Pizza", 1) end end ) you can do that only admins can use it by typing in chat / give? Link to comment
mcer Posted June 15, 2013 Share Posted June 15, 2013 Ok, This is the complete gui: GUIEditor = { gridlist = {}, window = {}, button = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(0.15, 0.14, 0.69, 0.80, "Give_Panel_DayZ", true) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.button[1] = guiCreateButton(0.87, 0.06, 0.11, 0.09, "Milk", true, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(0.87, 0.17, 0.11, 0.09, "Engine", true, GUIEditor.window[1]) GUIEditor.button[3] = guiCreateButton(0.87, 0.28, 0.11, 0.09, "Tire", true, GUIEditor.window[1]) GUIEditor.button[4] = guiCreateButton(0.88, 0.39, 0.11, 0.09, "Pizza", true, GUIEditor.window[1]) GUIEditor.gridlist[1] = guiCreateGridList(0.03, 0.07, 0.45, 0.91, true, GUIEditor.window[1]) guiGridListAddColumn(GUIEditor.gridlist[1], "Player_Name", 0.9) guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], 0, 1, "ExampleName", false, false) end ) addEventHandler ("onClientGUIClick", getRootElement(), function () if ( source == GUIEditor.button[1]) then setElementData(getPlayerFromName ("THE_DARK_KING"), "Milk", 1) end end ) addEventHandler ("onClientGUIClick", getRootElement(), function () if ( source == GUIEditor.button[2]) then setElementData(getPlayerFromName ("THE_DARK_KING"), "Engine", 1) end end ) addEventHandler ("onClientGUIClick", getRootElement(), function () if ( source == GUIEditor.button[3]) then setElementData(getPlayerFromName ("THE_DARK_KING"), "Tire", 1) end end ) addEventHandler ("onClientGUIClick", getRootElement(), function () if ( source == GUIEditor.button[4]) then setElementData(getPlayerFromName ("THE_DARK_KING"), "Pizza", 1) end end ) you can do that only admins can use it by typing in chat / give? yes Link to comment
mcer Posted June 15, 2013 Share Posted June 15, 2013 Ok, This is the complete gui: GUIEditor = { gridlist = {}, window = {}, button = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(0.15, 0.14, 0.69, 0.80, "Give_Panel_DayZ", true) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.button[1] = guiCreateButton(0.87, 0.06, 0.11, 0.09, "Milk", true, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(0.87, 0.17, 0.11, 0.09, "Engine", true, GUIEditor.window[1]) GUIEditor.button[3] = guiCreateButton(0.87, 0.28, 0.11, 0.09, "Tire", true, GUIEditor.window[1]) GUIEditor.button[4] = guiCreateButton(0.88, 0.39, 0.11, 0.09, "Pizza", true, GUIEditor.window[1]) GUIEditor.gridlist[1] = guiCreateGridList(0.03, 0.07, 0.45, 0.91, true, GUIEditor.window[1]) guiGridListAddColumn(GUIEditor.gridlist[1], "Player_Name", 0.9) guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], 0, 1, "ExampleName", false, false) end ) addEventHandler ("onClientGUIClick", getRootElement(), function () if ( source == GUIEditor.button[1]) then setElementData(getPlayerFromName ("THE_DARK_KING"), "Milk", 1) end end ) addEventHandler ("onClientGUIClick", getRootElement(), function () if ( source == GUIEditor.button[2]) then setElementData(getPlayerFromName ("THE_DARK_KING"), "Engine", 1) end end ) addEventHandler ("onClientGUIClick", getRootElement(), function () if ( source == GUIEditor.button[3]) then setElementData(getPlayerFromName ("THE_DARK_KING"), "Tire", 1) end end ) addEventHandler ("onClientGUIClick", getRootElement(), function () if ( source == GUIEditor.button[4]) then setElementData(getPlayerFromName ("THE_DARK_KING"), "Pizza", 1) end end ) you can do that only admins can use it by typing in chat / give? Enter in this server mtasa://192.168.1.71:22003 Pass: mcerpass 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