Lukkaz Posted January 4, 2011 Share Posted January 4, 2011 I added two buttons to the admin panel and they arn't click-able....I have tried everything and still nothing anyone else tried anything like this with similar results? Link to comment
Castillo Posted January 4, 2011 Share Posted January 4, 2011 well, i added a "Give moderator" button to the admin panel and it works fine. Link to comment
Lukkaz Posted January 4, 2011 Author Share Posted January 4, 2011 function aAdminMenu () if ( aAdminForm == nil ) then local x, y = guiGetScreenSize() aAdminForm = guiCreateWindow ( x / 2 - 310, y / 2 - 260, 620, 520, "", false ) guiWindowSetSizable ( aAdminForm, false ) guiSetText ( aAdminForm, "Admin Panel - v".._version ) guiCreateLabel ( 0.75, 0.05, 0.45, 0.04, "Strange Gaming", true, aAdminForm ) aTabPanel = guiCreateTabPanel ( 0.01, 0.05, 0.98, 0.95, true, aAdminForm ) aTab1 = {} aTab1.Tab = guiCreateTab ( "Players", aTabPanel, "players" ) aTab1.Messages = guiCreateButton ( 0.75, 0.02, 0.23, 0.04, "0/0 unread messages", true, aTab1.Tab ) guiSetAlpha ( aPlayerAdvanced, 0.7 ) aTab1.PlayerListSearch = guiCreateEdit ( 0.03, 0.05, 0.16, 0.04, "", true, aTab1.Tab ) guiCreateStaticImage ( 0.19, 0.05, 0.035, 0.04, "client\\images\\search.png", true, aTab1.Tab ) aTab1.HideColorCodes= guiCreateCheckBox ( 0.037, 0.94, 0.20, 0.04, "Hide color codes", true, true, aTab1.Tab ) aTab1.PlayerList = guiCreateGridList ( 0.03, 0.10, 0.20, 0.83, true, aTab1.Tab ) guiGridListAddColumn( aTab1.PlayerList, "Player Name", 0.85 ) for id, player in ipairs ( getElementsByType ( "player" ) ) do guiGridListSetItemPlayerName ( aTab1.PlayerList, guiGridListAddRow ( aTab1.PlayerList ), 1, getPlayerName ( player ), false, false ) end aTab1.Kick = guiCreateButton ( 0.71, 0.125, 0.13, 0.04, "Kick", true, aTab1.Tab, "kick" ) aTab1.Ban = guiCreateButton ( 0.85, 0.125, 0.13, 0.04, "Ban", true, aTab1.Tab, "ban" ) aTab1.Jail = guiCreateButton ( 0.71, 0.350, 0.13, 0.04, "Jail", true, aTab1.Tab, "jail" ) aTab1.Release = guiCreateButton ( 0.85, 0.350, 0.13, 0.04, "Release", true, aTab1.Tab, "release" ) aTab1.Mute = guiCreateButton ( 0.71, 0.170, 0.13, 0.04, "Mute", true, aTab1.Tab, "mute" ) aTab1.Freeze = guiCreateButton ( 0.85, 0.170, 0.13, 0.04, "Freeze", true, aTab1.Tab, "freeze" ) aTab1.Spectate = guiCreateButton ( 0.71, 0.215, 0.13, 0.04, "Spectate", true, aTab1.Tab, "spectate" ) aTab1.Slap = guiCreateButton ( 0.85, 0.215, 0.13, 0.04, "Slap! "..aCurrentSlap.." _", true, aTab1.Tab, "slap" ) aTab1.SlapDropDown = guiCreateStaticImage ( 0.95, 0.215, 0.03, 0.04, "client\\images\\dropdown.png", true, aTab1.Tab ) aTab1.SlapOptions = guiCreateGridList ( 0.85, 0.215, 0.13, 0.40, true, aTab1.Tab ) guiGridListSetSortingEnabled ( aTab1.SlapOptions, false ) guiGridListAddColumn( aTab1.SlapOptions, "", 0.85 ) guiSetVisible ( aTab1.SlapOptions, false ) for i = 0, 10 do guiGridListSetItemText ( aTab1.SlapOptions, guiGridListAddRow ( aTab1.SlapOptions ), 1, tostring ( i * 10 ), false, false ) end aTab1.Nick = guiCreateButton ( 0.71, 0.260, 0.13, 0.04, "Set Nick", true, aTab1.Tab ) aTab1.Shout = guiCreateButton ( 0.85, 0.260, 0.13, 0.04, "Shout!", true, aTab1.Tab, "shout" ) aTab1.Admin = guiCreateButton ( 0.71, 0.305, 0.27, 0.04, "Give admin rights", true, aTab1.Tab, "setgroup" ) guiCreateHeader ( 0.25, 0.08, 0.20, 0.04, "Player:", true, aTab1.Tab ) aTab1.Name = guiCreateLabel ( 0.26, 0.125, 0.30, 0.035, "Name: N/A", true, aTab1.Tab ) aTab1.IP = guiCreateLabel ( 0.26, 0.170, 0.30, 0.035, "IP: N/A", true, aTab1.Tab ) aTab1.Serial = guiCreateLabel ( 0.26, 0.215, 0.435, 0.035, "Serial: N/A", true, aTab1.Tab ) --aTab1.Username = guiCreateLabel ( 0.26, 0.245, 0.435, 0.035, "Username: N/A", true, aTab1.Tab ) aTab1.Version = guiCreateLabel ( 0.26, 0.245, 0.435, 0.035, "Version: N/A", true, aTab1.Tab ) aTab1.Accountname = guiCreateLabel ( 0.26, 0.275, 0.435, 0.035, "Account Name: N/A", true, aTab1.Tab ) aTab1.Groups = guiCreateLabel ( 0.26, 0.305, 0.435, 0.035, "Groups: N/A", true, aTab1.Tab ) aTab1.Flag = guiCreateStaticImage ( 0.40, 0.125, 0.025806, 0.021154, "client\\images\\empty.png", true, aTab1.Tab ) guiCreateHeader ( 0.25, 0.350, 0.20, 0.04, "Game:", true, aTab1.Tab ) aTab1.Health = guiCreateLabel ( 0.26, 0.395, 0.20, 0.04, "Health: 0%", true, aTab1.Tab ) aTab1.Armour = guiCreateLabel ( 0.45, 0.395, 0.20, 0.04, "Armour: 0%", true, aTab1.Tab ) aTab1.Skin = guiCreateLabel ( 0.26, 0.440, 0.20, 0.04, "Skin: N/A", true, aTab1.Tab ) aTab1.Team = guiCreateLabel ( 0.45, 0.440, 0.20, 0.04, "Team: None", true, aTab1.Tab ) aTab1.Weapon = guiCreateLabel ( 0.26, 0.485, 0.35, 0.04, "Weapon: N/A", true, aTab1.Tab ) aTab1.Ping = guiCreateLabel ( 0.26, 0.530, 0.20, 0.04, "Ping: 0", true, aTab1.Tab ) aTab1.Money = guiCreateLabel ( 0.45, 0.530, 0.20, 0.04, "Money: 0", true, aTab1.Tab ) aTab1.Area = guiCreateLabel ( 0.26, 0.575, 0.44, 0.04, "Area: Unknown", true, aTab1.Tab ) aTab1.PositionX = guiCreateLabel ( 0.26, 0.620, 0.30, 0.04, "X: 0", true, aTab1.Tab ) aTab1.PositionY = guiCreateLabel ( 0.26, 0.665, 0.30, 0.04, "Y: 0", true, aTab1.Tab ) aTab1.PositionZ = guiCreateLabel ( 0.26, 0.710, 0.30, 0.04, "Z: 0", true, aTab1.Tab ) aTab1.Dimension = guiCreateLabel ( 0.26, 0.755, 0.20, 0.04, "Dimension: 0", true, aTab1.Tab ) aTab1.Interior = guiCreateLabel ( 0.45, 0.755, 0.20, 0.04, "Interior: 0", true, aTab1.Tab ) aTab1.SetHealth = guiCreateButton ( 0.71, 0.395, 0.13, 0.04, "Set Health", true, aTab1.Tab, "sethealth" ) aTab1.SetArmour = guiCreateButton ( 0.85, 0.395, 0.13, 0.04, "Set Armour", true, aTab1.Tab, "setarmour" ) aTab1.SetSkin = guiCreateButton ( 0.71, 0.440, 0.13, 0.04, "Set Skin", true, aTab1.Tab, "setskin" ) aTab1.SetTeam = guiCreateButton ( 0.85, 0.440, 0.13, 0.04, "Set Team", true, aTab1.Tab, "setteam" ) aTab1.SetDimension = guiCreateButton ( 0.71, 0.755, 0.13, 0.04, "Set Dimens.", true, aTab1.Tab, "setdimension" ) aTab1.SetInterior = guiCreateButton ( 0.85, 0.755, 0.13, 0.04, "Set Interior", true, aTab1.Tab, "setinterior" ) aTab1.GiveWeapon = guiCreateButton ( 0.71, 0.485, 0.27, 0.04, "Give: "..getWeaponNameFromID ( aCurrentWeapon ), true, aTab1.Tab ) aTab1.WeaponDropDown = guiCreateStaticImage ( 0.95, 0.485, 0.03, 0.04, "client\\images\\dropdown.png", true, aTab1.Tab ) aTab1.WeaponOptions = guiCreateGridList ( 0.71, 0.485, 0.27, 0.48, true, aTab1.Tab ) guiGridListAddColumn( aTab1.WeaponOptions, "", 0.85 ) guiSetVisible ( aTab1.WeaponOptions, false ) for i = 1, 46 do if ( getWeaponNameFromID ( i ) ~= false ) then guiGridListSetItemText ( aTab1.WeaponOptions, guiGridListAddRow ( aTab1.WeaponOptions ), 1, getWeaponNameFromID ( i ), false, false ) end end aTab1.SetMoney = guiCreateButton ( 0.71, 0.530, 0.13, 0.04, "Set Money", true, aTab1.Tab, "setmoney" ) aTab1.SetStats = guiCreateButton ( 0.85, 0.530, 0.13, 0.04, "Set Stats", true, aTab1.Tab, "setstat" ) aTab1.JetPack = guiCreateButton ( 0.71, 0.575, 0.27, 0.04, "Give JetPack", true, aTab1.Tab, "jetpack" ) aTab1.Warp = guiCreateButton ( 0.71, 0.620, 0.27, 0.04, "Warp to player", true, aTab1.Tab, "warp" ) aTab1.WarpTo = guiCreateButton ( 0.71, 0.665, 0.27, 0.04, "Warp player to..", true, aTab1.Tab, "warp" ) guiCreateHeader ( 0.25, 0.805, 0.20, 0.04, "Vehicle:", true, aTab1.Tab ) aTab1.Vehicle = guiCreateLabel ( 0.26, 0.850, 0.35, 0.04, "Vehicle: N/A", true, aTab1.Tab ) aTab1.VehicleHealth = guiCreateLabel ( 0.26, 0.895, 0.25, 0.04, "Vehicle Health: 0%", true, aTab1.Tab ) aTab1.VehicleFix = guiCreateButton ( 0.71, 0.84, 0.13, 0.04, "Fix", true, aTab1.Tab, "repair" ) aTab1.VehicleDestroy = guiCreateButton ( 0.71, 0.89, 0.13, 0.04, "Destroy", true, aTab1.Tab, "destroyvehicle" ) aTab1.VehicleBlow = guiCreateButton ( 0.85, 0.84, 0.13, 0.04, "Blow", true, aTab1.Tab, "blowvehicle" ) aTab1.VehicleCustomize = guiCreateButton ( 0.85, 0.89, 0.13, 0.04, "Customize", true, aTab1.Tab, "customize" ) aTab1.AnonAdmin = guiCreateCheckBox (0.745, 0.942, 0.20, 0.04, "Anonymous Admin", isAnonAdmin(), true, aTab1.Tab ) aTab1.GiveVehicle = guiCreateButton ( 0.71, 0.710, 0.27, 0.04, "Give: "..getVehicleNameFromModel ( aCurrentVehicle ), true, aTab1.Tab, "givevehicle" ) aTab1.VehicleDropDown = guiCreateStaticImage ( 0.95, 0.710, 0.03, 0.04, "client\\images\\dropdown.png", true, aTab1.Tab ) local gx, gy = guiGetSize ( aTab1.GiveVehicle, false ) aTab1.VehicleOptions = guiCreateGridList ( 0, 0, gx, 200, false ) guiGridListAddColumn( aTab1.VehicleOptions, "", 0.85 ) guiSetAlpha ( aTab1.VehicleOptions, 0.80 ) guiSetVisible ( aTab1.VehicleOptions, false ) local vehicleNames = {} for i = 400, 611 do if ( getVehicleNameFromModel ( i ) ~= "" ) then table.insert( vehicleNames, { model = i, name = getVehicleNameFromModel ( i ) } ) end end table.sort( vehicleNames, function(a, b) return a.name < b.name end ) for _,info in ipairs(vehicleNames) do local row = guiGridListAddRow ( aTab1.VehicleOptions ) guiGridListSetItemText ( aTab1.VehicleOptions, row, 1, info.name, false, false ) guiGridListSetItemData ( aTab1.VehicleOptions, row, 1, tostring ( info.model ) ) end addEventHandler ( "aClientLog", _root, aClientLog ) addEventHandler ( "aClientAdminChat", _root, aClientAdminChat ) addEventHandler ( "aClientSync", _root, aClientSync ) addEventHandler ( "aMessage", _root, aMessage ) addEventHandler ( "aClientResourceStart", _root, aClientResourceStart ) addEventHandler ( "aClientResourceStop", _root, aClientResourceStop ) addEventHandler ( "aClientPlayerJoin", _root, aClientPlayerJoin ) addEventHandler ( "onClientPlayerQuit", _root, aClientPlayerQuit ) addEventHandler ( "onClientMouseEnter", _root, aClientMouseEnter ) addEventHandler ( "onClientGUIClick", aAdminForm, aClientClick ) addEventHandler ( "onClientGUIScroll", aAdminForm, aClientScroll ) addEventHandler ( "onClientGUIDoubleClick", aAdminForm, aClientDoubleClick ) addEventHandler ( "onClientGUIDoubleClick", aTab1.VehicleOptions, aClientDoubleClick ) addEventHandler ( "onClientGUIAccepted", aAdminForm, aClientGUIAccepted ) addEventHandler ( "onClientGUIChanged", aAdminForm, aClientGUIChanged ) addEventHandler ( "onClientCursorMove", _root, aClientCursorMove ) addEventHandler ( "onClientRender", _root, aClientRender ) addEventHandler ( "onClientPlayerChangeNick", _root, aClientPlayerChangeNick ) addEventHandler ( "onClientResourceStop", _root, aMainSaveSettings ) addEventHandler ( "onClientGUITabSwitched", aTabPanel, aClientGUITabSwitched ) bindKey ( "arrow_d", "down", aPlayerListScroll, 1 ) bindKey ( "arrow_u", "down", aPlayerListScroll, -1 ) triggerServerEvent ( "aSync", getLocalPlayer(), "players" ) if ( hasPermissionTo ( "command.listmessages" ) ) then triggerServerEvent ( "aSync", getLocalPlayer(), "messages" ) end triggerServerEvent ( "aSync", getLocalPlayer(), "server" ) triggerEvent ( "onAdminInitialize" ) showCursor ( true ) end guiSetVisible ( aAdminForm, true ) showCursor ( true ) -- If the camera target was on another player, select him in the player list local element = getCameraTarget() if element and getElementType(element)=="vehicle" then element = getVehicleController(element) end if element and getElementType(element)=="player" and element ~= getLocalPlayer() then for row=0,guiGridListGetRowCount( aTab1.PlayerList )-1 do if ( guiGridListGetItemPlayerName ( aTab1.PlayerList, row, 1 ) == getPlayerName ( element ) ) then guiGridListSetSelectedItem ( aTab1.PlayerList, row, 1 ) break end end end end function aAdminMenuClose ( destroy ) if ( destroy ) then aMainSaveSettings () aPlayers = {} aWeathers = {} aBans = {} removeEventHandler ( "aClientLog", _root, aClientLog ) removeEventHandler ( "aClientAdminChat", _root, aClientAdminChat ) removeEventHandler ( "aClientSync", _root, aClientSync ) removeEventHandler ( "aMessage", _root, aMessage ) removeEventHandler ( "aClientResourceStart", _root, aClientResourceStart ) removeEventHandler ( "aClientResourceStop", _root, aClientResourceStop ) removeEventHandler ( "aClientPlayerJoin", _root, aClientPlayerJoin ) removeEventHandler ( "onClientPlayerQuit", _root, aClientPlayerQuit ) removeEventHandler ( "onClientMouseEnter", _root, aClientMouseEnter ) removeEventHandler ( "onClientGUIClick", aAdminForm, aClientClick ) removeEventHandler ( "onClientGUIScroll", aAdminForm, aClientScroll ) removeEventHandler ( "onClientGUIDoubleClick", aAdminForm, aClientDoubleClick ) removeEventHandler ( "onClientGUIDoubleClick", aTab1.VehicleOptions, aClientDoubleClick ) removeEventHandler ( "onClientGUIAccepted", aAdminForm, aClientGUIAccepted ) removeEventHandler ( "onClientGUIChanged", aAdminForm, aClientGUIChanged ) removeEventHandler ( "onClientCursorMove", _root, aClientCursorMove ) removeEventHandler ( "onClientRender", _root, aClientRender ) removeEventHandler ( "onClientPlayerChangeNick", _root, aClientPlayerChangeNick ) removeEventHandler ( "onClientResourceStop", _root, aMainSaveSettings ) unbindKey ( "arrow_d", "down", aPlayerListScroll ) unbindKey ( "arrow_u", "down", aPlayerListScroll ) destroyElement ( aTab1.VehicleOptions ) destroyElement ( aAdminForm ) aAdminForm = nil else guiSetVisible ( aTab1.VehicleOptions, false ) guiSetVisible ( aAdminForm, false ) end guiSetInputEnabled ( false ) showCursor ( false ) end function aMainSaveSettings () aSetSetting ( "outputPlayer", guiCheckBoxGetSelected ( aTab6.OutputPlayer ) ) aSetSetting ( "adminChatOutput", guiCheckBoxGetSelected ( aTab6.AdminChatOutput ) ) aSetSetting ( "adminChatSound", guiCheckBoxGetSelected ( aTab5.AdminChatSound ) ) aSetSetting ( "adminChatLines", guiGetText ( aTab6.AdminChatLines ) ) aSetSetting ( "refreshDelay", guiGetText ( aTab6.RefreshDelay ) ) aSetSetting ( "currentWeapon", aCurrentWeapon ) aSetSetting ( "currentAmmo", aCurrentAmmo ) aSetSetting ( "currentVehicle", aCurrentVehicle ) aSetSetting ( "currentSlap", aCurrentSlap ) if ( guiRadioButtonGetSelected ( aTab6.PerformanceRAM ) ) then aSetSetting ( "performance", "RAM" ) elseif ( guiRadioButtonGetSelected ( aTab6.PerformanceCPU ) ) then aSetSetting ( "performance", "CPU" ) else aSetSetting ( "performance", "Auto" ) end end function aAdminRefresh () if ( guiGridListGetSelectedItem ( aTab1.PlayerList ) ~= -1 ) then local player = getPlayerFromNick ( guiGridListGetItemPlayerName ( aTab1.PlayerList, guiGridListGetSelectedItem( aTab1.PlayerList ), 1 ) ) if ( player and aPlayers[player] ) then guiSetText ( aTab1.Name, "Name: "..aPlayers[player]["name"] ) guiSetText ( aTab1.Mute, iif ( aPlayers[player]["mute"], "Unmute", "Mute" ) ) guiSetText ( aTab1.Freeze, iif ( aPlayers[player]["freeze"], "Unfreeze", "Freeze" ) ) guiSetText ( aTab1.Username, "Community Username: "..( aPlayers[player]["username"] or "" ) ) guiSetText ( aTab1.Version, "Version: "..( aPlayers[player]["version"] or "" ) ) guiSetText ( aTab1.Accountname, "Account Name: "..( aPlayers[player]["accountname"] or "" ) ) guiSetText ( aTab1.Groups, "Groups: "..( aPlayers[player]["groups"] or "None" ) ) if ( isPlayerDead ( player ) ) then guiSetText ( aTab1.Health, "Health: Dead" ) else guiSetText ( aTab1.Health, "Health: "..math.ceil ( getElementHealth ( player ) ).."%" ) end guiSetText ( aTab1.Armour, "Armour: "..math.ceil ( getPedArmor ( player ) ).."%" ) guiSetText ( aTab1.Skin, "Skin: "..iif ( getElementModel ( player ), getElementModel ( player ), "N/A" ) ) if ( getPlayerTeam" class="kw2">getPlayerTeam" class="kw2">getPlayerTeam" class="kw2">getPlayerTeam" class="kw2">getPlayerTeam ( player ) ) then guiSetText ( aTab1.Team, "Team: "..getTeamName ( getPlayerTeam" class="kw2">getPlayerTeam" class="kw2">getPlayerTeam ( player ) ) ) else guiSetText ( aTab1.Team, "Team: None" ) end guiSetText ( aTab1.Ping, "Ping: "..getPlayerPing ( player ) ) guiSetText ( aTab1.Money, "Money: "..( aPlayers[player]["money"] or 0 ) ) if ( getElementDimension ( player ) ) then guiSetText ( aTab1.Dimension, "Dimension: "..getElementDimension ( player ) ) end if ( getElementInterior ( player ) ) then guiSetText ( aTab1.Interior, "Interior: "..getElementInterior ( player ) ) end guiSetText ( aTab1.JetPack, iif ( doesPedHaveJetPack ( player ), "Remove JetPack", "Give JetPack" ) ) if ( getPedWeapon ( player ) ) then guiSetText ( aTab1.Weapon, "Weapon: "..getWeaponNameFromID ( getPedWeapon ( player ) ).." (ID: "..getPedWeapon ( player )..")" ) end local x, y, z = getElementPosition ( player ) guiSetText ( aTab1.Area, "Area: "..iif ( getZoneName ( x, y, z, false ) == getZoneName ( x, y, z, true ), getZoneName ( x, y, z, false ), getZoneName ( x, y, z, false ).." ("..getZoneName ( x, y, z, true )..")" ) ) guiSetText ( aTab1.PositionX, "X: "..x ) guiSetText ( aTab1.PositionY, "Y: "..y ) guiSetText ( aTab1.PositionZ, "Z: "..z ) local vehicle = getPedOccupiedVehicle ( player ) if ( vehicle ) then guiSetText ( aTab1.Vehicle, "Vehicle: "..getVehicleName ( vehicle ).." (ID: "..getElementModel ( vehicle )..")" ) guiSetText ( aTab1.VehicleHealth, "Vehicle Health: "..math.ceil ( getElementHealth ( vehicle ) ).."%" ) else guiSetText ( aTab1.Vehicle, "Vehicle: Foot" ) guiSetText ( aTab1.VehicleHealth, "Vehicle Health: 0%" ) end return player end end end function aClientSync ( type, table ) Link to comment
Castillo Posted January 4, 2011 Share Posted January 4, 2011 add this under the buttons. guiSetEnabled(aTab1.Jail,true) guiSetEnabled(aTab1.Relase,true) Link to comment
Lukkaz Posted January 4, 2011 Author Share Posted January 4, 2011 thanks....odd enough it works now haha 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