Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- spawnAcceses={
- "Access.Military",
- "Access.SpecOps",
- "Access.OWM",
- "Access.CDFBoss",
- "Access.CDFSold",
- "Access.CDFCorp",
- "Access.CDFAsso",
- "Access.SpecFo",
- "Access.General",
- "Access.president",
- "Access.vpresident",
- "Access.ministers",
- "Access.secretagent",
- }
- function DrawFGNAdminPanel()
- if FGNAdminPanelGUI==nil then
- FGNAdminPanelGUI=guiCreateWindow(0.3,0.25,0.4,0.5,"FGN Admin panel",true)
- guiWindowSetMovable(FGNAdminPanelGUI,false)
- guiWindowSetSizable(FGNAdminPanelGUI,false)
- --List of players
- PlayersGridList=guiCreateGridList(0.05,0.05,0.3,0.8,true,FGNAdminPanelGUI)
- PlayersCollumn=guiGridListAddColumn(PlayersGridList,"Players",0.9)
- AllPlayers=getElementsByType("player")
- for key,Player in ipairs (AllPlayers) do
- nextRow=guiGridListAddRow(PlayersGridList)
- guiGridListSetItemText(PlayersGridList,nextRow,1,getPlayerName(Player),false,false)
- end
- --Buttons
- refreshPlayerListButton=guiCreateButton(0.05,0.85,0.3,0.1,"Refresh",true,FGNAdminPanelGUI)
- wantedLevelButton=guiCreateButton(0.4,0.05,0.20, 0.08,"Set Wanted",true,FGNAdminPanelGUI)
- spawnsAcces=guiCreateButton(0.4,0.15,0.20,0.08,"Spawn Acces",true,FGNAdminPanelGUI)
- moneyButton=guiCreateButton(0.4,0.25,0.20,0.08,"Money",true,FGNAdminPanelGUI)
- adminJailButton=guiCreateButton(0.4,0.35,0.20,0.08,"Admin Jail",true,FGNAdminPanelGUI)
- respawnVehicles=guiCreateButton(0.4,0.45,0.20,0.08,"Respawn Vehicles",true,FGNAdminPanelGUI)
- OtherGroupsButton=guiCreateButton(0.4,0.55,0.20,0.08,"NYI",true,FGNAdminPanelGUI)
- activeButton = guiCreateButton(0.4, 0.65, 0.20,0.08, "Toggle active admin (self)", true, FGNAdminPanelGUI)
- AdminMsgButton = guiCreateButton(0.4, 0.75, 0.20,0.08, "Admin Message", true, FGNAdminPanelGUI)
- sendAdminMessage = guiCreateButton(0.4, 0.85, 0.20,0.08, "Send personal admin message", true, FGNAdminPanelGUI)
- --Handles all the clicks
- function FGNAdminPanelButtonClicked()
- selectedPlayer=getPlayerFromName(guiGridListGetItemText(PlayersGridList,guiGridListGetSelectedItem(PlayersGridList),1))
- if source==wantedLevelButton then --Wanted level
- if wantedLevelGUIWindow==nil then -- If the panel does not yet exist, create it
- wantedLevelGUIWindow=guiCreateWindow(0.7,0.25,0.2,0.15,"Wanted Level Options",true)
- wantedLevel0=guiCreateRadioButton(0.5,0.3,0.2,0.1,"0",true,wantedLevelGUIWindow)
- wantedLevel1=guiCreateRadioButton(0.3,0.1,0.2,0.1,"1",true,wantedLevelGUIWindow)
- wantedLevel2=guiCreateRadioButton(0.3,0.3,0.2,0.1,"2",true,wantedLevelGUIWindow)
- wantedLevel3=guiCreateRadioButton(0.3,0.5,0.2,0.1,"3",true,wantedLevelGUIWindow)
- wantedLevel4=guiCreateRadioButton(0.7,0.1,0.2,0.1,"4",true,wantedLevelGUIWindow)
- wantedLevel5=guiCreateRadioButton(0.7,0.3,0.2,0.1,"5",true,wantedLevelGUIWindow)
- wantedLevel6=guiCreateRadioButton(0.7,0.5,0.2,0.1,"6",true,wantedLevelGUIWindow)
- confirmWantedLevelButton=guiCreateButton(0.25,0.6,0.5,0.4,"Confirm",true,wantedLevelGUIWindow)
- guiWindowSetMovable(wantedLevelGUIWindow,false)
- guiWindowSetSizable(wantedLevelGUIWindow,false)
- guiSetVisible(wantedLevelGUIWindow,false)
- end
- if guiGetVisible(wantedLevelGUIWindow)==false then
- guiSetVisible(wantedLevelGUIWindow,true)
- elseif guiGetVisible(wantedLevelGUIWindow)==true then
- guiSetVisible(wantedLevelGUIWindow,false)
- end
- elseif source==refreshPlayerListButton then
- guiGridListClear(PlayersGridList)
- AllPlayers=getElementsByType("player")
- for key,Player in ipairs (AllPlayers) do
- nextRow=guiGridListAddRow(PlayersGridList)
- guiGridListSetItemText(PlayersGridList,nextRow,1,getPlayerName(Player),false,false)
- end
- elseif source==confirmWantedLevelButton then --Sets the wanted level
- if selectedPlayer~=false then --If there is a player selected
- if guiRadioButtonGetSelected(wantedLevel0) then
- wantedStars=0
- wantedLevel=0
- elseif guiRadioButtonGetSelected(wantedLevel1) then
- wantedStars=1
- wantedLevel=20
- elseif guiRadioButtonGetSelected(wantedLevel2) then
- wantedStars=2
- wantedLevel=60
- elseif guiRadioButtonGetSelected(wantedLevel3) then
- wantedStars=3
- wantedLevel=100
- elseif guiRadioButtonGetSelected(wantedLevel4) then
- wantedStars=4
- wantedLevel=160
- elseif guiRadioButtonGetSelected(wantedLevel5) then
- wantedStars=5
- wantedLevel=240
- elseif guiRadioButtonGetSelected(wantedLevel6) then
- wantedStars=6
- wantedLevel=400
- end
- triggerServerEvent("setPlayerWanted",getRootElement(),selectedPlayer,wantedLevel)
- triggerServerEvent("createServerLog",getRootElement(),"(ADMIN)"..getPlayerName(getLocalPlayer()).." set "..getPlayerName(selectedPlayer).."'s wanted level to "..wantedStars)
- triggerServerEvent("outputTopBarMessage",getLocalPlayer(), "*ADMIN* " ..getPlayerName(selectedPlayer).."'s wanted level was changed to "..wantedStars.." *ADMIN*")
- end
- elseif source==adminJailButton then
- if selectedPlayer~=false and selectedPlayer~=0 then
- setElementData(selectedPlayer,"wantedStars",10,true)
- setElementData(selectedPlayer,"wantedLevel",400,true)
- triggerServerEvent("arrestPlayerEvent",selectedPlayer,selectedPlayer,getLocalPlayer(),wantedStars,true)
- triggerServerEvent("createServerLog",getRootElement(),"(ADMIN)"..getPlayerName(getLocalPlayer()).." Has adminjailed "..getPlayerName(selectedPlayer) )
- end
- elseif source==respawnVehicles then
- triggerServerEvent("ToggleVehicleRespawn",getRootElement())
- elseif source==activeButton then
- if getElementData(getLocalPlayer(),"ActiveAdmin")==true then
- setElementData(getLocalPlayer(),"ActiveAdmin",false,true)
- else
- setElementData(getLocalPlayer(),"ActiveAdmin",true,true)
- end
- triggerServerEvent("UpdateOnlineAdminsServer",getRootElement())
- elseif source==spawnsAcces then
- if spawnAccesWindow==nil then
- spawnAccesWindow=guiCreateWindow(0.7,0.4,0.2,0.2,"Spawn Access editor",true)
- AccesGridList=guiCreateGridList(0.05,0.1,0.5,0.8,true,spawnAccesWindow)
- SpawnCollum=guiGridListAddColumn(AccesGridList,"Spawns",0.85)
- for id,accesName in ipairs(spawnAcceses) do
- row=guiGridListAddRow(AccesGridList)
- guiGridListSetItemText(AccesGridList,row,SpawnCollum,accesName,false,false)
- end
- trueOrFalseGridList=guiCreateGridList(0.55,0.1,0.2,0.8,true,spawnAccesWindow)
- TrueOrFalseGridListCollumn=guiGridListAddColumn(trueOrFalseGridList,"Value",0.5)
- row=guiGridListAddRow(trueOrFalseGridList)
- guiGridListSetItemText(trueOrFalseGridList,row,TrueOrFalseGridListCollumn,"true",false,false)
- row=guiGridListAddRow(trueOrFalseGridList)
- guiGridListSetItemText(trueOrFalseGridList,row,TrueOrFalseGridListCollumn,"false",false,false)
- confirmSpawnAccesButton=guiCreateButton(0.75,0.8,0.2,0.1,"Confirm",true,spawnAccesWindow)
- guiSetVisible(spawnAccesWindow,false)
- end
- if guiGetVisible(spawnAccesWindow)==false then
- guiSetVisible(spawnAccesWindow,true)
- elseif guiGetVisible(spawnAccesWindow)==true then
- guiSetVisible(spawnAccesWindow,false)
- end
- elseif source==confirmSpawnAccesButton then
- spawnAccesName=guiGridListGetItemText(AccesGridList,guiGridListGetSelectedItem(AccesGridList),SpawnCollum)
- if guiGridListGetItemText(trueOrFalseGridList,guiGridListGetSelectedItem(trueOrFalseGridList),TrueOrFalseGridListCollumn) =="true" then
- setData=setElementData(selectedPlayer,spawnAccesName,true,true)
- if setData then
- triggerServerEvent("createServerLog",getRootElement(),"(ADMIN)"..getPlayerName(getLocalPlayer()).." set "..getPlayerName(selectedPlayer).."'s "..spawnAccesName.." to true" )
- outputChatBox("The Access of "..spawnAccesName.." for "..getPlayerName(selectedPlayer).." has been set to true.",200,200,200)
- elseif not setData then
- triggerServerEvent("setAcces",getRootElement(),selectedPlayer,spawnAccesName,false)
- end
- elseif guiGridListGetItemText(trueOrFalseGridList,guiGridListGetSelectedItem(trueOrFalseGridList),TrueOrFalseGridListCollumn) =="false" then
- setData=setElementData(selectedPlayer,spawnAccesName,false,true)
- if setData then
- triggerServerEvent("createServerLog",getRootElement(),"(ADMIN)"..getPlayerName(getLocalPlayer()).." set "..getPlayerName(selectedPlayer).."'s "..spawnAccesName.." to false" )
- outputChatBox("The Access of "..spawnAccesName.." for "..getPlayerName(selectedPlayer).." has been set to false.",200,200,200)
- elseif not setData then
- triggerServerEvent("setAcces",getRootElement(),selectedPlayer,spawnAccesName,true)
- end
- else
- outputChatBox("Double check your selections.",250,0,0,false)
- end
- elseif source==moneyButton then
- if moneyPanelWindow==nil then
- moneyPanelWindow=guiCreateWindow(0.7,0.6,0.2,0.15,"Money settings",true)
- valueEdit=guiCreateEdit(0.05,0.4,0.4,0.2,"ammount",true,moneyPanelWindow)
- setMoneyButton=guiCreateButton(0.5,0.2,0.4,0.2,"set",true,moneyPanelWindow)
- takeMoneyButton=guiCreateButton(0.5,0.4,0.4,0.2,"take",true,moneyPanelWindow)
- giveMoneyButton=guiCreateButton(0.5,0.6,0.4,0.2,"give",true,moneyPanelWindow)
- guiSetVisible(moneyPanelWindow,false)
- end
- if guiGetVisible(moneyPanelWindow)==false then
- guiSetVisible(moneyPanelWindow,true)
- elseif guiGetVisible(moneyPanelWindow)==true then
- guiSetVisible(moneyPanelWindow,false)
- end
- elseif source==setMoneyButton then
- moneyChange=setElementData(selectedPlayer,"FGNMoney",tonumber(guiGetText(valueEdit)))
- if moneyChange then outputChatBox("Money changed succesfully",100,200,100) end
- triggerServerEvent("createServerLog",getRootElement(),"(ADMIN)"..getPlayerName(getLocalPlayer()).." Has set "..getPlayerName(selectedPlayer).."'s money to "..guiGetText(valueEdit))
- elseif source==takeMoneyButton then
- moneyChange=setElementData(selectedPlayer,"FGNMoney",getElementData(selectedPlayer,"FGNMoney")-tonumber(guiGetText(valueEdit)))
- if moneyChange then outputChatBox("Money taken succesfully",100,200,100) end
- triggerServerEvent("createServerLog",getRootElement(),"(ADMIN)"..getPlayerName(getLocalPlayer()).." Has taken "..guiGetText(valueEdit).." dollars from "..getPlayerName(selectedPlayer))
- elseif source==giveMoneyButton then
- moneyChange=setElementData(selectedPlayer,"FGNMoney",getElementData(selectedPlayer,"FGNMoney")+tonumber(guiGetText(valueEdit)))
- if moneyChange then outputChatBox("Money given succesfully",100,200,100) end
- triggerServerEvent("createServerLog",getRootElement(),"(ADMIN)"..getPlayerName(getLocalPlayer()).." Has given "..guiGetText(valueEdit).." dollars to "..getPlayerName(selectedPlayer))
- elseif source==AdminMsgButton then -- Admin Msg button
- if AdminMsgGUIWindow==nil then -- If the panel does not yet exist, create it
- AdminMsgGUIWindow=guiCreateWindow(0.5,0.75,0.2,0.2,"Admin Message Options",true)
- AdminMsg1=guiCreateRadioButton(0.1,0.15,0.4,0.1,"Language",true,AdminMsgGUIWindow)
- AdminMsg2=guiCreateRadioButton(0.1,0.35,0.4,0.1,"F1 Rules",true,AdminMsgGUIWindow)
- AdminMsg3=guiCreateRadioButton(0.1,0.55,0.4,0.1,"Deathmatching",true,AdminMsgGUIWindow)
- AdminMsg4=guiCreateRadioButton(0.6,0.15,0.4,0.1,"Wanted level",true,AdminMsgGUIWindow)
- AdminMsg5=guiCreateRadioButton(0.6,0.35,0.4,0.1,"not following F1",true,AdminMsgGUIWindow)
- AdminMsg6=guiCreateRadioButton(0.6,0.55,0.4,0.1,"different:",true,AdminMsgGUIWindow)
- confirmAdminMsgButton=guiCreateButton(0.2,0.7,0.5,0.4,"Confirm",true,AdminMsgGUIWindow)
- guiWindowSetMovable(AdminMsgGUIWindow,false)
- guiWindowSetSizable(AdminMsgGUIWindow,false)
- guiSetVisible(AdminMsgGUIWindow,false)
- end
- if guiGetVisible(AdminMsgGUIWindow)==false then
- guiSetVisible(AdminMsgGUIWindow,true)
- elseif guiGetVisible(AdminMsgGUIWindow)==true then
- guiSetVisible(AdminMsgGUIWindow,false)
- if AdminMsg2GUIWindow~=nil then
- guiSetVisible(AdminMsg2GUIWindow,false)
- end
- end
- elseif source==confirmAdminMsgButton or source==AdminMsg6 then
- if guiRadioButtonGetSelected(AdminMsg1) then
- triggerServerEvent("outputTopBarMessage",getLocalPlayer(),"*ADMIN* Only English in Mainchat! *ADMIN*")
- elseif guiRadioButtonGetSelected(AdminMsg2) then
- triggerServerEvent("outputTopBarMessage",getLocalPlayer(),"*ADMIN* You can use F1 to find the rules and information! *ADMIN*")
- elseif guiRadioButtonGetSelected(AdminMsg3) then
- triggerServerEvent("outputTopBarMessage",getLocalPlayer(),"*ADMIN* Killing people for no reason is against the rules, *ADMIN*")
- triggerServerEvent("outputTopBarMessage",getLocalPlayer(),"*ADMIN* doing it will result in punishment! *ADMIN*")
- elseif guiRadioButtonGetSelected(AdminMsg4) then
- triggerServerEvent("outputTopBarMessage",getLocalPlayer(),"*ADMIN* A player's wanted level is indicated by the number, *ADMIN*")
- triggerServerEvent("outputTopBarMessage",getLocalPlayer(),"*ADMIN* in brackets behind their nametag. *ADMIN*")
- elseif guiRadioButtonGetSelected(AdminMsg5) then
- triggerServerEvent("outputTopBarMessage",getLocalPlayer(),"*ADMIN* Breaking our F1 rules will result in a punishment and can end up in a ban! *ADMIN*")
- elseif guiRadioButtonGetSelected(AdminMsg6) then
- if AdminMsg2GUIWindow==nil then
- AdminMsg2GUIWindow=guiCreateWindow(0.7,0.75,0.2,0.2,"Put here your Message",true)
- confirmAdminMsg6Button=guiCreateButton(0.2,0.7,0.5,0.4,"Confirm",true,AdminMsg2GUIWindow)
- AdminMsg6Memo=guiCreateEdit(0.05,0.25,0.9,0.2,"Your message here....",true,AdminMsg2GUIWindow)
- end
- if guiGetVisible(AdminMsg2GUIWindow)==false then
- guiSetVisible(AdminMsg2GUIWindow,true)
- else
- guiSetVisible(AdminMsg2GUIWindow,false)
- end
- end
- elseif source==confirmAdminMsg6Button then
- triggerServerEvent("outputTopBarMessage",getLocalPlayer(), "*ADMIN* " ..guiGetText(AdminMsg6Memo).. " *ADMIN*")
- elseif source==sendAdminMessage then
- if adminMessageSendWindow==nil then
- adminMessageSendWindow=guiCreateWindow(0.3,0.75,0.2,0.2,"Send admin Message",true)
- confirmAdminMsessageButton=guiCreateButton(0.2,0.7,0.5,0.4,"Confirm",true,adminMessageSendWindow)
- AdminMessageMemo=guiCreateEdit(0.05,0.25,0.9,0.2,"Your message here....",true,adminMessageSendWindow)
- end
- if guiGetVisible(adminMessageSendWindow)==false then
- guiSetVisible(adminMessageSendWindow,true)
- else
- guiSetVisible(adminMessageSendWindow,false)
- end
- elseif source==confirmAdminMsessageButton then
- triggerServerEvent("sendPersonalAdminMessage",getLocalPlayer(),getLocalPlayer(),selectedPlayer,guiGetText(AdminMessageMemo))
- end
- end
- addEventHandler("onClientGUIClick",getRootElement(),FGNAdminPanelButtonClicked)
- guiSetVisible(FGNAdminPanelGUI,false)
- end
- if guiGetVisible(FGNAdminPanelGUI)==false then
- guiSetVisible(FGNAdminPanelGUI,true)
- showCursor(true)
- elseif guiGetVisible(FGNAdminPanelGUI)==true then
- guiSetVisible(FGNAdminPanelGUI,false)
- if wantedLevelGUIWindow~=nil then guiSetVisible(wantedLevelGUIWindow,false) end
- if spawnAccesWindow~=nil then guiSetVisible(spawnAccesWindow,false) end
- if moneyPanelWindow~=nil then guiSetVisible(moneyPanelWindow,false) end
- if AdminMsgGUIWindow~=nil then guiSetVisible(AdminMsgGUIWindow,false) end
- if AdminMsg2GUIWindow~=nil then guiSetVisible(AdminMsg2GUIWindow,false) end
- if adminMessageSendWindow~=nil then guiSetVisible(adminMessageSendWindow,false) end
- showCursor(false)
- end
- guiGridListClear(PlayersGridList)
- AllPlayers=getElementsByType("player")
- for key,Player in ipairs (AllPlayers) do
- nextRow=guiGridListAddRow(PlayersGridList)
- guiGridListSetItemText(PlayersGridList,nextRow,1,getPlayerName(Player),false,false)
- end
- end
- addEvent("DrawFGNAdminPanel",true)
- addEventHandler("DrawFGNAdminPanel",getRootElement(),DrawFGNAdminPanel)
- function setOnlineAdmins(message)
- guiSetText(labelOnlineAdmins,message)
- end
- addEvent("UpdateOnlineAdmins",true)
- addEventHandler("UpdateOnlineAdmins",getRootElement(),setOnlineAdmins)
- function createLabel()
- labelOnlineAdmins = guiCreateLabel(0,0.9466,0.3799,0.0247,"",true)
- guiLabelSetColor(labelOnlineAdmins,255,255,255)
- guiLabelSetVerticalAlign(labelOnlineAdmins,"top")
- guiLabelSetHorizontalAlign(labelOnlineAdmins,"left",true)
- guiSetFont(labelOnlineAdmins,"default-bold-small")
- end
- addEventHandler( "onClientResourceStart", getRootElement(), createLabel)
- AdminMessageWindow = guiCreateWindow(0.1, 0.4, 0.2, 0.2, "Admin Message", true)
- guiWindowSetSizable(AdminMessageWindow, false)
- guiSetVisible(AdminMessageWindow,false)
- OkAdminButton = guiCreateButton(0.1, 0.85, 0.8, 0.1, "Ok!", true, AdminMessageWindow)
- guiSetProperty(OkAdminButton, "NormalTextColour", "FFAAAAAA")
- label1Admin = guiCreateLabel(0.1, 0.1, 0.8, 0.1, "The following admin sent you an admin message:", true, AdminMessageWindow)
- label2Admin = guiCreateLabel(0.4, 0.2, 0.2, 0.1, "Name here", true, AdminMessageWindow)
- memo1Admin = guiCreateMemo(0.1, 0.3, 0.8, 0.5, "", true, AdminMessageWindow)
- guiMemoSetReadOnly(memo1Admin,true)
- function closeadminmsggui()
- if source==OkAdminButton then
- guiSetVisible(AdminMessageWindow,false)
- showCursor(false)
- end
- end
- addEventHandler("onClientGUIClick",OkAdminButton,closeadminmsggui)
- addEvent("displayAdminPM",true)
- addEventHandler("displayAdminPM",getRootElement(),function(message)
- guiSetVisible(AdminMessageWindow,true)
- showCursor(true)
- guiSetEnabled(OkAdminButton,false)
- setTimer(guiSetEnabled,15000,1,OkAdminButton,true)
- guiSetText(memo1Admin,message)
- guiSetText(label2Admin,getPlayerName(source))
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement