Chris!i! Posted August 10, 2014 Posted August 10, 2014 Hi,i have a problem with scripting if anyone can help me i will thanks him alot.in this script there is Nickname and team and ping and kills and deaths and T/D Ratio and more i need them to work i made the GUI and all things expect these its like NickName : it still "" the name dont appear i tried my best and didnt worked so i deleted it ad posteed it at forum so the community can help me thats the code : GUIEditor = { gridlist = {}, window = {}, label = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(347, 48, 473, 581, "Stats", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.gridlist[1] = guiCreateGridList(280, 26, 183, 545, false, GUIEditor.window[1]) guiGridListAddColumn(GUIEditor.gridlist[1], "Players", 0.9) GUIEditor.label[1] = guiCreateLabel(11, 38, 259, 30, "NickName : \"\"", false, GUIEditor.window[1]) GUIEditor.label[2] = guiCreateLabel(11, 78, 259, 30, "Team : \"\"", false, GUIEditor.window[1]) GUIEditor.label[3] = guiCreateLabel(11, 118, 259, 30, "Ping : \"\"", false, GUIEditor.window[1]) GUIEditor.label[4] = guiCreateLabel(11, 158, 259, 30, "Kills : \"\"", false, GUIEditor.window[1]) GUIEditor.label[5] = guiCreateLabel(10, 198, 259, 30, "Deaths : \"\"", false, GUIEditor.window[1]) GUIEditor.label[6] = guiCreateLabel(10, 238, 259, 30, "K/D Ratio : \"\"", false, GUIEditor.window[1]) GUIEditor.label[7] = guiCreateLabel(10, 278, 259, 30, "Money : \"\"", false, GUIEditor.window[1]) end ) function list() guiGridListClear(GUIEditor.gridlist[1]) if (guiGridListClear) then for id, players in ipairs (getElementsByType("player")) do local row = guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, (getPlayerName(players)), false, false) guiGridListSetItemColor ( GUIEditor.gridlist[1], row, 1, 255, 255, 0, 255 ) end end end addEventHandler("onClientPlayerJoin", getRootElement(), list) addEventHandler("onClientPlayerQuit", getRootElement(), list) addEventHandler("onClientPlayerChangeNick", getRootElement(), list) addEventHandler("onClientResourceStart", getRootElement(), list) function PanelShow () getVisible = guiGetVisible (GUIEditor.window[1]) if (getVisible == true) then guiSetVisible (GUIEditor.window[1], false) showCursor (false) elseif (getVisible == false) then showCursor (true) guiSetVisible (GUIEditor.window[1], true) guiSetInputEnabled(false) end end bindKey("F5", "down", PanelShow)
Et-win Posted August 10, 2014 Posted August 10, 2014 local clear = guiGridListClear(GUIEditor.gridlist[1]) if (clear) then You would know this, if you used /debugscript 3 in-game. It will show you all the errors found in the script.
Chris!i! Posted August 10, 2014 Author Posted August 10, 2014 I used it there is no errors and i dont have errors with the GridList its working but i want Nick Name : his name ping : his ping kills : his kills
Max+ Posted August 10, 2014 Posted August 10, 2014 'Functions' guiSetText getPlayerName getPlayerTeam(getTeamName getPlayerPing getElementData ----/ kills / deaths / K/D Ratio getPlayerMoney
Chris!i! Posted August 10, 2014 Author Posted August 10, 2014 I didnt understood can u put it on the code ?
Chris!i! Posted August 10, 2014 Author Posted August 10, 2014 I did it and it worked but Kills : and Deaths : K/D ratio : didnt knew how to make it
Max+ Posted August 10, 2014 Posted August 10, 2014 addEventHandler('onClientElementDataChange',root, function ( ) local gKillsClient = getElementData ( localPlayer,'Kills' ) or 'N/A' guiSetText ( yourLabel,'Total Kills : '..gKillsClient ) end ) Change yourLabel to the label name you got .
Chris!i! Posted August 10, 2014 Author Posted August 10, 2014 GUIEditor = { gridlist = {}, window = {}, label = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(347, 48, 473, 581, "Stats", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.gridlist[1] = guiCreateGridList(280, 26, 183, 545, false, GUIEditor.window[1]) guiGridListAddColumn(GUIEditor.gridlist[1], "Players", 0.9) GUIEditor.label[1] = guiCreateLabel(11, 38, 259, 30, "NickName : \"\"", false, GUIEditor.window[1]) GUIEditor.label[2] = guiCreateLabel(11, 78, 259, 30, "Team : \"\"", false, GUIEditor.window[1]) GUIEditor.label[3] = guiCreateLabel(11, 118, 259, 30, "Ping : \"\"", false, GUIEditor.window[1]) GUIEditor.label[4] = guiCreateLabel(11, 158, 259, 30, "Kills : \"\"", false, GUIEditor.window[1]) GUIEditor.label[5] = guiCreateLabel(10, 198, 259, 30, "Deaths : \"\"", false, GUIEditor.window[1]) GUIEditor.label[6] = guiCreateLabel(10, 238, 259, 30, "K/D Ratio : \"\"", false, GUIEditor.window[1]) GUIEditor.label[7] = guiCreateLabel(10, 278, 259, 30, "Money : \"\"", false, GUIEditor.window[1]) end ) function list() guiGridListClear(GUIEditor.gridlist[1]) if (guiGridListClear) then for id, players in ipairs (getElementsByType("player")) do local row = guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, (getPlayerName(players)), false, false) guiGridListSetItemColor ( GUIEditor.gridlist[1], row, 1, 255, 255, 0, 255 ) end end end addEventHandler("onClientPlayerJoin", getRootElement(), list) addEventHandler("onClientPlayerQuit", getRootElement(), list) addEventHandler("onClientPlayerChangeNick", getRootElement(), list) addEventHandler("onClientResourceStart", getRootElement(), list) function PanelShow () getVisible = guiGetVisible (GUIEditor.window[1]) if (getVisible == true) then guiSetVisible (GUIEditor.window[1], false) showCursor (false) elseif (getVisible == false) then showCursor (true) guiSetVisible (GUIEditor.window[1], true) guiSetInputEnabled(false) end end bindKey("F5", "down", PanelShow) function setStats ( ) if ( source == GUIEditor.gridlist[1] ) then row, col = guiGridListGetSelectedItem ( source ) if ( row and col and row ~= -1 and col ~= -1 ) then local playername = guiGridListGetItemText ( source, row, col ) local thePlayer = getPlayerFromName ( playername ) if ( thePlayer ) then local tm1 = getPlayerTeam ( thePlayer ) local tm2 = getTeamName ( tm1 ) local ping = getPlayerPing ( thePlayer ) local money = getPlayerMoney ( thePlayer ) guiSetText ( GUIEditor.label[1], "Nickname: ".. playername ) guiSetText ( GUIEditor.label[2], "Team: ".. tm2 ) guiSetText ( GUIEditor.label[3], "Ping: ".. ping ) guiSetText ( GUIEditor.label[7], "Money: ".. money ) end end end end addEventHandler ( "onClientGUIDoubleClick", root, setStats ) addEventHandler('onClientElementDataChange',root, function ( ) local gKillsClient = getElementData ( localPlayer,'Kills' ) or 'N/A' guiSetText ( GUIEditor.label[4], "Kills: "..gKillsClient ) end )
Max+ Posted August 10, 2014 Posted August 10, 2014 --ClientSide GUIEditor = { gridlist = {}, window = {}, label = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(347, 48, 473, 581, "Stats", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.gridlist[1] = guiCreateGridList(280, 26, 183, 545, false, GUIEditor.window[1]) guiGridListAddColumn(GUIEditor.gridlist[1], "Players", 0.9) GUIEditor.label[1] = guiCreateLabel(11, 38, 259, 30, "NickName : \"\"", false, GUIEditor.window[1]) GUIEditor.label[2] = guiCreateLabel(11, 78, 259, 30, "Team : \"\"", false, GUIEditor.window[1]) GUIEditor.label[3] = guiCreateLabel(11, 118, 259, 30, "Ping : \"\"", false, GUIEditor.window[1]) GUIEditor.label[4] = guiCreateLabel(11, 158, 259, 30, "Kills : \"\"", false, GUIEditor.window[1]) GUIEditor.label[5] = guiCreateLabel(10, 198, 259, 30, "Deaths : \"\"", false, GUIEditor.window[1]) GUIEditor.label[6] = guiCreateLabel(10, 238, 259, 30, "K/D Ratio : \"\"", false, GUIEditor.window[1]) GUIEditor.label[7] = guiCreateLabel(10, 278, 259, 30, "Money : \"\"", false, GUIEditor.window[1]) end ) function list() guiGridListClear(GUIEditor.gridlist[1]) if (guiGridListClear) then for id, players in ipairs (getElementsByType("player")) do local row = guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, (getPlayerName(players)), false, false) guiGridListSetItemColor ( GUIEditor.gridlist[1], row, 1, 255, 255, 0, 255 ) end end end addEventHandler("onClientPlayerJoin", getRootElement(), list) addEventHandler("onClientPlayerQuit", getRootElement(), list) addEventHandler("onClientPlayerChangeNick", getRootElement(), list) addEventHandler("onClientResourceStart", getRootElement(), list) function PanelShow () getVisible = guiGetVisible (GUIEditor.window[1]) if (getVisible == true) then guiSetVisible (GUIEditor.window[1], false) showCursor (false) elseif (getVisible == false) then showCursor (true) guiSetVisible (GUIEditor.window[1], true) guiSetInputEnabled(false) end end bindKey("F5", "down", PanelShow) function setStats ( ) if ( source == GUIEditor.gridlist[1] ) then row, col = guiGridListGetSelectedItem ( source ) if ( row and col and row ~= -1 and col ~= -1 ) then local playername = guiGridListGetItemText ( source, row, col ) local thePlayer = getPlayerFromName ( playername ) if ( thePlayer ) then local tm1 = getPlayerTeam ( thePlayer ) local tm2 = getTeamName ( tm1 ) local ping = getPlayerPing ( thePlayer ) local money = getPlayerMoney ( thePlayer ) local gKillsClient = getElementData ( localPlayer,'Kills' ) or 'N/A' guiSetText ( GUIEditor.label[1], "Nickname: ".. playername ) guiSetText ( GUIEditor.label[2], "Team: ".. tm2 ) guiSetText ( GUIEditor.label[3], "Ping: ".. ping ) guiSetText ( GUIEditor.label[7], "Money: ".. money ) guiSetText ( GUIEditor.label[4], "Kills: "..gKillsClient ) end end end end
Chris!i! Posted August 10, 2014 Author Posted August 10, 2014 I dont know why sometimes it happens i pressed on my self nothing of my info came D: now i made a button called Refresh can u tell me how to do it like when he press refresh all his info reset i dont mean it reset his account just his info in the GUI any help thanks alot.
Chris!i! Posted August 10, 2014 Author Posted August 10, 2014 Lol nvm we forgot addEventHandler ( "onClientGUIDoubleClick", root, setStats ), any way the script didnt worked Kills still N/A i killed my brother 2 times i didnt got Kills: 2
Drakath Posted August 10, 2014 Posted August 10, 2014 It is not suppose to set kills. Something is probably wrong with your script which sets the kills.
Max+ Posted August 10, 2014 Posted August 10, 2014 Lol nvm we forgot addEventHandler ( "onClientGUIDoubleClick", root, setStats ), any way the script didnt worked Kills still N/A i killed my brother 2 times i didnt got Kills: 2 you need to make a code if you killed someone add + 1 kills by setElementData ( killer, 'Kills', +1 )
Et-win Posted August 10, 2014 Posted August 10, 2014 Remember to get the data first. local gData = getElementData(killer, "Kills") if (gData == false) or (gData == nil) then gData = 0 end gData = gData + 1 setElementData(killer, "Kills", gData)
Chris!i! Posted August 11, 2014 Author Posted August 11, 2014 Ok i knew how but couldnt make the code can anyone put it on the code ? please
Drakath Posted August 11, 2014 Posted August 11, 2014 He basically wrote the whole code. Just put it in a function and addEventHandler. onPlayerWasted
Et-win Posted August 11, 2014 Posted August 11, 2014 And also don't forget to look what 'onPlayerWasted' returns through the function. (Parameters)
Max+ Posted August 11, 2014 Posted August 11, 2014 ---ServerSide addEventHandler ( 'onPlayerWasted', resourceRoot, function (_, attacker ) if ( attacker ) and ( attacker ~= source ) then local nData = getElementData ( attacker, 'Kills' ) if ( nData == false ) or ( nData == nil ) then nData = 0 end nData = nData +1 setElementData ( attacker, 'Kills', nData ) end end )
Et-win Posted August 11, 2014 Posted August 11, 2014 No offence, but there goes another change of learning how to do it by yourself.
Max+ Posted August 11, 2014 Posted August 11, 2014 (edited) No offence, but there goes another change of learning how to do it by yourself. i dont think he will manage to do it , they all want ready scripts , i will Only help him in this Code , if he made another topic for " ready scripts" i won't help him . Edited August 11, 2014 by Guest
Et-win Posted August 11, 2014 Posted August 11, 2014 they all want ready scriptis +1 But don't give up the hope
Chris!i! Posted August 11, 2014 Author Posted August 11, 2014 We are getting help not ready script if someone dont know how to do it that mean we want ready script -.-
Chris!i! Posted August 11, 2014 Author Posted August 11, 2014 If u want it like that i will not post anymore for help.
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