Jump to content

مساعده من فضلكم


Recommended Posts

 

السلام عليكم
عندي بلوحه الادمنيه في ملف اسمه admin_screenshots 
الي فهمته منه انه ياخذ سكرين شوت للاعب
بس السؤال كيف افعله بلوحه الادمنيه

انا سويت الزر بس ابغا اربطهم ببعض

aScreenShotWindows = {}
aScreenShotForm = nil

function aPlayerScreenShot (player)
    if aScreenShotForm == nil then
        local x,y = guiGetScreenSize()
        aScreenShotForm        = guiCreateWindow    ( x / 2 - 300, y / 2 - 125, 600, 250, "Screenshot Management", false )
        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 )
        aScreenShotDelete    = guiCreateButton    ( 0.75, 0.18, 0.42, 0.09, "Delete", true, aScreenShotForm )
        aScreenShotView        = guiCreateButton    ( 0.75, 0.28, 0.42, 0.09, "View", true, aScreenShotForm )
        aScreenShotRefresh    = guiCreateButton    ( 0.75, 0.38, 0.42, 0.09, "Refresh", true, aScreenShotForm )
        aScreenShotClose    = guiCreateButton    ( 0.75, 0.88, 0.42, 0.09, "Close", true, aScreenShotForm )
        guiGridListAddColumn(aScreenShotList,"Player",0.31 )
        guiGridListAddColumn(aScreenShotList,"Admin",0.31 )
        guiGridListAddColumn(aScreenShotList,"Date",0.27 )
        addEventHandler("onClientGUIClick",aScreenShotForm,aScreenShotsClick)
        addEventHandler("onClientGUIDoubleClick",aScreenShotForm,aScreenShotsDoubleClick)
        aRegister("PlayerScreenShot",aScreenShotForm,aPlayerScreenShot,aPlayerScreenShotClose)
    end
    guiSetVisible(aScreenShotForm,true)
    guiBringToFront(aScreenShotForm)
    aScreenShotsRefresh()
end

function aScreenShotsRefresh ()
    if aScreenShotList then
        guiGridListClear(aScreenShotList)
        triggerServerEvent("aScreenShot",resourceRoot,"list",localPlayer)
    end
end

function aPlayerScreenShotClose ()
    if ( aScreenShotForm ) then
        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
    end
end

function aScreenShotsDoubleClick (button)
    if button == "left" then
        if source == aScreenShotList then
            local row = guiGridListGetSelectedItem(aScreenShotList)
            if row ~= -1 then
                triggerServerEvent("aScreenShot",resourceRoot,"view",localPlayer,guiGridListGetItemData(aScreenShotList,row,1),guiGridListGetItemText(aScreenShotList,row,1))
            end
        end
    end
end

function aScreenShotsClick (button)
    if button == "left" then
        if source == aScreenShotClose then
            aPlayerScreenShotClose()
        elseif source == aScreenShotNew then
            if guiGridListGetSelectedItem(aTab1.PlayerList ) == -1 then
                aMessageBox("error","No player selected!")
            else
                local name = guiGridListGetItemPlayerName(aTab1.PlayerList,guiGridListGetSelectedItem(aTab1.PlayerList),1)
                triggerServerEvent("aScreenShot",resourceRoot,"new",localPlayer,getPlayerFromNick(name))
            end
        elseif source == aScreenShotDelete then
            local row = guiGridListGetSelectedItem ( aScreenShotList )
            if row ~= -1 then
                triggerServerEvent("aScreenShot",resourceRoot,"delete",localPlayer,guiGridListGetItemData(aScreenShotList,row,1))
                guiGridListRemoveRow(aScreenShotList,row)
            end
        elseif source == aScreenShotRefresh then
            aScreenShotsRefresh()
        elseif source == aScreenShotView then
            local row = guiGridListGetSelectedItem(aScreenShotList)
            if row ~= -1 then
                triggerServerEvent("aScreenShot",resourceRoot,"view",localPlayer,guiGridListGetItemData(aScreenShotList,row,1),guiGridListGetItemText(aScreenShotList,row,1))
            end
        else
            for player,gui in pairs (aScreenShotWindows) do
                if gui.button == source or source == gui.screenshot then
                    destroyElement(gui.window)
                    aScreenShotWindows[player] = nil
                end
            end
        end
    end
end

addEvent("aClientScreenShot",true)
addEventHandler("aClientScreenShot",resourceRoot,
    function (action,player,data,arg1,arg2,arg3)
        if action == "new" then
            local title
            if type(player) == "string" then
                title = player
            elseif isElement(player) then
                title = getPlayerName(player)
            else
                return
            end
            local x, y = guiGetScreenSize()
            aScreenShotWindows[player] = {}
            aScreenShotWindows[player].window = guiCreateWindow((x/2)-400,(y/2)-300,800,600,title,false)
            aScreenShotWindows[player].label = guiCreateLabel(0,0,1,1,"Loading...",true,aScreenShotWindows[player].window)
            aScreenShotWindows[player].button = guiCreateButton(0.93,0.95,0.6,0.4,"Close",true,aScreenShotWindows[player].window)
            addEventHandler ( "onClientGUIClick", aScreenShotWindows[player].button, aScreenShotsClick )
            guiLabelSetHorizontalAlign(aScreenShotWindows[player].label,"center")
            guiLabelSetVerticalAlign(aScreenShotWindows[player].label,"center")
        elseif action == "list" then
            if not isElement(aScreenShotList) then return end
            guiGridListClear ( aScreenShotList )
            for i,screenshot in ipairs (data) do
                local row = guiGridListAddRow(aScreenShotList)
                guiGridListSetItemText(aScreenShotList,row,1,screenshot.player,false,false)
                guiGridListSetItemText(aScreenShotList,row,2,screenshot.admin,false,false)
                guiGridListSetItemText(aScreenShotList,row,3,screenshot.realtime,false,false)
                guiGridListSetItemData(aScreenShotList,row,1,screenshot.id)
            end
        else
            if not aScreenShotWindows[player] or not isElement(aScreenShotWindows[player].window) then return end
            if action == "view" then
                local time = tostring(getRealTime().timestamp)
                local file = fileCreate("screenshots/"..time..".jpg")
                fileWrite(file,data)
                fileClose(file)
                aScreenShotWindows[player].screenshot = guiCreateStaticImage(0,0,1,1,"screenshots/"..time..".jpg",true,aScreenShotWindows[player].window)
                addEventHandler ( "onClientGUIClick", aScreenShotWindows[player].screenshot, aScreenShotsClick )
                guiBringToFront(aScreenShotWindows[player].button)
                if isElement(player) and isElement(aScreenShotList) then
                    local row = guiGridListAddRow(aScreenShotList)
                    guiGridListSetItemText(aScreenShotList,row,1,getPlayerName(player),false,false)
                    guiGridListSetItemText(aScreenShotList,row,2,arg1,false,false)
                    guiGridListSetItemText(aScreenShotList,row,3,arg2,false,false)
                    guiGridListSetItemData(aScreenShotList,row,1,arg3)
                end
            elseif action == "minimized" then
                guiSetText(aScreenShotWindows[player].label,"Player is minimized, try again later")
            elseif action == "disabled" then
                guiSetText(aScreenShotWindows[player].label,"Player does not allow taking screenshots")
            elseif action == "quit" then
                guiSetText(aScreenShotWindows[player].label,"Player has quit")
            end
        end
    end
)

local con = dbConnect("sqlite", ":/registry.db")
dbExec(con, "CREATE TABLE IF NOT EXISTS `admin_screenshots` (`id` INTEGER, `player` TEXT, `serial` TEXT, `admin` TEXT, `realtime` TEXT)")
local screenshots = {}
local currentid = 0

addEventHandler("onResourceStart", resourceRoot, function()
	dbQuery(resourceStartedCallback, {}, con, "SELECT `id` FROM `admin_screenshots`")
end
)

function resourceStartedCallback(qh)
	local result = dbPoll(qh, 0)
	for i, screenshot in ipairs(result) do
		if screenshot.id > currentid then
			currentid = screenshot.id
		end
	end
end

addEvent("aScreenShot",true)
addEventHandler("aScreenShot",resourceRoot,
	function (action,admin,player,arg1,arg2)
		if not isElement(admin) then return end
		if not hasObjectPermissionTo(admin,"command.takescreenshot") then return end
		if action == "new" then
			if not isElement(player) then return end
			if screenshots[player] then
				table.insert(screenshots[player].admins,admin)
			else
				local t = getRealTime()
				screenshots[player] = {player=player,admin=getPlayerName(admin),admins={admin},realtime=t.monthday.."/"..(t.month+1).."/"..(t.year+1900).." "..t.hour..":"..t.minute..":"..t.second}
				takePlayerScreenShot(player,800,600,getPlayerName(player))
				triggerClientEvent(admin,"aClientScreenShot",resourceRoot,"new",player)
			end
		elseif action == "list" then
			dbQuery(clientScreenShotCallback, {admin}, con, "SELECT `id`,`player`,`admin`,`realtime` FROM `admin_screenshots`")
		elseif action == "delete" then
			if fileExists("screenshots/"..player..".jpg") then
				fileDelete("screenshots/"..player..".jpg")
			end
			dbExec(con, "DELETE FROM `admin_screenshots` WHERE `id`=?", player)
		elseif action == "view" then
			if fileExists("screenshots/"..player..".jpg") then
				local file = fileOpen("screenshots/"..player..".jpg")
				local imagedata = fileRead(file,fileGetSize(file))
				fileClose(file)
				triggerClientEvent(admin,"aClientScreenShot",resourceRoot,"new",arg1)
				triggerLatentClientEvent(admin,"aClientScreenShot",resourceRoot,"view",arg1,imagedata)
			end
		end
	end
)

function clientScreenShotCallback(qh, admin)
	local result = dbPoll(qh, 0)
	if (not isElement(admin)) then return end
	triggerClientEvent(admin, "aClientScreenShot", resourceRoot, "list", nil, result)
end

addEventHandler("onPlayerScreenShot",root,
	function (resource,status,imagedata,timestamp,tag)
		if resource == getThisResource() then
			local screenshot = screenshots[source]
			if not screenshot then return end
			if status == "ok" then
				currentid = currentid + 1
				dbExec(con, "INSERT INTO `admin_screenshots`(`id`,`player`,`serial`,`admin`,`realtime`) VALUES(?,?,?,?,?)",currentid,getPlayerName(source),getPlayerSerial(source),screenshot.admin,screenshot.realtime)
				if fileExists("screenshots/"..currentid..".jpg") then
					fileDelete("screenshots/"..currentid..".jpg")
				end
				local file = fileCreate("screenshots/"..currentid..".jpg")
				fileWrite(file,imagedata)
				fileClose(file)
				for i,admin in ipairs (screenshot.admins) do
					if isElement(admin) then
						triggerLatentClientEvent(admin,"aClientScreenShot",resourceRoot,"view",source,imagedata,screenshot.admin,screenshot.realtime,currentid)
					end
				end
			else
				for i,admin in ipairs (screenshot.admins) do
					if isElement(admin) then
						triggerClientEvent(admin,"aClientScreenShot",resourceRoot,status,source)
					end
				end
			end
			screenshots[source] = nil
		end
	end
)

addEventHandler("onPlayerQuit",root,
	function ()
		if screenshots[source] then
			for i,admin in ipairs (screenshots[source].admins) do
				triggerClientEvent(admin,"aClientScreenShot",resourceRoot,"quit",source)
			end
			screenshots[source] = nil
		end
	end
)

 

Link to comment

لا مو موجوده

 

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 )
		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.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", true, aTab1.Tab, "slap" )
		aTab1.SlapDropDown	= guiCreateStaticImage ( 0.95, 0.215, 0.03, 0.04, "client\\images\\dropdown.png", false, aTab1.Tab )
		aTab1.SlapOptions		= guiCreateGridList ( 0.85, 0.215, 0.13, 0.40, false, 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", false, aTab1.Tab, "setgroup" )

		aTab1.Cinfo			= guiCreateButton ( 0.71, 0.305, 0.13, 0.04, "Copy info", true, aTab1.Tab )
		aTab1.screns		= guiCreateButton ( 0.85, 0.305, 0.13, 0.04, "ScreenShot", true, aTab1.Tab, "takescreenshot" )
-- 	aTab1.PoliceBan			= guiCreateButton ( 0.71, 0.305, 0.13, 0.04, "PoliceBan", true, aTab1.Tab )
--		aTab1.UnPoliceBan		= guiCreateButton ( 0.85, 0.305, 0.13, 0.04, "UnPoliceBan", true, aTab1.Tab )

						  guiCreateHeader ( 0.45, 0.05, 0.20, 0.04, "Edited By Y0u$$eF", true, aTab1.Tab )
						  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", false, 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.170, 0.025806, 0.021154, "client\\images\\empty.png", true, aTab1.Tab )
		aTab1.CountryCode	= guiCreateLabel ( 0.45, 0.170, 0.04, 0.035, "", 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, "giveweapon" )
		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, "anonadmin" )
		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 )

 

Link to comment

من الواضح ان الادمنية اللي معك معدلة ومحذوف منها السكرين شوت, ليه ما تحمل الأساسية وتشوف الطريقة وتسويها بنفسك؟

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...