Absence2 Posted February 21, 2012 Share Posted February 21, 2012 Hello there, today I tried myself on the 'Guieditor' I found on community > resources, anyways, I'm trying to add two buttons in the top left corner with it. That part was quite easy, this is what I got, I'm trying to figure out how to make them clickable > adding the "Rules" button clickable together with the second script. If you click 'Rules', the window would show! addEventHandler("onClientResourceStart",resourceRoot, function() GUIEditor_Button = {} GUIEditor_Button[1] = guiCreateButton(732,9,63,18,"Updates",false) guiSetAlpha(GUIEditor_Button[1],0) GUIEditor_Button[2] = guiCreateButton(737,6,58,20,"Updates",false) GUIEditor_Button[3] = guiCreateButton(685,6,47,21,"Rules",false) end ) if ( myWindow == nil ) then myWindow = guiCreateWindow ( 0.20, 0.20, 0.6, 0.6, "Information about Roleplaying", true ) local tabPanel = guiCreateTabPanel ( 0, 0.1, 1, 1, true, myWindow ) local tabRules = guiCreateTab( "Rules", tabPanel ) local paneRules = guiCreateScrollPane(0.02, 0.02, 0.95, 0.95, true, tabRules) local tabRules2 = guiCreateTab( "Rules II", tabPanel ) local paneRules2 = guiCreateScrollPane(0.02, 0.02, 0.95, 0.95, true, tabRules2) local tabOverview = guiCreateTab( "Roleplay Overview", tabPanel ) local tabPowergaming = guiCreateTab( "Powergaming", tabPanel ) local tabMetagaming = guiCreateTab( "Metagaming", tabPanel ) local tabCommonSense = guiCreateTab( "Common Sense", tabPanel ) local tabRevengeKilling = guiCreateTab( "Revenge Killing", tabPanel ) --------- guiScrollPaneSetScrollBars(paneRules, false, true) local xml1 = xmlLoadFile( "serverrules.xml" ) local contents1 = xmlNodeGetValue( xml1 ) local xml2 = xmlLoadFile( "serverrules2.xml" ) local contents2 = xmlNodeGetValue( xml2 ) local xml3 = xmlLoadFile( "whatisroleplaying.xml" ) local contents3 = xmlNodeGetValue( xml3 ) local xml4 = xmlLoadFile( "powergaming.xml" ) local contents4 = xmlNodeGetValue( xml4 ) local xml5 = xmlLoadFile( "metagaming.xml" ) local contents5 = xmlNodeGetValue( xml5 ) local xml6 = xmlLoadFile( "commonsense.xml" ) local contents6 = xmlNodeGetValue( xml6 ) local xml7 = xmlLoadFile( "revengekilling.xml" ) local contents7 = xmlNodeGetValue( xml7 ) --------- guiCreateLabel(0.00,0.00,0.94,1.4,contents1,true,paneRules) guiCreateLabel(0.00,0.00,0.94,1.4,contents2,true,paneRules2) guiCreateLabel(0.02,0.04,0.94,0.92,contents3,true,tabOverview) guiCreateLabel(0.02,0.04,0.94,0.92,contents4,true,tabPowergaming) guiCreateLabel(0.02,0.04,0.94,0.92,contents5,true,tabMetagaming) guiCreateLabel(0.02,0.04,0.94,0.92,contents6,true,tabCommonSense) guiCreateLabel(0.02,0.04,0.94,0.92,contents7,true,tabRevengeKilling) showCursor ( true ) else destroyElement(myWindow) myWindow = nil showCursor(false) end end end Link to comment
mjau Posted February 21, 2012 Share Posted February 21, 2012 addEventHandler("onClientResourceStart",resourceRoot, function() GUIEditor_Button = {} GUIEditor_Button[1] = guiCreateButton(732,9,63,18,"Updates",false) guiSetAlpha(GUIEditor_Button[1],0) GUIEditor_Button[2] = guiCreateButton(737,6,58,20,"Updates",false) GUIEditor_Button[3] = guiCreateButton(685,6,47,21,"Rules",false) showCursor(true) addEventHandler("onClientGUIClick", GUIEditor_Button[3], showRules) end ) function showRules() if ( myWindow == nil ) then myWindow = guiCreateWindow ( 0.20, 0.20, 0.6, 0.6, "Information about Roleplaying", true ) local tabPanel = guiCreateTabPanel ( 0, 0.1, 1, 1, true, myWindow ) local tabRules = guiCreateTab( "Rules", tabPanel ) local paneRules = guiCreateScrollPane(0.02, 0.02, 0.95, 0.95, true, tabRules) local tabRules2 = guiCreateTab( "Rules II", tabPanel ) local paneRules2 = guiCreateScrollPane(0.02, 0.02, 0.95, 0.95, true, tabRules2) local tabOverview = guiCreateTab( "Roleplay Overview", tabPanel ) local tabPowergaming = guiCreateTab( "Powergaming", tabPanel ) local tabMetagaming = guiCreateTab( "Metagaming", tabPanel ) local tabCommonSense = guiCreateTab( "Common Sense", tabPanel ) local tabRevengeKilling = guiCreateTab( "Revenge Killing", tabPanel ) --------- guiScrollPaneSetScrollBars(paneRules, false, true) local xml1 = xmlLoadFile( "serverrules.xml" ) local contents1 = xmlNodeGetValue( xml1 ) local xml2 = xmlLoadFile( "serverrules2.xml" ) local contents2 = xmlNodeGetValue( xml2 ) local xml3 = xmlLoadFile( "whatisroleplaying.xml" ) local contents3 = xmlNodeGetValue( xml3 ) local xml4 = xmlLoadFile( "powergaming.xml" ) local contents4 = xmlNodeGetValue( xml4 ) local xml5 = xmlLoadFile( "metagaming.xml" ) local contents5 = xmlNodeGetValue( xml5 ) local xml6 = xmlLoadFile( "commonsense.xml" ) local contents6 = xmlNodeGetValue( xml6 ) local xml7 = xmlLoadFile( "revengekilling.xml" ) local contents7 = xmlNodeGetValue( xml7 ) --------- guiCreateLabel(0.00,0.00,0.94,1.4,contents1,true,paneRules) guiCreateLabel(0.00,0.00,0.94,1.4,contents2,true,paneRules2) guiCreateLabel(0.02,0.04,0.94,0.92,contents3,true,tabOverview) guiCreateLabel(0.02,0.04,0.94,0.92,contents4,true,tabPowergaming) guiCreateLabel(0.02,0.04,0.94,0.92,contents5,true,tabMetagaming) guiCreateLabel(0.02,0.04,0.94,0.92,contents6,true,tabCommonSense) guiCreateLabel(0.02,0.04,0.94,0.92,contents7,true,tabRevengeKilling) showCursor ( true ) else destroyElement(myWindow) myWindow = nil showCursor(false) end end Link to comment
Absence2 Posted February 21, 2012 Author Share Posted February 21, 2012 Thank you, works very well Btw, that "Information About Roleplay" is bugging! It doesn't let me scroll all the way down so only a 1/2 shows including on the sides < > Also, there's something wrong with the cursor ('M'), you can't toggle the cursor if you haven't pressed F9 twice. Link to comment
mjau Posted February 21, 2012 Share Posted February 21, 2012 oh the cursor just remove showCursor(true) fromn the script Link to comment
Absence2 Posted February 21, 2012 Author Share Posted February 21, 2012 Yes, thanks But this, why wont it work?: addEventHandler("onClientResourceStart",resourceRoot, function() GUIEditor_Button = {} GUIEditor_Button[1] = guiCreateButton(732,9,63,18,"Updates",false) guiSetAlpha(GUIEditor_Button[1],0) GUIEditor_Button[2] = guiCreateButton(737,6,58,20,"Updates",false) GUIEditor_Button[3] = guiCreateButton(685,6,47,21,"Rules",false) addEventHandler("onClientGUIClick", GUIEditor_Button[3], showRules) addEventHandler("onClientGUIClick", GUIEditor_Button[2], showUpdates) end end end ) function showRules() if ( myWindow == nil ) then myWindow = guiCreateWindow ( 0.10, 0.10, 0.80, 0.80, "TwinGold Roleplay Server Rules [F9 Toggle]", true ) local tabPanel = guiCreateTabPanel ( 0, 0.1, 1, 1, true, myWindow ) local tabRules = guiCreateTab( "Rules", tabPanel ) local paneRules = guiCreateScrollPane(0.02, 0.02, 0.95, 0.95, true, tabRules) local tabRules2 = guiCreateTab( "Rules II", tabPanel ) local paneRules2 = guiCreateScrollPane(0.02, 0.02, 0.95, 0.95, true, tabRules2) local tabOverview = guiCreateTab( "Roleplay Overview", tabPanel ) local tabPowergaming = guiCreateTab( "Powergaming", tabPanel ) local tabMetagaming = guiCreateTab( "Metagaming", tabPanel ) local tabCommonSense = guiCreateTab( "Common Sense", tabPanel ) local tabRevengeKilling = guiCreateTab( "Revenge Killing", tabPanel ) --------- guiScrollPaneSetScrollBars(paneRules, false, true) local xml1 = xmlLoadFile( "serverrules.xml" ) local contents1 = xmlNodeGetValue( xml1 ) local xml2 = xmlLoadFile( "serverrules2.xml" ) local contents2 = xmlNodeGetValue( xml2 ) local xml3 = xmlLoadFile( "whatisroleplaying.xml" ) local contents3 = xmlNodeGetValue( xml3 ) local xml4 = xmlLoadFile( "powergaming.xml" ) local contents4 = xmlNodeGetValue( xml4 ) local xml5 = xmlLoadFile( "metagaming.xml" ) local contents5 = xmlNodeGetValue( xml5 ) local xml6 = xmlLoadFile( "commonsense.xml" ) local contents6 = xmlNodeGetValue( xml6 ) local xml7 = xmlLoadFile( "revengekilling.xml" ) local contents7 = xmlNodeGetValue( xml7 ) --------- guiCreateLabel(0.00,0.00,0.94,1.4,contents1,true,paneRules) guiCreateLabel(0.00,0.00,0.94,1.4,contents2,true,paneRules2) guiCreateLabel(0.02,0.04,0.94,0.92,contents3,true,tabOverview) guiCreateLabel(0.02,0.04,0.94,0.92,contents4,true,tabPowergaming) guiCreateLabel(0.02,0.04,0.94,0.92,contents5,true,tabMetagaming) guiCreateLabel(0.02,0.04,0.94,0.92,contents6,true,tabCommonSense) guiCreateLabel(0.02,0.04,0.94,0.92,contents7,true,tabRevengeKilling) showCursor ( true ) else destroyElement(myWindow) myWindow = nil showCursor(false) end end function showUpdates() if ( myWindow == nil ) then myWindow = guiCreateWindow ( 0.10, 0.10, 0.40, 0.40, "TwinGold Roleplay User Panel", true ) local tabPanel = guiCreateTabPanel ( 0, 0.1, 1, 1, true, myWindow ) local tabRules = guiCreateTab( "Stats", tabPanel ) local paneRules = guiCreateScrollPane(0.02, 0.02, 0.95, 0.95, true, tabRules) local tabRules2 = guiCreateTab( "Updates", tabPanel ) local paneRules2 = guiCreateScrollPane(0.02, 0.02, 0.95, 0.95, true, tabRules2) local tabOverview = guiCreateTab( "Server Info", tabPanel ) --------- guiScrollPaneSetScrollBars(paneRules, false, true) local xml1 = xmlLoadFile( "stats.xml" ) local contents1 = xmlNodeGetValue( xml1 ) local xml2 = xmlLoadFile( "updates.xml" ) local contents2 = xmlNodeGetValue( xml2 ) local xml3 = xmlLoadFile( "serverinfo.xml" ) local contents3 = xmlNodeGetValue( xml3 ) --------- guiCreateLabel(0.00,0.00,0.94,1.4,contents1,true,paneStats) guiCreateLabel(0.00,0.00,0.94,1.4,contents2,true,paneUpdates) guiCreateLabel(0.02,0.04,0.94,0.92,contents3,true,tabServerInfo) showCursor ( true ) else destroyElement(myWindow) myWindow = nil showCursor(false) end end 15: ) expected near (to close ( at line 1 ) near 'end' Link to comment
Castillo Posted February 21, 2012 Share Posted February 21, 2012 addEventHandler("onClientResourceStart",resourceRoot, function() GUIEditor_Button = {} GUIEditor_Button[1] = guiCreateButton(732,9,63,18,"Updates",false) guiSetAlpha(GUIEditor_Button[1],0) GUIEditor_Button[2] = guiCreateButton(737,6,58,20,"Updates",false) GUIEditor_Button[3] = guiCreateButton(685,6,47,21,"Rules",false) addEventHandler("onClientGUIClick", GUIEditor_Button[3], showRules) addEventHandler("onClientGUIClick", GUIEditor_Button[2], showUpdates) end ) function showRules() if ( myWindow == nil ) then myWindow = guiCreateWindow ( 0.10, 0.10, 0.80, 0.80, "TwinGold Roleplay Server Rules [F9 Toggle]", true ) local tabPanel = guiCreateTabPanel ( 0, 0.1, 1, 1, true, myWindow ) local tabRules = guiCreateTab( "Rules", tabPanel ) local paneRules = guiCreateScrollPane(0.02, 0.02, 0.95, 0.95, true, tabRules) local tabRules2 = guiCreateTab( "Rules II", tabPanel ) local paneRules2 = guiCreateScrollPane(0.02, 0.02, 0.95, 0.95, true, tabRules2) local tabOverview = guiCreateTab( "Roleplay Overview", tabPanel ) local tabPowergaming = guiCreateTab( "Powergaming", tabPanel ) local tabMetagaming = guiCreateTab( "Metagaming", tabPanel ) local tabCommonSense = guiCreateTab( "Common Sense", tabPanel ) local tabRevengeKilling = guiCreateTab( "Revenge Killing", tabPanel ) --------- guiScrollPaneSetScrollBars(paneRules, false, true) local xml1 = xmlLoadFile( "serverrules.xml" ) local contents1 = xmlNodeGetValue( xml1 ) local xml2 = xmlLoadFile( "serverrules2.xml" ) local contents2 = xmlNodeGetValue( xml2 ) local xml3 = xmlLoadFile( "whatisroleplaying.xml" ) local contents3 = xmlNodeGetValue( xml3 ) local xml4 = xmlLoadFile( "powergaming.xml" ) local contents4 = xmlNodeGetValue( xml4 ) local xml5 = xmlLoadFile( "metagaming.xml" ) local contents5 = xmlNodeGetValue( xml5 ) local xml6 = xmlLoadFile( "commonsense.xml" ) local contents6 = xmlNodeGetValue( xml6 ) local xml7 = xmlLoadFile( "revengekilling.xml" ) local contents7 = xmlNodeGetValue( xml7 ) --------- guiCreateLabel(0.00,0.00,0.94,1.4,contents1,true,paneRules) guiCreateLabel(0.00,0.00,0.94,1.4,contents2,true,paneRules2) guiCreateLabel(0.02,0.04,0.94,0.92,contents3,true,tabOverview) guiCreateLabel(0.02,0.04,0.94,0.92,contents4,true,tabPowergaming) guiCreateLabel(0.02,0.04,0.94,0.92,contents5,true,tabMetagaming) guiCreateLabel(0.02,0.04,0.94,0.92,contents6,true,tabCommonSense) guiCreateLabel(0.02,0.04,0.94,0.92,contents7,true,tabRevengeKilling) showCursor ( true ) else destroyElement(myWindow) myWindow = nil showCursor(false) end end function showUpdates() if ( myWindow == nil ) then myWindow = guiCreateWindow ( 0.10, 0.10, 0.40, 0.40, "TwinGold Roleplay User Panel", true ) local tabPanel = guiCreateTabPanel ( 0, 0.1, 1, 1, true, myWindow ) local tabRules = guiCreateTab( "Stats", tabPanel ) local paneRules = guiCreateScrollPane(0.02, 0.02, 0.95, 0.95, true, tabRules) local tabRules2 = guiCreateTab( "Updates", tabPanel ) local paneRules2 = guiCreateScrollPane(0.02, 0.02, 0.95, 0.95, true, tabRules2) local tabOverview = guiCreateTab( "Server Info", tabPanel ) --------- guiScrollPaneSetScrollBars(paneRules, false, true) local xml1 = xmlLoadFile( "stats.xml" ) local contents1 = xmlNodeGetValue( xml1 ) local xml2 = xmlLoadFile( "updates.xml" ) local contents2 = xmlNodeGetValue( xml2 ) local xml3 = xmlLoadFile( "serverinfo.xml" ) local contents3 = xmlNodeGetValue( xml3 ) --------- guiCreateLabel(0.00,0.00,0.94,1.4,contents1,true,paneStats) guiCreateLabel(0.00,0.00,0.94,1.4,contents2,true,paneUpdates) guiCreateLabel(0.02,0.04,0.94,0.92,contents3,true,tabServerInfo) showCursor ( true ) else destroyElement(myWindow) myWindow = nil showCursor(false) end end You had two extra 'end' at "onClientResourceStart" event. Link to comment
Absence2 Posted February 21, 2012 Author Share Posted February 21, 2012 (edited) Thanks, worked now I'm trying to use this addEventHandler( "onClientRender", getRootElement(), function() if guiGetVisible(Window) and isElement( player ) then guiSetText ( Label[1], "Name: " .. getPlayerName(player) .. " (" .. getElementData( player, "gameaccountusername" ) .. ")") local x, y, z = getElementPosition(player) guiSetText ( Label[13], "X: " .. x ) guiSetText ( Label[14], "Y: " .. y ) guiSetText ( Label[15], "Z: " .. z ) guiSetText ( Label[3], "Money: $" .. exports.global:getMoney( player ) .. " (Bank: $" .. getElementData( player, "bankmoney" ) .. ")") guiSetText ( Label[4], "Health: " .. math.ceil( getElementHealth( player ) ) ) guiSetText ( Label[5], "Armour: " .. math.ceil( getPedArmor( player ) ) ) guiSetText ( Label[6], "Skin: " .. getElementModel( player ) ) local weapon = getPedWeapon( player ) if weapon then weapon = getWeaponNameFromID( weapon ) else weapon = "N/A" end guiSetText ( Label[7], "Weapon: " .. weapon ) local team = getPlayerTeam(player) if team then guiSetText ( Label[8], "Faction: " .. getTeamName(team) ) else guiSetText ( Label[8], "Faction: N/A") end guiSetText ( Label[9], "Ping: " .. getPlayerPing( player ) ) local vehicle = getPedOccupiedVehicle( player ) if vehicle then guiSetText ( Label[10], "Vehicle: " .. getVehicleName( vehicle ) .. " (" ..getElementData( vehicle, "dbid" ) .. ")" ) else guiSetText ( Label[10], "Vehicle: N/A") end guiSetText ( Label[12], "Location: " .. getZoneName( x, y, z ) ) guiSetText ( Label[16], "Interior: " .. getElementInterior( player ) ) guiSetText ( Label[17], "Dimension: " .. getElementDimension( player ) ) guiSetText ( Label[20], "Hours Ingame: " .. ( getElementData( player, "hoursplayed" ) or 0 ) ) end end ) but weow it bugged when I tried! I changed the stats to stats.lua btw > had to restart the server because it messed up every cmd there is, anyways, how to add this? Everything went 'nil' Edited February 21, 2012 by Guest Link to comment
Castillo Posted February 21, 2012 Share Posted February 21, 2012 What are you trying to do? that's a Lua script into a .XML file? Link to comment
Absence2 Posted February 21, 2012 Author Share Posted February 21, 2012 Well, no, I deleted the .xml file, replaced it with a .lua file and added the script above. I'm trying to make the 'stats' show player stats, but adding lua scripts to it doesn't seem to work this is what I got now addEventHandler("onClientResourceStart",resourceRoot, function() GUIEditor_Button = {} GUIEditor_Button[1] = guiCreateButton(732,9,63,18,"Updates",false) guiSetAlpha(GUIEditor_Button[1],0) GUIEditor_Button[2] = guiCreateButton(737,6,58,20,"Updates",false) GUIEditor_Button[3] = guiCreateButton(685,6,47,21,"Rules",false) addEventHandler("onClientGUIClick", GUIEditor_Button[3], showRules) addEventHandler("onClientGUIClick", GUIEditor_Button[2], showUpdates) end ) function showRules() if ( myWindow == nil ) then myWindow = guiCreateWindow ( 0.10, 0.10, 0.80, 0.80, "TwinGold Roleplay Server Rules [F9 Toggle]", true ) local tabPanel = guiCreateTabPanel ( 0, 0.1, 1, 1, true, myWindow ) local tabRules = guiCreateTab( "Rules", tabPanel ) local paneRules = guiCreateScrollPane(0.02, 0.02, 0.95, 0.95, true, tabRules) local tabRules2 = guiCreateTab( "Rules II", tabPanel ) local paneRules2 = guiCreateScrollPane(0.02, 0.02, 0.95, 0.95, true, tabRules2) local tabOverview = guiCreateTab( "Roleplay Overview", tabPanel ) local tabPowergaming = guiCreateTab( "Powergaming", tabPanel ) local tabMetagaming = guiCreateTab( "Metagaming", tabPanel ) local tabCommonSense = guiCreateTab( "Common Sense", tabPanel ) local tabRevengeKilling = guiCreateTab( "Revenge Killing", tabPanel ) --------- guiScrollPaneSetScrollBars(paneRules, false, true) local xml1 = xmlLoadFile( "serverrules.xml" ) local contents1 = xmlNodeGetValue( xml1 ) local xml2 = xmlLoadFile( "serverrules2.xml" ) local contents2 = xmlNodeGetValue( xml2 ) local xml3 = xmlLoadFile( "whatisroleplaying.xml" ) local contents3 = xmlNodeGetValue( xml3 ) local xml4 = xmlLoadFile( "powergaming.xml" ) local contents4 = xmlNodeGetValue( xml4 ) local xml5 = xmlLoadFile( "metagaming.xml" ) local contents5 = xmlNodeGetValue( xml5 ) local xml6 = xmlLoadFile( "commonsense.xml" ) local contents6 = xmlNodeGetValue( xml6 ) local xml7 = xmlLoadFile( "revengekilling.xml" ) local contents7 = xmlNodeGetValue( xml7 ) --------- guiCreateLabel(0.00,0.00,0.94,1.4,contents1,true,paneRules) guiCreateLabel(0.00,0.00,0.94,1.4,contents2,true,paneRules2) guiCreateLabel(0.02,0.04,0.94,0.92,contents3,true,tabOverview) guiCreateLabel(0.02,0.04,0.94,0.92,contents4,true,tabPowergaming) guiCreateLabel(0.02,0.04,0.94,0.92,contents5,true,tabMetagaming) guiCreateLabel(0.02,0.04,0.94,0.92,contents6,true,tabCommonSense) guiCreateLabel(0.02,0.04,0.94,0.92,contents7,true,tabRevengeKilling) showCursor ( true ) else destroyElement(myWindow) myWindow = nil showCursor(false) end end function showUpdates() if ( myWindow == nil ) then myWindow = guiCreateWindow ( 0.10, 0.10, 0.40, 0.40, "TwinGold Roleplay User Panel", true ) local tabPanel = guiCreateTabPanel ( 0, 0.1, 1, 1, true, myWindow ) local tabRules = guiCreateTab( "Stats", tabPanel ) local paneRules = guiCreateScrollPane(0.02, 0.02, 0.95, 0.95, true, tabRules) local tabRules2 = guiCreateTab( "Updates", tabPanel ) local paneRules2 = guiCreateScrollPane(0.02, 0.02, 0.95, 0.95, true, tabRules2) local tabOverview = guiCreateTab( "Server Info", tabPanel ) --------- guiScrollPaneSetScrollBars(paneRules, false, true) local lua1 = luaLoadFile( "stats.lua" ) local contents1 = xmlNodeGetValue( xml1 ) local xml2 = xmlLoadFile( "updates.xml" ) local contents2 = xmlNodeGetValue( xml2 ) local xml3 = xmlLoadFile( "serverinfo.xml" ) local contents3 = xmlNodeGetValue( xml3 ) --------- guiCreateLabel(0.00,0.00,0.94,1.4,contents1,true,paneStats) guiCreateLabel(0.00,0.00,0.94,1.4,contents2,true,paneUpdates) guiCreateLabel(0.02,0.04,0.94,0.92,contents3,true,tabServerInfo) showCursor ( true ) else destroyElement(myWindow) myWindow = nil showCursor(false) end end > this is the stats.lua file addEventHandler( "onClientRender", getRootElement(), function() if guiGetVisible(Window) and isElement( player ) then guiSetText ( Label[1], "Name: " .. getPlayerName(player) .. " (" .. getElementData( player, "gameaccountusername" ) .. ")") local x, y, z = getElementPosition(player) guiSetText ( Label[13], "X: " .. x ) guiSetText ( Label[14], "Y: " .. y ) guiSetText ( Label[15], "Z: " .. z ) guiSetText ( Label[3], "Money: $" .. exports.global:getMoney( player ) .. " (Bank: $" .. getElementData( player, "bankmoney" ) .. ")") guiSetText ( Label[4], "Health: " .. math.ceil( getElementHealth( player ) ) ) guiSetText ( Label[5], "Armour: " .. math.ceil( getPedArmor( player ) ) ) guiSetText ( Label[6], "Skin: " .. getElementModel( player ) ) local weapon = getPedWeapon( player ) if weapon then weapon = getWeaponNameFromID( weapon ) else weapon = "N/A" end guiSetText ( Label[7], "Weapon: " .. weapon ) local team = getPlayerTeam(player) if team then guiSetText ( Label[8], "Faction: " .. getTeamName(team) ) else guiSetText ( Label[8], "Faction: N/A") end guiSetText ( Label[9], "Ping: " .. getPlayerPing( player ) ) local vehicle = getPedOccupiedVehicle( player ) if vehicle then guiSetText ( Label[10], "Vehicle: " .. getVehicleName( vehicle ) .. " (" ..getElementData( vehicle, "dbid" ) .. ")" ) else guiSetText ( Label[10], "Vehicle: N/A") end guiSetText ( Label[12], "Location: " .. getZoneName( x, y, z ) ) guiSetText ( Label[16], "Interior: " .. getElementInterior( player ) ) guiSetText ( Label[17], "Dimension: " .. getElementDimension( player ) ) guiSetText ( Label[20], "Hours Ingame: " .. ( getElementData( player, "hoursplayed" ) or 0 ) ) end end ) Link to comment
Castillo Posted February 21, 2012 Share Posted February 21, 2012 You forgot to remove the XML file parts. addEventHandler( "onClientRender", getRootElement(), function() if guiGetVisible(Window) and isElement( player ) then guiSetText ( Label[1], "Name: " .. getPlayerName(player) .. " (" .. getElementData( player, "gameaccountusername" ) .. ")") local x, y, z = getElementPosition(player) guiSetText ( Label[13], "X: " .. x ) guiSetText ( Label[14], "Y: " .. y ) guiSetText ( Label[15], "Z: " .. z ) guiSetText ( Label[3], "Money: $" .. exports.global:getMoney( player ) .. " (Bank: $" .. getElementData( player, "bankmoney" ) .. ")") guiSetText ( Label[4], "Health: " .. math.ceil( getElementHealth( player ) ) ) guiSetText ( Label[5], "Armour: " .. math.ceil( getPedArmor( player ) ) ) guiSetText ( Label[6], "Skin: " .. getElementModel( player ) ) local weapon = getPedWeapon( player ) if weapon then weapon = getWeaponNameFromID( weapon ) else weapon = "N/A" end guiSetText ( Label[7], "Weapon: " .. weapon ) local team = getPlayerTeam(player) if team then guiSetText ( Label[8], "Faction: " .. getTeamName(team) ) else guiSetText ( Label[8], "Faction: N/A") end guiSetText ( Label[9], "Ping: " .. getPlayerPing( player ) ) local vehicle = getPedOccupiedVehicle( player ) if vehicle then guiSetText ( Label[10], "Vehicle: " .. getVehicleName( vehicle ) .. " (" ..getElementData( vehicle, "dbid" ) .. ")" ) else guiSetText ( Label[10], "Vehicle: N/A") end guiSetText ( Label[12], "Location: " .. getZoneName( x, y, z ) ) guiSetText ( Label[16], "Interior: " .. getElementInterior( player ) ) guiSetText ( Label[17], "Dimension: " .. getElementDimension( player ) ) guiSetText ( Label[20], "Hours Ingame: " .. ( getElementData( player, "hoursplayed" ) or 0 ) ) end end ) Link to comment
Absence2 Posted February 21, 2012 Author Share Posted February 21, 2012 error: attempt to call global 'LuaLoadFile' (a nil value) also I thought was supposed to be there so it would add itself to the GUI window can't I just let it call to a xml but the file itself is a .lua? in luaLoadFile ? Link to comment
Castillo Posted February 21, 2012 Share Posted February 21, 2012 Remove 'LuaLoadFile', that function doesn't exists. Link to comment
Absence2 Posted February 21, 2012 Author Share Posted February 21, 2012 Ok, I'll give it a try but.. it is somehow FILLED with errors now, I have no idea why, they just appeared out of nowhere. addEventHandler("onClientResourceStart",resourceRoot, function() GUIEditor_Button = {} GUIEditor_Button[1] = guiCreateButton(732,9,63,18,"Updates",false) guiSetAlpha(GUIEditor_Button[1],0) GUIEditor_Button[2] = guiCreateButton(737,6,58,20,"Updates",false) GUIEditor_Button[3] = guiCreateButton(685,6,47,21,"Rules",false) addEventHandler("onClientGUIClick", GUIEditor_Button[3], showRules) addEventHandler("onClientGUIClick", GUIEditor_Button[2], showUpdates) end ) function showRules() if ( myWindow == nil ) then myWindow = guiCreateWindow ( 0.10, 0.10, 0.80, 0.80, "TwinGold Roleplay Server Rules [F9 Toggle]", true ) local tabPanel = guiCreateTabPanel ( 0, 0.1, 1, 1, true, myWindow ) local tabRules = guiCreateTab( "Rules", tabPanel ) local paneRules = guiCreateScrollPane(0.02, 0.02, 0.95, 0.95, true, tabRules) local tabRules2 = guiCreateTab( "Rules II", tabPanel ) local paneRules2 = guiCreateScrollPane(0.02, 0.02, 0.95, 0.95, true, tabRules2) local tabOverview = guiCreateTab( "Roleplay Overview", tabPanel ) local tabPowergaming = guiCreateTab( "Powergaming", tabPanel ) local tabMetagaming = guiCreateTab( "Metagaming", tabPanel ) local tabCommonSense = guiCreateTab( "Common Sense", tabPanel ) local tabRevengeKilling = guiCreateTab( "Revenge Killing", tabPanel ) --------- guiScrollPaneSetScrollBars(paneRules, false, true) local xml1 = xmlLoadFile( "serverrules.xml" ) local contents1 = xmlNodeGetValue( xml1 ) local xml2 = xmlLoadFile( "serverrules2.xml" ) local contents2 = xmlNodeGetValue( xml2 ) local xml3 = xmlLoadFile( "whatisroleplaying.xml" ) local contents3 = xmlNodeGetValue( xml3 ) local xml4 = xmlLoadFile( "powergaming.xml" ) local contents4 = xmlNodeGetValue( xml4 ) local xml5 = xmlLoadFile( "metagaming.xml" ) local contents5 = xmlNodeGetValue( xml5 ) local xml6 = xmlLoadFile( "commonsense.xml" ) local contents6 = xmlNodeGetValue( xml6 ) local xml7 = xmlLoadFile( "revengekilling.xml" ) local contents7 = xmlNodeGetValue( xml7 ) --------- guiCreateLabel(0.00,0.00,0.94,1.4,contents1,true,paneRules) guiCreateLabel(0.00,0.00,0.94,1.4,contents2,true,paneRules2) guiCreateLabel(0.02,0.04,0.94,0.92,contents3,true,tabOverview) guiCreateLabel(0.02,0.04,0.94,0.92,contents4,true,tabPowergaming) guiCreateLabel(0.02,0.04,0.94,0.92,contents5,true,tabMetagaming) guiCreateLabel(0.02,0.04,0.94,0.92,contents6,true,tabCommonSense) guiCreateLabel(0.02,0.04,0.94,0.92,contents7,true,tabRevengeKilling) showCursor ( true ) else destroyElement(myWindow) myWindow = nil showCursor(false) end end function showUpdates() if ( myWindow == nil ) then myWindow = guiCreateWindow ( 0.10, 0.10, 0.40, 0.40, "TwinGold Roleplay User Panel", true ) local tabPanel = guiCreateTabPanel ( 0, 0.1, 1, 1, true, myWindow ) local tabRules = guiCreateTab( "Stats", tabPanel ) local paneRules = guiCreateScrollPane(0.02, 0.02, 0.95, 0.95, true, tabRules) local tabRules2 = guiCreateTab( "Updates", tabPanel ) local paneRules2 = guiCreateScrollPane(0.02, 0.02, 0.95, 0.95, true, tabRules2) local tabOverview = guiCreateTab( "Server Info", tabPanel ) --------- guiScrollPaneSetScrollBars(paneRules, false, true) local xml1 = xmlLoadFile( "stats.xml" ) local contents1 = xmlNodeGetValue( xml1 ) local xml2 = xmlLoadFile( "updates.xml" ) local contents2 = xmlNodeGetValue( xml2 ) local xml3 = xmlLoadFile( "serverinfo.xml" ) local contents3 = xmlNodeGetValue( xml3 ) --------- guiCreateLabel(0.00,0.00,0.94,1.4,contents1,true,paneStats) guiCreateLabel(0.00,0.00,0.94,1.4,contents2,true,paneUpdates) guiCreateLabel(0.02,0.04,0.94,0.92,contents3,true,tabServerInfo) showCursor ( true ) else destroyElement(myWindow) myWindow = nil showCursor(false) end end Is there something wrong? Every line between 80-90 shows an error. "Expected string" & "Bad argument" xml shows behind the chatbox.. Link to comment
Castillo Posted February 21, 2012 Share Posted February 21, 2012 addEventHandler("onClientResourceStart",resourceRoot, function() GUIEditor_Button = {} GUIEditor_Button[1] = guiCreateButton(732,9,63,18,"Updates",false) guiSetAlpha(GUIEditor_Button[1],0) GUIEditor_Button[2] = guiCreateButton(737,6,58,20,"Updates",false) GUIEditor_Button[3] = guiCreateButton(685,6,47,21,"Rules",false) addEventHandler("onClientGUIClick", GUIEditor_Button[3], showRules) addEventHandler("onClientGUIClick", GUIEditor_Button[2], showUpdates) end ) function showRules() if ( myWindow == nil ) then myWindow = guiCreateWindow ( 0.10, 0.10, 0.80, 0.80, "TwinGold Roleplay Server Rules [F9 Toggle]", true ) local tabPanel = guiCreateTabPanel ( 0, 0.1, 1, 1, true, myWindow ) local tabRules = guiCreateTab( "Rules", tabPanel ) local paneRules = guiCreateScrollPane(0.02, 0.02, 0.95, 0.95, true, tabRules) local tabRules2 = guiCreateTab( "Rules II", tabPanel ) local paneRules2 = guiCreateScrollPane(0.02, 0.02, 0.95, 0.95, true, tabRules2) local tabOverview = guiCreateTab( "Roleplay Overview", tabPanel ) local tabPowergaming = guiCreateTab( "Powergaming", tabPanel ) local tabMetagaming = guiCreateTab( "Metagaming", tabPanel ) local tabCommonSense = guiCreateTab( "Common Sense", tabPanel ) local tabRevengeKilling = guiCreateTab( "Revenge Killing", tabPanel ) --------- guiScrollPaneSetScrollBars(paneRules, false, true) local xml1 = xmlLoadFile( "serverrules.xml" ) local contents1 = xmlNodeGetValue( xml1 ) local xml2 = xmlLoadFile( "serverrules2.xml" ) local contents2 = xmlNodeGetValue( xml2 ) local xml3 = xmlLoadFile( "whatisroleplaying.xml" ) local contents3 = xmlNodeGetValue( xml3 ) local xml4 = xmlLoadFile( "powergaming.xml" ) local contents4 = xmlNodeGetValue( xml4 ) local xml5 = xmlLoadFile( "metagaming.xml" ) local contents5 = xmlNodeGetValue( xml5 ) local xml6 = xmlLoadFile( "commonsense.xml" ) local contents6 = xmlNodeGetValue( xml6 ) local xml7 = xmlLoadFile( "revengekilling.xml" ) local contents7 = xmlNodeGetValue( xml7 ) --------- guiCreateLabel(0.00,0.00,0.94,1.4,tostring(contents1),true,paneRules) guiCreateLabel(0.00,0.00,0.94,1.4,tostring(contents2),true,paneRules2) guiCreateLabel(0.02,0.04,0.94,0.92,tostring(contents3),true,tabOverview) guiCreateLabel(0.02,0.04,0.94,0.92,tostring(contents4),true,tabPowergaming) guiCreateLabel(0.02,0.04,0.94,0.92,tostring(contents5),true,tabMetagaming) guiCreateLabel(0.02,0.04,0.94,0.92,tostring(contents6),true,tabCommonSense) guiCreateLabel(0.02,0.04,0.94,0.92,tostring(contents7),true,tabRevengeKilling) showCursor ( true ) else destroyElement(myWindow) myWindow = nil showCursor(false) end end function showUpdates() if ( myWindow == nil ) then myWindow = guiCreateWindow ( 0.10, 0.10, 0.40, 0.40, "TwinGold Roleplay User Panel", true ) local tabPanel = guiCreateTabPanel ( 0, 0.1, 1, 1, true, myWindow ) local tabRules = guiCreateTab( "Stats", tabPanel ) local paneRules = guiCreateScrollPane(0.02, 0.02, 0.95, 0.95, true, tabRules) local tabRules2 = guiCreateTab( "Updates", tabPanel ) local paneRules2 = guiCreateScrollPane(0.02, 0.02, 0.95, 0.95, true, tabRules2) local tabOverview = guiCreateTab( "Server Info", tabPanel ) --------- guiScrollPaneSetScrollBars(paneRules, false, true) local xml1 = xmlLoadFile( "stats.xml" ) local contents1 = xmlNodeGetValue( xml1 ) local xml2 = xmlLoadFile( "updates.xml" ) local contents2 = xmlNodeGetValue( xml2 ) local xml3 = xmlLoadFile( "serverinfo.xml" ) local contents3 = xmlNodeGetValue( xml3 ) --------- guiCreateLabel(0.00,0.00,0.94,1.4,tostring(contents1),true,paneStats) guiCreateLabel(0.00,0.00,0.94,1.4,tostring(contents2),true,paneUpdates) guiCreateLabel(0.02,0.04,0.94,0.92,tostring(contents3),true,tabServerInfo) showCursor ( true ) else destroyElement(myWindow) myWindow = nil showCursor(false) end end It means the content obtained is nil, I added to convert the content to a string, it won't output these errors anymore. Link to comment
Absence2 Posted February 21, 2012 Author Share Posted February 21, 2012 Working now I had to make seperate .lua to make it work but how do I add .lua in the .xml so it displays char stats (like the script above)?? Link to comment
Castillo Posted February 21, 2012 Share Posted February 21, 2012 What do you mean? XML is used to store data. Link to comment
Absence2 Posted February 21, 2012 Author Share Posted February 21, 2012 I'm trying to make one of the tab to be able to use LUA within it, the "stats" tabpanel so it displays the player "looking" at the 'stats' panel >> their stats, like Char name: IP: and so on, like in the different script on page 1. I need to use LUA in one tabpanel.. but how? EDIT: like this: addEventHandler( "onClientRender", getRootElement(), function() if guiGetVisible(Window) and isElement( player ) then guiSetText ( Label[1], "Name: " .. getPlayerName(player) .. " (" .. getElementData( player, "gameaccountusername" ) .. ")") local x, y, z = getElementPosition(player) guiSetText ( Label[13], "X: " .. x ) guiSetText ( Label[14], "Y: " .. y ) guiSetText ( Label[15], "Z: " .. z ) guiSetText ( Label[3], "Money: $" .. exports.global:getMoney( player ) .. " (Bank: $" .. getElementData( player, "bankmoney" ) .. ")") guiSetText ( Label[4], "Health: " .. math.ceil( getElementHealth( player ) ) ) guiSetText ( Label[5], "Armour: " .. math.ceil( getPedArmor( player ) ) ) guiSetText ( Label[6], "Skin: " .. getElementModel( player ) ) local weapon = getPedWeapon( player ) if weapon then weapon = getWeaponNameFromID( weapon ) else weapon = "N/A" end guiSetText ( Label[7], "Weapon: " .. weapon ) local team = getPlayerTeam(player) if team then guiSetText ( Label[8], "Faction: " .. getTeamName(team) ) else guiSetText ( Label[8], "Faction: N/A") end guiSetText ( Label[9], "Ping: " .. getPlayerPing( player ) ) local vehicle = getPedOccupiedVehicle( player ) if vehicle then guiSetText ( Label[10], "Vehicle: " .. getVehicleName( vehicle ) .. " (" ..getElementData( vehicle, "dbid" ) .. ")" ) else guiSetText ( Label[10], "Vehicle: N/A") end guiSetText ( Label[12], "Location: " .. getZoneName( x, y, z ) ) guiSetText ( Label[16], "Interior: " .. getElementInterior( player ) ) guiSetText ( Label[17], "Dimension: " .. getElementDimension( player ) ) guiSetText ( Label[20], "Hours Ingame: " .. ( getElementData( player, "hoursplayed" ) or 0 ) ) end end ) Link to comment
drk Posted February 21, 2012 Share Posted February 21, 2012 I'm trying to make one of the tab to be able to use LUA within it, the "stats" tabpanel so it displays the player "looking" at the 'stats' panel >> their stats, like Char name: IP: and so on, like in the different script on page 1. I need to use LUA in one tabpanel.. but how? EDIT: like this: addEventHandler( "onClientRender", getRootElement(), function() if guiGetVisible(Window) and isElement( player ) then guiSetText ( Label[1], "Name: " .. getPlayerName(player) .. " (" .. getElementData( player, "gameaccountusername" ) .. ")") local x, y, z = getElementPosition(player) guiSetText ( Label[13], "X: " .. x ) guiSetText ( Label[14], "Y: " .. y ) guiSetText ( Label[15], "Z: " .. z ) guiSetText ( Label[3], "Money: $" .. exports.global:getMoney( player ) .. " (Bank: $" .. getElementData( player, "bankmoney" ) .. ")") guiSetText ( Label[4], "Health: " .. math.ceil( getElementHealth( player ) ) ) guiSetText ( Label[5], "Armour: " .. math.ceil( getPedArmor( player ) ) ) guiSetText ( Label[6], "Skin: " .. getElementModel( player ) ) local weapon = getPedWeapon( player ) if weapon then weapon = getWeaponNameFromID( weapon ) else weapon = "N/A" end guiSetText ( Label[7], "Weapon: " .. weapon ) local team = getPlayerTeam(player) if team then guiSetText ( Label[8], "Faction: " .. getTeamName(team) ) else guiSetText ( Label[8], "Faction: N/A") end guiSetText ( Label[9], "Ping: " .. getPlayerPing( player ) ) local vehicle = getPedOccupiedVehicle( player ) if vehicle then guiSetText ( Label[10], "Vehicle: " .. getVehicleName( vehicle ) .. " (" ..getElementData( vehicle, "dbid" ) .. ")" ) else guiSetText ( Label[10], "Vehicle: N/A") end guiSetText ( Label[12], "Location: " .. getZoneName( x, y, z ) ) guiSetText ( Label[16], "Interior: " .. getElementInterior( player ) ) guiSetText ( Label[17], "Dimension: " .. getElementDimension( player ) ) guiSetText ( Label[20], "Hours Ingame: " .. ( getElementData( player, "hoursplayed" ) or 0 ) ) end end ) I need to use LUA in one tabpanel LOL Lua is a scripting language. All you are doing is in Lua. And I don't understand this: I'm trying to make one of the tab to be able to use LUA within it, the "stats" tabpanel so it displays the player "looking" at the 'stats' panel >> their stats Explain in English Link to comment
Absence2 Posted February 22, 2012 Author Share Posted February 22, 2012 The text/content is in .xml, which means, I can't use "lua" > functions, handlers.. and so on, do you understand now? I tried this: myWindow = nil pressed = false ----------------------[KEY BINDS]-------------------- function bindKeys() bindKey("F4", "down", F4Uc) end addEventHandler("onClientResourceStart", getRootElement(), bindKeys) function resetState() pressed = false end ---------------------------[HELP]-------------------- function F4Uc( key, keyState ) if not (pressed) then pressed = true setTimer(resetState, 200, 1) if ( myWindow == nil ) then myWindow = guiCreateWindow ( 0.20, 0.20, 0.6, 0.6, "Test Window", true ) Label = { guiCreateLabel(0.20, 0.20, 0.6, 0.6,"Name: N/A",true,Window), guiCreateLabel(0.20, 0.21, 0.6, 0.6,"IP: N/A",true,Window), guiCreateLabel(0.03,0.34,0.66,0.0887,"Money: N/A",true,Window), guiCreateLabel(0.03,0.39,0.17,0.0806,"Health: N/A",true,Window), guiCreateLabel(0.20,0.39,0.30,0.0806,"Armour: N/A",true,Window), guiCreateLabel(0.03,0.44,0.17,0.0806,"Skin: N/A",true,Window), guiCreateLabel(0.20,0.44,0.30,0.0806,"Weapon: N/A",true,Window), guiCreateLabel(0.03,0.49,0.66,0.0806,"Faction: N/A",true,Window), guiCreateLabel(0.03,0.27,0.66,0.0806,"Ping: N/A",true,Window), guiCreateLabel(0.03,0.56,0.66,0.0806,"Vehicle: N/A",true,Window), guiCreateLabel(0.03,0.63,0.66,0.0806,"Warns: N/A",true,Window), guiCreateLabel(0.6,0.41,0.4031,0.0766,"Location: N/A",true,Window), guiCreateLabel(0.6,0.12,0.4031,0.0766,"X:",true,Window), guiCreateLabel(0.6,0.17,0.4031,0.0766,"Y: N/A",true,Window), guiCreateLabel(0.6,0.22,0.4031,0.0766,"Z: N/A",true,Window), guiCreateLabel(0.6,0.29,0.2907,0.0806,"Interior: N/A",true,Window), guiCreateLabel(0.6,0.34,0.2907,0.0806,"Dimension: N/A",true,Window), guiCreateLabel(0.03,0.17,0.66,0.0887,"Admin Level: N/A", true,Window), guiCreateLabel(0.03,0.22,0.66,0.0887,"Donator Level: N/A",true,Window), guiCreateLabel(0.6,0.48,0.4093,0.0806,"Hours Ingame: N/A",true,Window), } addEventHandler( "onClientRender", getRootElement(), function() if guiGetVisible(Window) and isElement( player ) then guiSetText ( Label[1], "Name: " .. getPlayerName(player) .. " (" .. getElementData( player, "gameaccountusername" ) .. ")") local x, y, z = getElementPosition(player) guiSetText ( Label[13], "X: " .. x ) guiSetText ( Label[14], "Y: " .. y ) guiSetText ( Label[15], "Z: " .. z ) guiSetText ( Label[3], "Money: $" .. exports.global:getMoney( player ) .. " (Bank: $" .. getElementData( player, "bankmoney" ) .. ")") guiSetText ( Label[4], "Health: " .. math.ceil( getElementHealth( player ) ) ) guiSetText ( Label[5], "Armour: " .. math.ceil( getPedArmor( player ) ) ) guiSetText ( Label[6], "Skin: " .. getElementModel( player ) ) local weapon = getPedWeapon( player ) if weapon then weapon = getWeaponNameFromID( weapon ) else weapon = "N/A" end guiSetText ( Label[7], "Weapon: " .. weapon ) local team = getPlayerTeam(player) if team then guiSetText ( Label[8], "Faction: " .. getTeamName(team) ) else guiSetText ( Label[8], "Faction: N/A") end guiSetText ( Label[9], "Ping: " .. getPlayerPing( player ) ) local vehicle = getPedOccupiedVehicle( player ) if vehicle then guiSetText ( Label[10], "Vehicle: " .. getVehicleName( vehicle ) .. " (" ..getElementData( vehicle, "dbid" ) .. ")" ) else guiSetText ( Label[10], "Vehicle: N/A") end guiSetText ( Label[12], "Location: " .. getZoneName( x, y, z ) ) guiSetText ( Label[16], "Interior: " .. getElementInterior( player ) ) guiSetText ( Label[17], "Dimension: " .. getElementDimension( player ) ) guiSetText ( Label[20], "Hours Ingame: " .. ( getElementData( player, "hoursplayed" ) or 0 ) ) end end end ERROR: 87: ) expected (to close ( at line 44 Link to comment
Castillo Posted February 22, 2012 Share Posted February 22, 2012 myWindow = nil pressed = false player = localPlayer ----------------------[KEY BINDS]-------------------- function bindKeys() bindKey("F4", "down", F4Uc) end addEventHandler("onClientResourceStart", getRootElement(), bindKeys) function resetState() pressed = false end ---------------------------[HELP]-------------------- function F4Uc( key, keyState ) if not (pressed) then pressed = true setTimer(resetState, 200, 1) if ( myWindow == nil ) then myWindow = guiCreateWindow ( 0.20, 0.20, 0.6, 0.6, "Test Window", true ) Label = { guiCreateLabel(0.20, 0.20, 0.6, 0.6,"Name: N/A",true,Window), guiCreateLabel(0.20, 0.21, 0.6, 0.6,"IP: N/A",true,Window), guiCreateLabel(0.03,0.34,0.66,0.0887,"Money: N/A",true,Window), guiCreateLabel(0.03,0.39,0.17,0.0806,"Health: N/A",true,Window), guiCreateLabel(0.20,0.39,0.30,0.0806,"Armour: N/A",true,Window), guiCreateLabel(0.03,0.44,0.17,0.0806,"Skin: N/A",true,Window), guiCreateLabel(0.20,0.44,0.30,0.0806,"Weapon: N/A",true,Window), guiCreateLabel(0.03,0.49,0.66,0.0806,"Faction: N/A",true,Window), guiCreateLabel(0.03,0.27,0.66,0.0806,"Ping: N/A",true,Window), guiCreateLabel(0.03,0.56,0.66,0.0806,"Vehicle: N/A",true,Window), guiCreateLabel(0.03,0.63,0.66,0.0806,"Warns: N/A",true,Window), guiCreateLabel(0.6,0.41,0.4031,0.0766,"Location: N/A",true,Window), guiCreateLabel(0.6,0.12,0.4031,0.0766,"X:",true,Window), guiCreateLabel(0.6,0.17,0.4031,0.0766,"Y: N/A",true,Window), guiCreateLabel(0.6,0.22,0.4031,0.0766,"Z: N/A",true,Window), guiCreateLabel(0.6,0.29,0.2907,0.0806,"Interior: N/A",true,Window), guiCreateLabel(0.6,0.34,0.2907,0.0806,"Dimension: N/A",true,Window), guiCreateLabel(0.03,0.17,0.66,0.0887,"Admin Level: N/A", true,Window), guiCreateLabel(0.03,0.22,0.66,0.0887,"Donator Level: N/A",true,Window), guiCreateLabel(0.6,0.48,0.4093,0.0806,"Hours Ingame: N/A",true,Window), } end end end addEventHandler( "onClientRender", getRootElement(), function() if isElement(myWindow) and guiGetVisible(myWindow) then guiSetText ( Label[1], "Name: " .. getPlayerName(player) .. " (" .. getElementData( player, "gameaccountusername" ) .. ")") local x, y, z = getElementPosition(player) guiSetText ( Label[13], "X: " .. x ) guiSetText ( Label[14], "Y: " .. y ) guiSetText ( Label[15], "Z: " .. z ) guiSetText ( Label[3], "Money: $" .. exports.global:getMoney( player ) .. " (Bank: $" .. getElementData( player, "bankmoney" ) .. ")") guiSetText ( Label[4], "Health: " .. math.ceil( getElementHealth( player ) ) ) guiSetText ( Label[5], "Armour: " .. math.ceil( getPedArmor( player ) ) ) guiSetText ( Label[6], "Skin: " .. getElementModel( player ) ) local weapon = getPedWeapon( player ) if weapon then weapon = getWeaponNameFromID( weapon ) else weapon = "N/A" end guiSetText ( Label[7], "Weapon: " .. weapon ) local team = getPlayerTeam(player) if team then guiSetText ( Label[8], "Faction: " .. getTeamName(team) ) else guiSetText ( Label[8], "Faction: N/A") end guiSetText ( Label[9], "Ping: " .. getPlayerPing( player ) ) local vehicle = getPedOccupiedVehicle( player ) if vehicle then guiSetText ( Label[10], "Vehicle: " .. getVehicleName( vehicle ) .. " (" ..getElementData( vehicle, "dbid" ) .. ")" ) else guiSetText ( Label[10], "Vehicle: N/A") end guiSetText ( Label[12], "Location: " .. getZoneName( x, y, z ) ) guiSetText ( Label[16], "Interior: " .. getElementInterior( player ) ) guiSetText ( Label[17], "Dimension: " .. getElementDimension( player ) ) guiSetText ( Label[20], "Hours Ingame: " .. ( getElementData( player, "hoursplayed" ) or 0 ) ) end end ) Link to comment
Kenix Posted February 22, 2012 Share Posted February 22, 2012 myWindow = nil pressed = false player = localPlayer function resetState( ) pressed = false end ---------------------------[HELP]-------------------- function F4Uc( key, keyState ) if not (pressed) then pressed = true setTimer(resetState, 200, 1) if not myWindow then myWindow = guiCreateWindow ( 0.20, 0.20, 0.6, 0.6, "Test Window", true ) Label = { guiCreateLabel(0.20, 0.20, 0.6, 0.6,"Name: N/A",true,Window), guiCreateLabel(0.20, 0.21, 0.6, 0.6,"IP: N/A",true,Window), guiCreateLabel(0.03,0.34,0.66,0.0887,"Money: N/A",true,Window), guiCreateLabel(0.03,0.39,0.17,0.0806,"Health: N/A",true,Window), guiCreateLabel(0.20,0.39,0.30,0.0806,"Armour: N/A",true,Window), guiCreateLabel(0.03,0.44,0.17,0.0806,"Skin: N/A",true,Window), guiCreateLabel(0.20,0.44,0.30,0.0806,"Weapon: N/A",true,Window), guiCreateLabel(0.03,0.49,0.66,0.0806,"Faction: N/A",true,Window), guiCreateLabel(0.03,0.27,0.66,0.0806,"Ping: N/A",true,Window), guiCreateLabel(0.03,0.56,0.66,0.0806,"Vehicle: N/A",true,Window), guiCreateLabel(0.03,0.63,0.66,0.0806,"Warns: N/A",true,Window), guiCreateLabel(0.6,0.41,0.4031,0.0766,"Location: N/A",true,Window), guiCreateLabel(0.6,0.12,0.4031,0.0766,"X:",true,Window), guiCreateLabel(0.6,0.17,0.4031,0.0766,"Y: N/A",true,Window), guiCreateLabel(0.6,0.22,0.4031,0.0766,"Z: N/A",true,Window), guiCreateLabel(0.6,0.29,0.2907,0.0806,"Interior: N/A",true,Window), guiCreateLabel(0.6,0.34,0.2907,0.0806,"Dimension: N/A",true,Window), guiCreateLabel(0.03,0.17,0.66,0.0887,"Admin Level: N/A", true,Window), guiCreateLabel(0.03,0.22,0.66,0.0887,"Donator Level: N/A",true,Window), guiCreateLabel(0.6,0.48,0.4093,0.0806,"Hours Ingame: N/A",true,Window), } end end end bindKey( "F4", "down", F4Uc ) addEventHandler( "onClientRender", root, function() if isElement( myWindow ) and guiGetVisible( myWindow ) then guiSetText ( Label[1], "Name: " .. getPlayerName(player) .. " (" ..tostring( getElementData( player, "gameaccountusername" ) ) .. ")") local x, y, z = getElementPosition(player) guiSetText ( Label[13], "X: " .. x ) guiSetText ( Label[14], "Y: " .. y ) guiSetText ( Label[15], "Z: " .. z ) guiSetText ( Label[3], "Money: $" .. tostring( exports.global:getMoney( player ) ) .. " (Bank: $" .. tostring( getElementData( player, "bankmoney" ) ) .. ")") guiSetText ( Label[4], "Health: " .. tostring( math.ceil( getElementHealth( player ) ) ) ) guiSetText ( Label[5], "Armour: " .. tostring( math.ceil( getPedArmor( player ) ) ) ) guiSetText ( Label[6], "Skin: " .. tostring( getElementModel( player ) ) ) local weapon = getPedWeapon( player ) if weapon then weapon = getWeaponNameFromID( weapon ) else weapon = "N/A" end guiSetText ( Label[7], "Weapon: " ..tostring( weapon ) ) local team = getPlayerTeam(player) if team then guiSetText ( Label[8], "Faction: " ..tostring( getTeamName( team ) ) ) else guiSetText ( Label[8], "Faction: N/A") end guiSetText ( Label[9], "Ping: " ..tostring( getPlayerPing( player ) ) ) local vehicle = getPedOccupiedVehicle( player ) if vehicle then guiSetText ( Label[10], "Vehicle: " .. getVehicleName( vehicle ) .. " (" ..tostring( getElementData( vehicle, "dbid" ) ) .. ")" ) else guiSetText ( Label[10], "Vehicle: N/A") end guiSetText ( Label[12], "Location: " .. tostring( getZoneName( x, y, z ) ) ) guiSetText ( Label[16], "Interior: " .. tostring( getElementInterior( player ) ) ) guiSetText ( Label[17], "Dimension: " .. tostring( getElementDimension( player ) ) ) guiSetText ( Label[20], "Hours Ingame: " .. tostring( getElementData( player, "hoursplayed" ) or 0 ) ) end end ) Almost functions where guiSetText return number value ( not string ) then need convert to string. Link to comment
Absence2 Posted February 22, 2012 Author Share Posted February 22, 2012 Doesn't work, the window just goes blank + no errors. edit: it also doesn't let people toggle the window, which is weird If you press F4, that window will never go away until you log I think I figured one out but .. error: 86: bad argument @ destroyelement this is what I got now: myWindow = nil pressed = false player = localPlayer function resetState( ) pressed = false end ---------------------------[HELP]-------------------- function F4Uc( key, keyState ) if not (pressed) then pressed = true setTimer(resetState, 200, 1) if not myWindow then myWindow = guiCreateWindow ( 0.20, 0.20, 0.6, 0.6, "Test Window", true ) Label = { guiCreateLabel(15 , 24, 220, 17,"Name: N/A",true,Window), guiCreateLabel(15 , 24 ,220 , 17,"IP: N/A",true,Window), guiCreateLabel(0.03,0.34,0.66,0.0887,"Money: N/A",true,Window), guiCreateLabel(0.03,0.39,0.17,0.0806,"Health: N/A",true,Window), guiCreateLabel(0.20,0.39,0.30,0.0806,"Armour: N/A",true,Window), guiCreateLabel(0.03,0.44,0.17,0.0806,"Skin: N/A",true,Window), guiCreateLabel(0.20,0.44,0.30,0.0806,"Weapon: N/A",true,Window), guiCreateLabel(0.03,0.49,0.66,0.0806,"Faction: N/A",true,Window), guiCreateLabel(0.03,0.27,0.66,0.0806,"Ping: N/A",true,Window), guiCreateLabel(0.03,0.56,0.66,0.0806,"Vehicle: N/A",true,Window), guiCreateLabel(0.03,0.63,0.66,0.0806,"Warns: N/A",true,Window), guiCreateLabel(0.6,0.41,0.4031,0.0766,"Location: N/A",true,Window), guiCreateLabel(0.6,0.12,0.4031,0.0766,"X:",true,Window), guiCreateLabel(0.6,0.17,0.4031,0.0766,"Y: N/A",true,Window), guiCreateLabel(0.6,0.22,0.4031,0.0766,"Z: N/A",true,Window), guiCreateLabel(0.6,0.29,0.2907,0.0806,"Interior: N/A",true,Window), guiCreateLabel(0.6,0.34,0.2907,0.0806,"Dimension: N/A",true,Window), guiCreateLabel(0.03,0.17,0.66,0.0887,"Admin Level: N/A", true,Window), guiCreateLabel(0.03,0.22,0.66,0.0887,"Donator Level: N/A",true,Window), guiCreateLabel(0.6,0.48,0.4093,0.0806,"Hours Ingame: N/A",true,Window), } end end end bindKey( "F4", "down", F4Uc ) addEventHandler( "onClientRender", root, function() if isElement( myWindow ) and guiGetVisible( myWindow ) then guiSetText ( Label[1], "Name: " .. getPlayerName(player) .. " (" ..tostring( getElementData( player, "gameaccountusername" ) ) .. ")") local x, y, z = getElementPosition(player) guiSetText ( Label[13], "X: " .. x ) guiSetText ( Label[14], "Y: " .. y ) guiSetText ( Label[15], "Z: " .. z ) guiSetText ( Label[3], "Money: $" .. tostring( exports.global:getMoney( player ) ) .. " (Bank: $" .. tostring( getElementData( player, "bankmoney" ) ) .. ")") guiSetText ( Label[4], "Health: " .. tostring( math.ceil( getElementHealth( player ) ) ) ) guiSetText ( Label[5], "Armour: " .. tostring( math.ceil( getPedArmor( player ) ) ) ) guiSetText ( Label[6], "Skin: " .. tostring( getElementModel( player ) ) ) local weapon = getPedWeapon( player ) if weapon then weapon = getWeaponNameFromID( weapon ) else weapon = "N/A" end guiSetText ( Label[7], "Weapon: " ..tostring( weapon ) ) local team = getPlayerTeam(player) if team then guiSetText ( Label[8], "Faction: " ..tostring( getTeamName( team ) ) ) else guiSetText ( Label[8], "Faction: N/A") end guiSetText ( Label[9], "Ping: " ..tostring( getPlayerPing( player ) ) ) local vehicle = getPedOccupiedVehicle( player ) if vehicle then guiSetText ( Label[10], "Vehicle: " .. getVehicleName( vehicle ) .. " (" ..tostring( getElementData( vehicle, "dbid" ) ) .. ")" ) else guiSetText ( Label[10], "Vehicle: N/A") end guiSetText ( Label[12], "Location: " .. tostring( getZoneName( x, y, z ) ) ) guiSetText ( Label[16], "Interior: " .. tostring( getElementInterior( player ) ) ) guiSetText ( Label[17], "Dimension: " .. tostring( getElementDimension( player ) ) ) guiSetText ( Label[20], "Hours Ingame: " .. tostring( getElementData( player, "hoursplayed" ) or 0 ) ) showCursor ( true ) else destroyElement(myWindow) myWindow = nil showCursor(false) end end ) Link to comment
drk Posted February 22, 2012 Share Posted February 22, 2012 ---------------------------[HELP]-------------------- function F4Uc( key, keyState ) if guiGetVisible(myWindow) == false then myWindow = guiCreateWindow ( 0.20, 0.20, 0.6, 0.6, "Test Window", true ) Label = { guiCreateLabel(0.20, 0.20, 0.6, 0.6,"Name: N/A",true,Window), guiCreateLabel(0.20, 0.21, 0.6, 0.6,"IP: N/A",true,Window), guiCreateLabel(0.03,0.34,0.66,0.0887,"Money: N/A",true,Window), guiCreateLabel(0.03,0.39,0.17,0.0806,"Health: N/A",true,Window), guiCreateLabel(0.20,0.39,0.30,0.0806,"Armour: N/A",true,Window), guiCreateLabel(0.03,0.44,0.17,0.0806,"Skin: N/A",true,Window), guiCreateLabel(0.20,0.44,0.30,0.0806,"Weapon: N/A",true,Window), guiCreateLabel(0.03,0.49,0.66,0.0806,"Faction: N/A",true,Window), guiCreateLabel(0.03,0.27,0.66,0.0806,"Ping: N/A",true,Window), guiCreateLabel(0.03,0.56,0.66,0.0806,"Vehicle: N/A",true,Window), guiCreateLabel(0.03,0.63,0.66,0.0806,"Warns: N/A",true,Window), guiCreateLabel(0.6,0.41,0.4031,0.0766,"Location: N/A",true,Window), guiCreateLabel(0.6,0.12,0.4031,0.0766,"X:",true,Window), guiCreateLabel(0.6,0.17,0.4031,0.0766,"Y: N/A",true,Window), guiCreateLabel(0.6,0.22,0.4031,0.0766,"Z: N/A",true,Window), guiCreateLabel(0.6,0.29,0.2907,0.0806,"Interior: N/A",true,Window), guiCreateLabel(0.6,0.34,0.2907,0.0806,"Dimension: N/A",true,Window), guiCreateLabel(0.03,0.17,0.66,0.0887,"Admin Level: N/A", true,Window), guiCreateLabel(0.03,0.22,0.66,0.0887,"Donator Level: N/A",true,Window), guiCreateLabel(0.6,0.48,0.4093,0.0806,"Hours Ingame: N/A",true,Window), } end end end bindKey( "F4", "down", F4Uc ) addEventHandler( "onClientRender", root, function() if isElement( myWindow ) and guiGetVisible( myWindow ) then guiSetText ( Label[1], "Name: " .. tostring(getPlayerName(localPlayer)) .. " (" ..tostring( getElementData( localPlayer, "gameaccountusername" ) ) .. ")") local x, y, z = getElementPosition(localPlayer) guiSetText ( Label[13], "X: " .. x ) guiSetText ( Label[14], "Y: " .. y ) guiSetText ( Label[15], "Z: " .. z ) guiSetText ( Label[3], "Money: $" .. tonumber( exports.global:getMoney( localPlayer ) ) .. " (Bank: $" .. tonumber( getElementData( localPlayer, "bankmoney" ) ) .. ")") guiSetText ( Label[4], "Health: " .. tonumber( math.ceil( getElementHealth( localPlayer ) ) ) ) guiSetText ( Label[5], "Armour: " .. tonumber( math.ceil( getPedArmor( localPlayer ) ) ) ) guiSetText ( Label[6], "Skin: " .. tostring( getElementModel( localPlayer ) ) ) local weapon = getPedWeapon( localPlayer ) if weapon then weapon = getWeaponNameFromID( weapon ) else weapon = "N/A" end guiSetText ( Label[7], "Weapon: " ..tostring( weapon ) ) local team = getPlayerTeam(localPlayer) if team then guiSetText ( Label[8], "Faction: " ..tostring( getTeamName( team ) ) ) else guiSetText ( Label[8], "Faction: N/A") end guiSetText ( Label[9], "Ping: " ..tonumber( getPlayerPing( player ) ) ) local vehicle = getPedOccupiedVehicle( localPlayer ) if vehicle then guiSetText ( Label[10], "Vehicle: " .. getVehicleName( vehicle ) .. " (" ..tostring( getElementData( vehicle, "dbid" ) ) .. ")" ) else guiSetText ( Label[10], "Vehicle: N/A") end guiSetText ( Label[12], "Location: " .. tostring( getZoneName( x, y, z ) ) ) guiSetText ( Label[16], "Interior: " .. tonumber( getElementInterior( localPlayer ) ) ) guiSetText ( Label[17], "Dimension: " .. tonumber( getElementDimension( localPlayer ) ) ) guiSetText ( Label[20], "Hours Ingame: " .. tostring( getElementData( localPlayer, "hoursplayed" ) or 0 ) ) end end ) I think it will not work, but why not try? Link to comment
Absence2 Posted February 22, 2012 Author Share Posted February 22, 2012 Yeh, it doesn't work Draken , take a look at the second last post by me I'm trying to make that one work properly, I guess it more likely that one will work above the others somehow Link to comment
Kenix Posted February 22, 2012 Share Posted February 22, 2012 I think I figured one out but .. error: 86: bad argument @ destroyelement Where this line lol? Show full code. 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