ViRuZGamiing Posted January 4, 2014 Posted January 4, 2014 Hey guys, I have this in my script no errors no debug but it doesn't work. function () local playerTeam = getPlayerTeam ( source ) == getTeamFromName ( "Police" ) if ( playerTeam ) then bindKey("F2", "down", showPolicePanel) end end ) "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
ViRuZGamiing Posted January 4, 2014 Author Posted January 4, 2014 Still don't work; Full script >> GUIEditor = { gridlist = {}, window = {}, button = {} } addEventHandler("onClientResourceStart", resourceRoot, function() --WINDOW policeWindow = guiCreateWindow (375, 125, 500, 500, "Police Panel", false) guiWindowSetSizable (policeWindow, false) guiWindowSetMovable (policeWindow, false) guiSetVisible (policeWindow, false) -- GRIDLIST policeGridList = guiCreateGridList (16, 35, 240, 444, false, policeWindow) policeNameList = guiGridListAddColumn (policeGridList, "Name", 0.4) local row = guiGridListAddRow(policeGridList) for _, player in ipairs ( getElementsByType ( "player" ) ) do guiGridListSetItemText ( policeGridList, row, policeNameList, (string.gsub ( getPlayerName ( player ), '#%x%x%x%x%x%x', '' ) or getPlayerName(player)), false, false) guiGridListSetItemData ( policeGridList, row, policeNameList, getPlayerName(player)) end policeWantedLevelList = guiGridListAddColumn (policeGridList, "Wanted", 0.4) for _, player in ipairs ( getElementsByType ( "player" ) ) do guiGridListSetItemText ( policeGridList, row, policeWantedLevelList, (string.gsub ( getPlayerWantedLevel ( player ), '#%x%x%x%x%x%x', '' ) or getPlayerWantedLevel(player)), false, false) guiGridListSetItemData ( policeGridList, row, policeWantedLevelList, getPlayerWantedLevel(player)) end --BUTTONS -- Close Button policeCloseButton = guiCreateButton (272, 430, 218, 39, "Close", false, policeWindow) -- Track Player policeTrackPlayerButton = guiCreateButton (272, 378, 218, 39, "Track Player", false, policeWindow) addEventHandler("onClientGUIClick", policeTrackPlayerButton, function () local playerName = guiGridListGetItemText ( policeGridList, guiGridListGetSelectedItem ( policeGridList ), 1 ) createBlip (playerName, 58) end ) -- Bind Key F2 addEventHandler("onClientResourceStart", resourceRoot, function () local playerTeam = getPlayerTeam ( localPlayer ) == getTeamFromName ( "Police" ) if ( playerTeam ) then bindKey("F2", "down", showPolicePanel) end end ) addEventHandler("onClientGUIClick", policeCloseButton, hidePolicePanel) end ) function showPolicePanel () guiSetVisible (policeWindow, true) showCursor (true) end function hidePolicePanel () guiSetVisible (policeWindow, false) showCursor (false) end "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
DNL291 Posted January 4, 2014 Posted January 4, 2014 Try this: addEventHandler("onClientResourceStart", resourceRoot, function() --WINDOW policeWindow = guiCreateWindow (375, 125, 500, 500, "Police Panel", false) guiWindowSetSizable (policeWindow, false) guiWindowSetMovable (policeWindow, false) guiSetVisible (policeWindow, false) -- GRIDLIST policeGridList = guiCreateGridList (16, 35, 240, 444, false, policeWindow) policeNameList = guiGridListAddColumn (policeGridList, "Name", 0.4) local row = guiGridListAddRow(policeGridList) for _, player in ipairs ( getElementsByType ( "player" ) ) do guiGridListSetItemText ( policeGridList, row, policeNameList, (string.gsub ( getPlayerName ( player ), '#%x%x%x%x%x%x', '' ) or getPlayerName(player)), false, false) guiGridListSetItemData ( policeGridList, row, policeNameList, getPlayerName(player)) end policeWantedLevelList = guiGridListAddColumn (policeGridList, "Wanted", 0.4) for _, player in ipairs ( getElementsByType ( "player" ) ) do guiGridListSetItemText ( policeGridList, row, policeWantedLevelList, (string.gsub ( getPlayerWantedLevel ( player ), '#%x%x%x%x%x%x', '' ) or getPlayerWantedLevel(player)), false, false) guiGridListSetItemData ( policeGridList, row, policeWantedLevelList, getPlayerWantedLevel(player)) end --BUTTONS -- Close Button policeCloseButton = guiCreateButton (272, 430, 218, 39, "Close", false, policeWindow) -- Track Player policeTrackPlayerButton = guiCreateButton (272, 378, 218, 39, "Track Player", false, policeWindow) addEventHandler("onClientGUIClick", policeTrackPlayerButton, function () local playerName = guiGridListGetItemText ( policeGridList, guiGridListGetSelectedItem ( policeGridList ), 1 ) createBlip (playerName, 58) end ) -- Bind Key F2 bindKey("F2", "down", showPolicePanel) addEventHandler("onClientGUIClick", policeCloseButton, hidePolicePanel) end ) function showPolicePanel () local playerTeam = getPlayerTeam ( localPlayer ) if (playerTeam) and (playerTeam == getTeamFromName("Police")) then guiSetVisible (policeWindow, true) showCursor (true) end end function hidePolicePanel () guiSetVisible (policeWindow, false) showCursor (false) end Please do not PM me with scripting related question nor support, use the forums instead.
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