Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions [admin]/admin/client/gui/admin_screenshot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ function aPlayerScreenShot (player)
aScreenShotList = guiCreateGridList ( 0.03, 0.08, 0.70, 0.90, true, aScreenShotForm )
aScreenShotNew = guiCreateButton ( 0.75, 0.08, 0.42, 0.09, "Take New", true, aScreenShotForm, "takescreenshot" )
aScreenShotDelete = guiCreateButton ( 0.75, 0.18, 0.42, 0.09, "Delete", true, aScreenShotForm, "deletescreenshot" )
aScreenShotView = guiCreateButton ( 0.75, 0.28, 0.42, 0.09, "View", true, aScreenShotForm, "viewscreenshot" )
aScreenShotRefresh = guiCreateButton ( 0.75, 0.38, 0.42, 0.09, "Refresh", true, aScreenShotForm, "listscreenshots" )
aScreenShotDeleteAll= guiCreateButton ( 0.75, 0.28, 0.42, 0.09, "Delete All", true, aScreenShotForm, "deleteallscreenshot" )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because you added "deleteallscreenshot" and in ACL.xml and server-side "deletesallcreenshot"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completely true... that’s what I get for not copy and paste the code from my server into the repository and rewriting it

aScreenShotView = guiCreateButton ( 0.75, 0.38, 0.42, 0.09, "View", true, aScreenShotForm, "viewscreenshot" )
aScreenShotRefresh = guiCreateButton ( 0.75, 0.48, 0.42, 0.09, "Refresh", true, aScreenShotForm, "listscreenshots" )
aScreenShotClose = guiCreateButton ( 0.75, 0.88, 0.42, 0.09, "Close", true, aScreenShotForm )
guiGridListAddColumn(aScreenShotList,"Player",0.31 )
guiGridListAddColumn(aScreenShotList,"Admin",0.31 )
Expand Down Expand Up @@ -47,7 +48,7 @@ function aPlayerScreenShotClose ()
removeEventHandler ( "onClientGUIClick", aScreenShotForm, aScreenShotsClick )
removeEventHandler ( "onClientGUIDoubleClick", aScreenShotForm, aScreenShotsDoubleClick )
destroyElement ( aScreenShotForm )
aScreenShotForm,aScreenShotList,aScreenShotNew,aScreenShotDelete,aScreenShotView,aScreenShotRefresh,aScreenShotClose,aScreenShotForm = nil,nil,nil,nil,nil,nil,nil,nil
aScreenShotForm,aScreenShotList,aScreenShotNew,aScreenShotDelete,aScreenShotDeleteAll,aScreenShotView,aScreenShotRefresh,aScreenShotClose,aScreenShotForm = nil,nil,nil,nil,nil,nil,nil,nil,nil
end
end

Expand Down Expand Up @@ -79,6 +80,9 @@ function aScreenShotsClick (button)
triggerServerEvent("aScreenShot",localPlayer,"delete",guiGridListGetItemData(aScreenShotList,row,1))
guiGridListRemoveRow(aScreenShotList,row)
end
elseif source == aScreenShotDeleteAll then
triggerServerEvent("aScreenShot",localPlayer,"deleteall")
guiGridListClear(aScreenShotList)
elseif source == aScreenShotRefresh then
aScreenShotsRefresh()
elseif source == aScreenShotView then
Expand Down
4 changes: 4 additions & 0 deletions [admin]/admin/conf/ACL.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
<!--Screenshot related-->
<right name="command.takescreenshot" access="true" />
<right name="command.deletescreenshot" access="true" />
<right name="command.deleteallscreenshot" access="true" />
<right name="command.viewscreenshot" access="true" />
<right name="command.listscreenshots" access="true" />
</acl>
Expand Down Expand Up @@ -183,6 +184,7 @@
<!--Screenshot related-->
<right name="command.takescreenshot" access="true" />
<right name="command.deletescreenshot" access="true" />
<right name="command.deleteallscreenshot" access="false" />
<right name="command.viewscreenshot" access="true" />
<right name="command.listscreenshots" access="true" />
</acl>
Expand Down Expand Up @@ -273,6 +275,7 @@
<!--Screenshot related-->
<right name="command.takescreenshot" access="true" />
<right name="command.deletescreenshot" access="true" />
<right name="command.deleteallscreenshot" access="false" />
<right name="command.viewscreenshot" access="true" />
<right name="command.listscreenshots" access="true" />
</acl>
Expand Down Expand Up @@ -364,6 +367,7 @@
<!--Screenshot related-->
<right name="command.takescreenshot" access="false" />
<right name="command.deletescreenshot" access="false" />
<right name="command.deleteallscreenshot" access="false" />
<right name="command.viewscreenshot" access="false" />
<right name="command.listscreenshots" access="false" />
</acl>
Expand Down
9 changes: 9 additions & 0 deletions [admin]/admin/server/admin_screenshot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ local currentid = 0
local rights = {
["new"] = "takescreenshot",
["delete"] = "deletescreenshot",
["deleteall"] = "deleteallscreenshot",
["view"] = "viewscreenshot",
["list"] = "listscreenshots"
}
Expand Down Expand Up @@ -60,6 +61,14 @@ addEventHandler("aScreenShot",root,
fileDelete("screenshots/"..player..".jpg")
end
dbExec(con, "DELETE FROM `admin_screenshots` WHERE `id`=?", player)
elseif action == "deleteall" then
for i=0, currentid do
if fileExists("screenshots/"..i..".jpg") then
fileDelete("screenshots/"..i..".jpg")
end
end
currentid = 0
dbExec(con, "DELETE FROM `admin_screenshots`")
elseif action == "view" then
if fileExists("screenshots/"..player..".jpg") then
local file = fileOpen("screenshots/"..player..".jpg")
Expand Down