Jump to content

i,xAhmed

Members
  • Posts

    588
  • Joined

  • Last visited

Posts posted by i,xAhmed

  1. سلام عليكم ورحمة الله وبركاته

    انا رابط سكربت الديسكورد باللعبة واشتغل معي

    
    function string:monochrome()
        local colorless = self:gsub("#%x%x%x%x%x%x", "")
    
        if colorless == "" then
            return self:gsub("#(%x%x%x%x%x%x)", "#\1%1")
        else
            return colorless
        end
    end
    
    function getPlayerName(player)
        return player.name:monochrome()
    end
    
    addEvent("onDiscordUserCommand")
    
    addEventHandler("onPlayerJoin", root,
        function ()
            exports.discord:send("player.join", { player = getPlayerName(source) })
        end
    )
    
    addEventHandler("onPlayerQuit", root,
        function (quitType, reason, responsible)
            local playerName = getPlayerName(source)
            
            if isElement(responsible) then
                if getElementType(responsible) == "player" then
                    responsible = getPlayerName(responsible)
                else
                    responsible = "Console"
                end
            else
                responsible = false
            end
    
            if type(reason) ~= "string" or reason == "" then
                reason = false
            end
            
            if quitType == "Kicked" and responsible then
                exports.discord:send("player.kick", { player = playerName, responsible = responsible, reason = reason })
            elseif quitType == "Banned" and responsible then
                exports.discord:send("player.ban", { player = playerName, responsible = responsible, reason = reason })
            else
                exports.discord:send("player.quit", { player = playerName, type = quitType, reason = reason })
            end
        end
    )
    
    addEventHandler("onPlayerChangeNick", root,
        function (previous, nick)
            exports.discord:send("player.nickchange", { player = nick:monochrome(), previous = previous:monochrome() })
        end
    )
    
    addEventHandler("onPlayerChat", root,
        function (message, messageType)
            if messageType == 0 then
                exports.discord:send("chat.message.text", { author = getPlayerName(source), text = message })
            elseif messageType == 1 then
                exports.discord:send("chat.message.action", { author = getPlayerName(source), text = message })
            end
        end
    )
    
    addEvent("onInterchatMessage")
    addEventHandler("onInterchatMessage", root,
        function (server, playerName, message)
            exports.discord:send("chat.message.interchat", { author = playerName:monochrome(), server = server, text = message })
        end
    )
    
    addEvent("onDiscordPacket")
    addEventHandler("onDiscordPacket", root,
        function (packet, payload)
            if packet == "text.message" then
                outputServerLog(("DISCORD: %s: %s"):format(payload.author.name, payload.message.text))
                outputChatBox(("#69BFDB[Đ] #FFFFFF%s: #E7D9B0%s"):format(payload.author.name, payload.message.text), root, 255, 255, 255, true)
                exports.discord:send("chat.confirm.message", { author = payload.author.name, message = payload.message })
            elseif packet == "text.command" then
                triggerEvent("onDiscordUserCommand", resourceRoot, payload.author, payload.message)
            end
        end
    )
    
    addEventHandler("onPlayerMute", root,
        function (state)
            if state == nil then
                return
            end
    
            if state then
                exports.discord:send("player.mute", { player = getPlayerName(source) })
            else
                exports.discord:send("player.unmute", { player = getPlayerName(source) })
            end
        end
    )
    
    addEvent("onGamemodeMapStart")
    addEventHandler("onGamemodeMapStart", root,
        function (map)
            local name = map:getInfo("name") or map.name
            exports.discord:send("mapmanager.mapstart", { name = name })
        end
    )
    
    addEvent("onPlayerFinish")
    addEventHandler("onPlayerFinish", root,
        function (rank, time)
            if rank > 3 then
                return
            end
    
            exports.discord:send("player.finish", { player = getPlayerName(source), rank = rank })
        end
    )
    
    addEvent("onPlayerToptimeImprovement")
    addEventHandler("onPlayerToptimeImprovement", root,
    	function (newPos, newTime, oldPos, oldTime, displayTopCount, entryCount)
            -- Do not show every achieved toptime
            if newPos > displayTopCount then
                return
            end
    
            -- We only handle race_toptimes
    		if (not sourceResource or sourceResource ~= getResourceFromName("race_toptimes")) then
    			return
    		end
    
            local time = ("%02d:%02d:%03d"):format(math.floor(newTime / 60000), math.floor(newTime / 1000) % 60, newTime % 1000)
            exports.discord:send("player.toptime", { player = getPlayerName(source), position = newPos, time = time })
        end
    )

     

    هذا السكربت الي اذا تكلمت بالشات

    المهم انا ابي ذا الكود يطلع بالديسكورد

    function setPlayerHealth(thePlayer, commandName, targetPlayer, health, ...)
    	if (exports.integration:isPlayerTrialAdmin(thePlayer) or exports.integration:isPlayerScripter(thePlayer)) then
    		if not tonumber(health) or not (targetPlayer) or not (...) then
    			outputChatBox("SYNTAX: /" .. commandName .. " [Player Partial Nick / ID] [Health] [Reason]", thePlayer, 255, 194, 14)
    		else
    			local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick(thePlayer, targetPlayer)
    			
    
    			if targetPlayer then
    				if tonumber( health ) < getElementHealth( targetPlayer ) and getElementData( thePlayer, "admin_level" ) < getElementData( targetPlayer, "admin_level" ) then
    					outputChatBox("Nah.", thePlayer, 255, 0, 0)
    				elseif not setElementHealth(targetPlayer, tonumber(health)) then
    					outputChatBox("Invalid health value.", thePlayer, 255, 0, 0)
    				else
    				local reason = table.concat({...}, " ")
    					outputChatBox("Player " .. targetPlayerName .. " has received " .. health .. " Health. ", thePlayer, 0, 255, 0)
    					exports.global:sendMessageToAdmins("AdmWrn: "..targetPlayerName.." has received [ "..health.." ] Health | Reason: "..reason.."")
                                            exports.discord:send("AdmWrn: "..targetPlayerName.." has received [ "..health.." ] Health | Reason: "..reason.."")
    					triggerEvent("onPlayerHeal", targetPlayer, true)
    					exports.logs:dbLog(thePlayer, 4, targetPlayer, "SETHP "..health)
    				end
    			end
    		end
    	end
    end

     

    آو هل من طريقة اخلي ذا الاكسبوت يطلع بالديسكورد

    exports.global:sendMessageToAdmins

     

  2. السلام عليكم ورحمة الله وبركاته

    طبعا انا شفت موضوع للاخ فيصل بالموضوع ذا

    [Connect MTA:SA With discord] حصريا الربط بين العبة والديسكورد

    ولكن للاسف الشرح ليس واضح او كاملا

    باختصار الموضوع

    سويت البوت واضفته لسيرفر الديسكورد حقي

    جربته بالسيرفر المحلي شغال والصورة توضح

    p_1023le76d1.png

     

    ويوم جيت بجربه على السيرفر العالمي م يتصل بالديسكورد

    p_1023gsd2h2.png

     

    فـ ياليت احد يقدر يحل المشكلة او يذكر لنا متطلبات البوت ,

    هل يحتاج خادم مستقل , علما ان هناك سيرفرات مسوينه بدون خادم

    وشكرا :$

  3. My server name: [WnAsH-Time]●[ وناسة تايم ]●[ هجولة وحرب ]●[W.T]~~[KSA_سعودي]~
    My server IP:178.32.127.216:22003

     

    Fake Server Name : [WnashTime] RolePlay v2.2 [ وناسة تايم, حياة واقعية ] [W.T] KSA @ Wnash.Net

    Fake server IP:
    - 87.98.233.30:220088 

    p_1001fftkj1.png

  4. version = "Bank System v3.0"
    
    wBank, bClose, lBalance, tabPanel, tabPersonal, tabPersonalTransactions, tabBusiness, tabBusinessTransactions, lWithdrawP, tWithdrawP, bWithdrawP, lDepositP, tDepositP, bDepositP = nil
    lWithdrawB, tWithdrawB, bWithdrawB, lDepositB, tDepositB, bDepositB, lBalanceB, gPersonalTransactions, gBusinessTransactions = nil
    gfactionBalance = nil
    cooldown = nil
    
    lastUsedATM = nil
    _depositable = nil
    _withdrawable = nil
    limitedwithdraw = 0
    
    local localPlayer = getLocalPlayer()
    function tonumber2( num )
    	if type(num) == "number" then
    		return num
    	else
    		num = num:gsub(",",""):gsub("%$","")
    		return tonumber(num)
    	end
    end
    
    local bankPed = createPed(150, 2358.710205, 2361.2133789, 2022.919189)
    setPedRotation(bankPed, 90.4609375)
    setElementInterior(bankPed, 3)
    
    function updateTabStuff()
    	if guiGetSelectedTab(tabPanel) == tabPersonalTransactions then
    		guiGridListClear(gPersonalTransactions)
    		triggerServerEvent("tellTransfersPersonal", localPlayer, cardInfoSaved)
    	elseif guiGetSelectedTab(tabPanel) == tabBusinessTransactions then
    		guiGridListClear(gBusinessTransactions)
    		triggerServerEvent("tellTransfersBusiness", localPlayer)
    	end
    end
    
    
    function showBankUI(isInFaction, isFactionLeader, factionBalance, depositable, limit, withdrawable, factionType)
    	if not (wBank) then
    		if getElementData(getLocalPlayer(), "exclusiveGUI") or not isCameraOnPlayer() then
    			return false
    		end
    		cardInfoSaved = nil
    		_depositable = depositable
    		_withdrawable = withdrawable
    		lastUsedATM = source
    		limitedwithdraw = limit
    
    		setElementData(getLocalPlayer(), "exclusiveGUI", true, false)
    
    		local width, height = 600, 400
    		local scrWidth, scrHeight = guiGetScreenSize()
    		local x = scrWidth/2 - (width/2)
    		local y = scrHeight/2 - (height/2)
    
    		local transactionColumns = {
    			{ "ID", 0.09 },
    			{ "From", 0.2 },
    			{ "To", 0.2 },
    			{ "Amount", 0.1 },
    			{ "Date", 0.2 },
    			{ "Reason", 0.5 }
    		}
    
    		local bannedTypes = {
    			[0] = true,
    			[1] = true,
    		}
    
    		wBank = guiCreateWindow(x, y, width, height, "Bank of Los Santos | "..version.."", false)
    		guiWindowSetSizable(wBank, false)
    
    		tabPanel = guiCreateTabPanel(0.05, 0.05, 0.9, 0.85, true, wBank)
    		addEventHandler( "onClientGUITabSwitched", tabPanel, updateTabStuff )
    
    		tabPersonal = guiCreateTab("Personal Banking", tabPanel)
    		tabPersonalTransactions = guiCreateTab("Personal Transactions", tabPanel)
    
    		local hoursplayed = getElementData(localPlayer, "hoursplayed") or 0
    		if (isInFaction) and (isFactionLeader) and not (bannedTypes[factionType]) then
    			tabBusiness = guiCreateTab("Business Banking", tabPanel)
    
    			gfactionBalance = factionBalance
    
    			lBalanceB = guiCreateLabel(0.1, 0.05, 0.9, 0.05, "Balance: $" .. exports.global:formatMoney(factionBalance), true, tabBusiness)
    			guiSetFont(lBalanceB, "default-bold-small")
    
    			if (withdrawable) then
    			-- WITHDRAWAL BUSINESS
    				lWithdrawB = guiCreateLabel(0.1, 0.15, 0.2, 0.05, "Withdraw:", true, tabBusiness)
    				guiSetFont(lWithdrawB, "default-bold-small")
    
    				tWithdrawB = guiCreateEdit(0.22, 0.13, 0.2, 0.075, "0", true, tabBusiness)
    				guiSetFont(tWithdrawB, "default-bold-small")
    				addEventHandler("onClientGUIClick", tWithdrawB, function()
    					if guiGetText(tWithdrawB) == "0" then
    						guiSetText(tWithdrawB, "")
    					end
    				end, false)
    
    				bWithdrawB = guiCreateButton(0.44, 0.13, 0.2, 0.075, "Withdraw", true, tabBusiness)
    				addEventHandler("onClientGUIClick", bWithdrawB, withdrawMoneyBusiness, false)
    			else
    				lWithdrawB = guiCreateLabel(0.1, 0.15, 0.5, 0.05, "This ATM does not support the withdraw function.", true, tabBusiness)
    				guiSetFont(lWithdrawB, "default-bold-small")
    			end
    
    			if (depositable) then
    				-- DEPOSIT BUSINESS
    				lDepositB = guiCreateLabel(0.1, 0.25, 0.2, 0.05, "Deposit:", true, tabBusiness)
    				guiSetFont(lDepositB, "default-bold-small")
    
    				tDepositB = guiCreateEdit(0.22, 0.23, 0.2, 0.075, "0", true, tabBusiness)
    				guiSetFont(tDepositB, "default-bold-small")
    				addEventHandler("onClientGUIClick", tDepositB, function()
    					if guiGetText(tDepositB) == "0" then
    						guiSetText(tDepositB, "")
    					end
    				end, false)
    
    				bDepositB = guiCreateButton(0.44, 0.23, 0.2, 0.075, "Deposit", true, tabBusiness)
    				addEventHandler("onClientGUIClick", bDepositB, depositMoneyBusiness, false)
    			else
    				lDepositB = guiCreateLabel(0.1, 0.25, 0.5, 0.05, "This ATM does not support the deposit function.", true, tabBusiness)
    				guiSetFont(lDepositB, "default-bold-small")
    
    				if limitedwithdraw > 0 and withdrawable then
    					tDepositB = guiCreateLabel(0.67, 0.15, 0.2, 0.05, "Max: $" .. exports.global:formatMoney( limitedwithdraw - ( getElementData( source, "withdrawn" ) or 0 ) ) .. ".", true, tabBusiness)
    					guiSetFont(tDepositB, "default-bold-small")
    				end
    			end
    
    			if hoursplayed >= 12 then
    				-- TRANSFER BUSINESS
    				lTransferB = guiCreateLabel(0.1, 0.45, 0.2, 0.05, "Transfer:", true, tabBusiness)
    				guiSetFont(lTransferB, "default-bold-small")
    
    				tTransferB = guiCreateEdit(0.22, 0.43, 0.2, 0.075, "0", true, tabBusiness)
    				guiSetFont(tTransferB, "default-bold-small")
    				addEventHandler("onClientGUIClick", tTransferB, function()
    					if guiGetText(tTransferB) == "0" then
    						guiSetText(tTransferB, "")
    					end
    				end, false)
    
    				bTransferB = guiCreateButton(0.44, 0.43, 0.2, 0.075, "Transfer to", true, tabBusiness)
    				addEventHandler("onClientGUIClick", bTransferB, transferMoneyBusiness, false)
    
    				eTransferB = guiCreateEdit(0.66, 0.43, 0.3, 0.075, "<Bank Account Number>", true, tabBusiness)
    				addEventHandler("onClientGUIClick", eTransferB, function()
    					if guiGetText(eTransferB) == "<Bank Account Number>" then
    						guiSetText(eTransferB, "")
    					end
    				end, false)
    
    				lTransferBReason = guiCreateLabel(0.1, 0.55, 0.2, 0.05, "Reason:", true, tabBusiness)
    				guiSetFont(lTransferBReason, "default-bold-small")
    
    				tTransferBReason = guiCreateEdit(0.22, 0.54, 0.74, 0.075, "<What is this transaction for?>", true, tabBusiness)
    				addEventHandler("onClientGUIClick", tTransferBReason, function()
    					if guiGetText(tTransferBReason) == "<What is this transaction for?>" then
    						guiSetText(tTransferBReason, "")
    					end
    				end, false)
    			end
    
    			-- TRANSACTION HISTORY
    			tabBusinessTransactions = guiCreateTab("Business Transactions", tabPanel)
    
    			gBusinessTransactions = guiCreateGridList(0.02, 0.02, 0.96, 0.96, true, tabBusinessTransactions)
    			for key, value in ipairs( transactionColumns ) do
    				guiGridListAddColumn( gBusinessTransactions, value[1], value[2] or 0.1 )
    			end
    		end
    
    		bClose = guiCreateButton(0.75, 0.91, 0.2, 0.1, "Close", true, wBank)
    		addEventHandler("onClientGUIClick", bClose, hideBankUI, false)
    
    		local balance = getElementData(localPlayer, "bankmoney")
    
    		--outputDebugString(balance)
    		--outputDebugString(exports.global:formatMoney(balance))
    
    		--:~
    		lBalance = guiCreateLabel(0.1, 0.05, 0.9, 0.05, "Balance: $" .. exports.global:formatMoney(balance), true, tabPersonal)
    		guiSetFont(lBalance, "default-bold-small")
    
    		if withdrawable then
    			-- WITHDRAWAL PERSONAL
    			lWithdrawP = guiCreateLabel(0.1, 0.15, 0.2, 0.05, "Withdraw:", true, tabPersonal)
    			guiSetFont(lWithdrawP, "default-bold-small")
    
    			tWithdrawP = guiCreateEdit(0.22, 0.13, 0.2, 0.075, "0", true, tabPersonal)
    			guiSetFont(tWithdrawP, "default-bold-small")
    			addEventHandler("onClientGUIClick", tWithdrawP, function()
    				if guiGetText(tWithdrawP) == "0" then
    					guiSetText(tWithdrawP, "")
    				end
    			end, false)
    
    			bWithdrawP = guiCreateButton(0.44, 0.13, 0.2, 0.075, "Withdraw", true, tabPersonal)
    			addEventHandler("onClientGUIClick", bWithdrawP, withdrawMoneyPersonal, false)
    		else
    			lWithdrawP = guiCreateLabel(0.1, 0.15, 0.5, 0.05, "This ATM does not support the withdraw function.", true, tabPersonal)
    			guiSetFont(lWithdrawP, "default-bold-small")
    		end
    
    		if (depositable) then
    			-- DEPOSIT PERSONAL
    			lDepositP = guiCreateLabel(0.1, 0.25, 0.2, 0.05, "Deposit:", true, tabPersonal)
    			guiSetFont(lDepositP, "default-bold-small")
    
    			tDepositP = guiCreateEdit(0.22, 0.23, 0.2, 0.075, "0", true, tabPersonal)
    			guiSetFont(tDepositP, "default-bold-small")
    			addEventHandler("onClientGUIClick", tDepositP, function()
    				if guiGetText(tDepositP) == "0" then
    					guiSetText(tDepositP, "")
    				end
    			end, false)
    
    			bDepositP = guiCreateButton(0.44, 0.23, 0.2, 0.075, "Deposit", true, tabPersonal)
    			addEventHandler("onClientGUIClick", bDepositP, depositMoneyPersonal, false)
    		else
    			lDepositP = guiCreateLabel(0.1, 0.25, 0.5, 0.05, "This ATM does not support the deposit function.", true, tabPersonal)
    			guiSetFont(lDepositP, "default-bold-small")
    
    			if limitedwithdraw > 0 and withdrawable then
    				tDepositP = guiCreateLabel(0.67, 0.15, 0.2, 0.05, "Max: $" .. ( limitedwithdraw - ( getElementData( source, "withdrawn" ) or 0 ) ) .. ".", true, tabPersonal)
    				guiSetFont(tDepositP, "default-bold-small")
    			end
    		end
    
    		if hoursplayed >= 12 then
    			-- TRANSFER PERSONAL
    			lTransferP = guiCreateLabel(0.1, 0.45, 0.2, 0.05, "Transfer:", true, tabPersonal)
    			guiSetFont(lTransferP, "default-bold-small")
    
    			tTransferP = guiCreateEdit(0.22, 0.43, 0.2, 0.075, "0", true, tabPersonal)
    			guiSetFont(tTransferP, "default-bold-small")
    			addEventHandler("onClientGUIClick", tTransferP, function()
    				if guiGetText(tTransferP) == "0" then
    					guiSetText(tTransferP, "")
    				end
    			end, false)
    
    			bTransferP = guiCreateButton(0.44, 0.43, 0.2, 0.075, "Transfer to", true, tabPersonal)
    			addEventHandler("onClientGUIClick", bTransferP, transferMoneyPersonal, false)
    
    			eTransferP = guiCreateEdit(0.66, 0.43, 0.3, 0.075, "<Player/Faction Name>", true, tabPersonal)
    			addEventHandler("onClientGUIClick", eTransferP, function()
    				if guiGetText(eTransferP) == "<Player/Faction Name>" then
    					guiSetText(eTransferP, "")
    				end
    			end, false)
    
    			lTransferPReason = guiCreateLabel(0.1, 0.55, 0.2, 0.05, "Reason:", true, tabPersonal)
    			guiSetFont(lTransferPReason, "default-bold-small")
    
    			tTransferPReason = guiCreateEdit(0.22, 0.54, 0.74, 0.075, "<What is this transaction for?>", true, tabPersonal)
    			addEventHandler("onClientGUIClick", tTransferPReason, function()
    				if guiGetText(tTransferPReason) == "<What is this transaction for?>" then
    					guiSetText(tTransferPReason, "")
    				end
    			end, false)
    		end
    
    		-- TRANSACTION HISTORY
    
    		gPersonalTransactions = guiCreateGridList(0.02, 0.02, 0.96, 0.96, true, tabPersonalTransactions)
    		for key, value in ipairs( transactionColumns ) do
    			guiGridListAddColumn( gPersonalTransactions, value[1], value[2] or 0.1 )
    		end
    
    		guiSetInputEnabled(true)
    
    		--outputChatBox("Welcome to the Bank of Los Santos")
    
    	end
    end
    addEvent("showBankUI", true)
    addEventHandler("showBankUI", getRootElement(), showBankUI)
    
    function hideBankUI()
    	if isElement(wBank) then
    		destroyElement(wBank)
    		wBank = nil
    
    		guiSetInputEnabled(false)
    
    		cooldown = setTimer(function() cooldown = nil end, 1000, 1)
    		setElementData(getLocalPlayer(), "exclusiveGUI", false, false)
    	end
    end
    addEvent("hideBankUI", true)
    addEventHandler("hideBankUI", getRootElement(), hideBankUI)
    addEventHandler ( "onSapphireXMBShow", getRootElement(), hideBankUI )
    addEventHandler("onClientChangeChar", getRootElement(), hideBankUI)
    
    function withdrawMoneyPersonal(button)
    	if (button=="left") then
    		local amount = tonumber2(guiGetText(tWithdrawP))
    		local money = getElementData(localPlayer, "bankmoney")
    
    		local oldamount = getElementData( lastUsedATM, "withdrawn" ) or 0
    		if not amount or amount <= 0 or math.ceil( amount ) ~= amount then
    			outputChatBox("Please enter a positive amount!", 255, 0, 0)
    		elseif (amount>money) then
    			outputChatBox("You do not have enough funds.", 255, 0, 0)
    		elseif not _depositable and limitedwithdraw ~= 0 and oldamount + amount > limitedwithdraw then
    			outputChatBox("This ATM only allows you to withdraw $" .. exports.global:formatMoney( limitedwithdraw - oldamount ) .. ".")
    		else
    			setElementData( lastUsedATM, "withdrawn", oldamount + amount, false )
    			setTimer(
    				function( atm, amount )
    					setElementData( atm, "withdrawn", getElementData( atm, "withdrawn" ) - amount )
    				end,
    				120000, 1, lastUsedATM, amount
    			)
    			hideBankUI()
    			triggerServerEvent("withdrawMoneyPersonal", localPlayer, amount)
    		end
    	end
    end
    
    function depositMoneyPersonal(button)
    	if (button=="left") then
    		local amount = tonumber2(guiGetText(tDepositP))
    
    		if not amount or amount <= 0 or math.ceil( amount ) ~= amount then
    			outputChatBox("Please enter a positive amount!", 255, 0, 0)
    		elseif not exports.global:hasMoney(localPlayer, amount) then
    			outputChatBox("You do not have enough funds.", 255, 0, 0)
    		else
    			hideBankUI()
    			triggerServerEvent("depositMoneyPersonal", localPlayer, amount)
    		end
    	end
    end
    
    function transferMoneyPersonal(button)
    	if (button=="left") then
    		local amount = tonumber2(guiGetText(tTransferP))
    		local money = getElementData(localPlayer, "bankmoney")
    		local reason = guiGetText(tTransferPReason)
    		local playername = guiGetText(eTransferP)
    
    		if not amount or amount <= 0 or math.ceil( amount ) ~= amount then
    			outputChatBox("Please enter a positive amount!", 255, 0, 0)
    		elseif (amount>money) then
    			outputChatBox("You do not have enough funds.", 255, 0, 0)
    		elseif reason == "" then
    			outputChatBox("Please enter a reason for the Transfer!", 255, 0, 0)
    		elseif playername == "" then
    			outputChatBox("Please enter the full character name of the reciever!", 255, 0, 0)
    		else
    			triggerServerEvent("transferMoneyToPersonal", localPlayer, false, playername, amount, reason)
    			guiSetText(tTransferP, "0")
    			guiSetText(tTransferPReason, "")
    			guiSetText(eTransferP, "")
    		end
    	end
    end
    
    function withdrawMoneyBusiness(button)
    	if (button=="left") then
    		local amount = tonumber2(guiGetText(tWithdrawB))
    
    		local oldamount = getElementData( lastUsedATM, "withdrawn" ) or 0
    		if not amount or amount <= 0 or math.ceil( amount ) ~= amount then
    			outputChatBox("Please enter a positive amount!", 255, 0, 0)
    		elseif (amount>gfactionBalance) then
    			outputChatBox("You do not have enough funds.", 255, 0, 0)
    		elseif not _depositable and limitedwithdraw ~= 0 and oldamount + amount > limitedwithdraw then
    			outputChatBox("This ATM only allows you to withdraw $" .. exports.global:formatMoney( limitedwithdraw - oldamount ) .. ".")
    		else
    			setElementData( lastUsedATM, "withdrawn", oldamount + amount, false )
    			setTimer(
    				function( atm, amount )
    					setElementData( atm, "withdrawn", getElementData( atm, "withdrawn" ) - amount, false )
    				end,
    				120000, 1, lastUsedATM, amount
    			)
    			hideBankUI()
    			triggerServerEvent("withdrawMoneyBusiness", localPlayer, amount)
    		end
    	end
    end
    
    function depositMoneyBusiness(button)
    	if (button=="left") then
    		local amount = tonumber2(guiGetText(tDepositB))
    
    		if not amount or amount <= 0 or math.ceil( amount ) ~= amount then
    			outputChatBox("Please enter a positive amount!", 255, 0, 0)
    		elseif not exports.global:hasMoney(localPlayer, amount) then
    			outputChatBox("You do not have enough funds.", 255, 0, 0)
    		else
    			hideBankUI()
    			triggerServerEvent("depositMoneyBusiness", localPlayer, amount)
    		end
    	end
    end
    
    function transferMoneyBusiness(button)
    	if (button=="left") then
    		local amount = tonumber2(guiGetText(tTransferB))
    		local playername = guiGetText(eTransferB)
    		local reason = guiGetText(tTransferBReason)
    
    		if not amount or amount <= 0 or math.ceil( amount ) ~= amount then
    			outputChatBox("Please enter a positive amount!", 255, 0, 0)
    		elseif (amount>gfactionBalance) then
    			outputChatBox("You do not have enough funds.", 255, 0, 0)
    		elseif reason == "" then
    			outputChatBox("Please enter a reason for the Transfer!", 255, 0, 0)
    		elseif playername == "" then
    			outputChatBox("Please enter the full character name of the reciever!", 255, 0, 0)
    		else
    			triggerServerEvent("transferMoneyToPersonal", localPlayer, true, playername, amount, reason)
    			guiSetText(tTransferB, "0")
    			guiSetText(tTransferBReason, "")
    			guiSetText(eTransferB, "")
    		end
    	end
    end
    
    function getTransactionReason(type, reason, from)
    	if type == 0 or type == 4 then
    		return "Withdraw"
    	elseif type == 1 or type == 5 then
    		return "Deposit"
    	elseif type == 6 then
    		return tostring(reason or "")
    	elseif type == 7 then
    		return "Payday (Biz+Interest+Donator)"
    	elseif type == 8 then
    		return "Budget"
    	elseif type == 9 then
    		return tostring("Fuel: "..math.ceil(reason).."L")
    	elseif type == 10 then
    		return "Repair"
    	elseif type == 11 then
    		return "Wage"
    	else
    		return "Transfer: " .. tostring(reason or "")
    	end
    end
    
    function recieveTransfer(grid,  id, amount, time, type, from, to, reason, details)
    	local row = guiGridListAddRow(grid)
    	guiGridListSetItemText(grid, row, 1, tostring(id), false, true)
    	guiGridListSetItemText(grid, row, 2, from, false, false)
    	guiGridListSetItemText(grid, row, 3, to, false, false)
    	if amount < 0 then
    		guiGridListSetItemText(grid, row, 4, "-$"..exports.global:formatMoney(math.abs(amount)), false, true)
    		guiGridListSetItemColor(grid, row, 4, 255, 127, 127)
    	else
    		guiGridListSetItemText(grid, row, 4, "$"..exports.global:formatMoney(amount), false, true)
    		guiGridListSetItemColor(grid, row, 4, 127, 255, 127)
    	end
    	guiGridListSetItemText(grid, row, 5, time, false, false)
    	guiGridListSetItemText(grid, row, 6, " " .. getTransactionReason(type, reason, from), false, false)
    	guiGridListSetItemText(grid, row, 7, " " .. details, false, false)
    end
    
    function recievePersonalTransfer(...)
    	recieveTransfer(gPersonalTransactions, ...)
    end
    
    addEvent("recievePersonalTransfer", true)
    addEventHandler("recievePersonalTransfer", localPlayer, recievePersonalTransfer)
    
    function recieveBusinessTransfer(...)
    	recieveTransfer(gBusinessTransactions, ...)
    end
    
    addEvent("recieveBusinessTransfer", true)
    addEventHandler("recieveBusinessTransfer", localPlayer, recieveBusinessTransfer)
    
    function checkDataChange(dn)
    	if wBank then
    		if dn == "bankmoney" and source == localPlayer then
    			guiSetText(lBalance, "Balance: $" .. exports.global:formatMoney(getElementData(source, "bankmoney")))
    		elseif dn == "money" and source == getPlayerTeam(localPlayer) then
    			gfactionBalance = getElementData(source, "money")
    			guiSetText(lBalanceB, "Balance: $" .. exports.global:formatMoney(gfactionBalance))
    		end
    	end
    end
    addEventHandler("onClientElementDataChange", getRootElement(), checkDataChange)
    
    local thisResourceElement = getResourceRootElement(getThisResource())
    function cleanUp()
    	setElementData(getLocalPlayer(), "exclusiveGUI", false, false)
    end
    addEventHandler("onClientResourceStart", thisResourceElement, cleanUp)
    
    function fadeOut()
    	fadeCamera ( true, 1, 0, 0, 0 )
    end
    addEvent("bank:fadeOut", true)
    addEventHandler("bank:fadeOut", localPlayer, fadeOut)
    
    function isCameraOnPlayer()
    	local vehicle = getPedOccupiedVehicle(getLocalPlayer())
    	if vehicle then
    		return getCameraTarget( ) == vehicle
    	else
    		return getCameraTarget( ) == getLocalPlayer()
    	end
    end
    
    function hasBankMoney(thePlayer, amount)
    	amount = tonumber(amount)
    	amount = math.floor(math.abs(amount))
    	return getElementData(thePlayer, "bankmoney") >= amount
    end

    شوف ذا الكود

    مشكلته مابيه يتحرك الا اذا شغل Close

    لاكن اذا اتصلت بآمر call

    يصير يقدر يتحرك واللوحة شغالة

    وانا ابيه م يتحرك مهما صار لو اتصل او اي شي

     

  5. سلآم عليكم ورحمة الله وبركاته

    عندي مود آلبنك فيه مشكلة

    آبي اذا فتحت اللوحة م يقدر يكتب اي امر الا اذا قفلها

    مثلا جيت للمود وجاني لوحة سحب الفلوس وكذا

    ابي اكتب باف 8 call

    م ينكتب يعني الامر يتعطل واذا قفلت اللوحة عادي يرجع طبيعي ويتفعل الامر

  6. لم تزبط معنا :( , اخ

    8 minutes ago, +Source|> said:
    
    function banAPlayer(thePlayer, commandName, targetPlayer, hours, ...)	if exports["integration"]:isPlayerTrialAdmin(thePlayer) then		if not (targetPlayer) or not (hours) or not tonumber(hours) or tonumber(hours)<0 or not (...) then			outputChatBox("SYNTAX: /" .. commandName .. " [Player Partial Nick / ID] [Time in Hours, 0 = Infinite] [Reason]", thePlayer, 255, 194, 14, true)		else			local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick(thePlayer, targetPlayer)			local targetPlayerSerial = getPlayerSerial(targetPlayer)			local targetPlayerIP = getPlayerIP(targetPlayer)			hours = tonumber(hours)			if not (targetPlayer) then			elseif (hours>168) then				outputChatBox("You cannot ban for more than 7 days (168 Hours).", thePlayer, 255, 194, 14, true)			else				local thePlayerPower = exports.global:getPlayerAdminLevel(thePlayer)				local targetPlayerPower = exports.global:getPlayerAdminLevel(targetPlayer)				reason = table.concat({...}, " ")				if (targetPlayerPower <= thePlayerPower) then -- Check the admin isn't banning someone higher rank them him					local hiddenAdmin = getElementData(thePlayer, "hiddenadmin")					local playerName = getPlayerName(thePlayer)					local accountID = getElementData(targetPlayer, "account:id")					local username = getElementData(targetPlayer, "account:username") or "N/A"					local seconds = ((hours*60)*60)					local rhours = hours					-- text value					if (hours==0) then						hours = "Permanent"					elseif (hours==1) then						hours = "1 Hour"					else						hours = hours .. " Hours"					end					if hours == "Permanent" then						reason = reason .. " (" .. hours .. ")"					else						reason = reason .. " (" .. hours .. ")"					end										exports['admin-system']:addAdminHistory(targetPlayer, thePlayer, reason, 2 , rhours)					local banId = nil					if (seconds == 0) then						banId = addToBan(accountID, targetPlayerSerial, targetPlayerIP, getElementData(thePlayer, "account:id"), reason)						if banId and tonumber(banId) then							lastBan = mysql:query_fetch_assoc("SELECT * FROM bans WHERE id='"..banId.."'")							if lastBanTimer and isTimer(lastBanTimer) then								killTimer(lastBanTimer)								lastBanTimer = nil							end							lastBanTimer = setTimer(function()								lastBan = nil							end, 1000*60*5,1) --5 minutes						end					else						addBan(nil, nil, targetPlayerSerial, thePlayer, reason, seconds)					end					local adminUsername = getElementData(thePlayer, "account:username")					local adminUserID = getElementData(thePlayer, "account:id")					local adminTitle = exports.global:getPlayerAdminTitle(thePlayer)					makeForumThread(targetPlayerName or "N/A", username, hours, adminTitle , playerName, thePlayer, reason, adminUsername, adminUserID, banId )					for key, value in ipairs(getElementsByType("player")) do						if getPlayerSerial(value) == targetPlayerSerial then							kickPlayer(value, thePlayer, reason)						end					end					adminTitle = exports.global:getAdminTitle1(thePlayer)					if (hiddenAdmin==1) then						adminTitle = "A hidden admin"					end					if string.lower(commandName) == "sban" then						exports.global:sendMessageToAdmins("[SILENT-BAN] " .. adminTitle .. " silently banned " .. targetPlayerName .. ". (" .. hours .. ")")						exports.global:sendMessageToAdmins("[SILENT-BAN] Reason: " .. reason .. ".")					elseif string.lower(commandName) == "forceapp" then						outputChatBox("[FA] "..adminTitle .. " " .. playerName .. " forced app " .. targetPlayerName .. ".", root, 255,0,0, true )						hours = "Permanent"						reason = "Failure to meet server standard. Please improve yourself then appeal on forums"						outputChatBox("[FA]: Reason: " .. reason .. "." ,root, 255,0,0, true)					else						outputChatBox("[BAN] " .. adminTitle .. " banned " .. targetPlayerName .. ". (" .. hours .. ")", root, 255,0,0, true)						outputChatBox("[BAN] Reason: " .. reason .. ".", root, 255,0,0, true)					end			end		end	endendendaddCommandHandler("pban", banAPlayer, false, false)addCommandHandler("sban", banAPlayer, false, false)

     

    م ضبط يبند الشخص وكل شي بس السبب م يطلع بالشات للكل

  7. 8 minutes ago, +Source|> said:
    
    					if string.lower(commandName) == "sban" then
    						exports.global:sendMessageToAdmins("[SILENT-BAN] " .. adminTitle .. " silently banned " .. targetPlayerName .. ". (" .. hours .. ")")
    						exports.global:sendMessageToAdmins("[SILENT-BAN] Reason: " .. reason .. ".")
    					elseif string.lower(commandName) == "forceapp" then
    						outputChatBox("[FA] "..adminTitle .. " " .. playerName .. " forced app " .. targetPlayerName .. ".", root, 255,0,0)
    						hours = "Permanent"
    						reason = "Failure to meet server standard. Please improve yourself then appeal on forums.owlgaming.net"
    						outputChatBox("[FA]: Reason: " .. reason .. "." ,root, 255,0,0)
    					else
    						outputChatBox("[BAN] " .. adminTitle .. " banned " .. targetPlayerName .. ". (" .. hours .. ")", root, 255,0,0)
    						outputChatBox("[BAN] Reason: " .. reason .. ".", root, 255,0,0)
    					end
    

     

     

     

    
    					if string.lower(commandName) == "sban" then
    						exports.global:sendMessageToAdmins("[SILENT-BAN] " .. adminTitle .. " silently banned " .. targetPlayerName .. ". (" .. hours .. ")")
    						exports.global:sendMessageToAdmins("[SILENT-BAN] Reason: " .. reason .. ".")
    					elseif string.lower(commandName) == "forceapp" then
    						outputChatBox("[FA] "..adminTitle .. " " .. playerName .. " forced app " .. targetPlayerName .. ".", root, 255,0,0, true)
    						hours = "Permanent"
    						reason = "Failure to meet server standard. Please improve yourself then appeal on forums.owlgaming.net"
    						outputChatBox("[FA]: Reason: " .. reason .. "." ,root, 255,0,0, true)
    					else
    						outputChatBox("[BAN] " .. adminTitle .. " banned " .. targetPlayerName .. ". (" .. hours .. ")", root, 255,0,0, true)
    						outputChatBox("[BAN] Reason: " .. reason .. ".", root, 255,0,0, true)
    					end
    

     

    م ضبط الكود

     حطيت الكود كامل فوق

  8. الكود

    function banAPlayer(thePlayer, commandName, targetPlayer, hours, ...)
    	if exports["integration"]:isPlayerTrialAdmin(thePlayer) then
    		if not (targetPlayer) or not (hours) or not tonumber(hours) or tonumber(hours)<0 or not (...) then
    			outputChatBox("SYNTAX: /" .. commandName .. " [Player Partial Nick / ID] [Time in Hours, 0 = Infinite] [Reason]", thePlayer, 255, 194, 14)
    		else
    			local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick(thePlayer, targetPlayer)
    			local targetPlayerSerial = getPlayerSerial(targetPlayer)
    			local targetPlayerIP = getPlayerIP(targetPlayer)
    			hours = tonumber(hours)
    
    			if not (targetPlayer) then
    			elseif (hours>168) then
    				outputChatBox("You cannot ban for more than 7 days (168 Hours).", thePlayer, 255, 194, 14)
    			else
    				local thePlayerPower = exports.global:getPlayerAdminLevel(thePlayer)
    				local targetPlayerPower = exports.global:getPlayerAdminLevel(targetPlayer)
    				reason = table.concat({...}, " ")
    
    				if (targetPlayerPower <= thePlayerPower) then -- Check the admin isn't banning someone higher rank them him
    					local hiddenAdmin = getElementData(thePlayer, "hiddenadmin")
    					local playerName = getPlayerName(thePlayer)
    					local accountID = getElementData(targetPlayer, "account:id")
    					local username = getElementData(targetPlayer, "account:username") or "N/A"
    
    					local seconds = ((hours*60)*60)
    					local rhours = hours
    					-- text value
    					if (hours==0) then
    						hours = "Permanent"
    					elseif (hours==1) then
    						hours = "1 Hour"
    					else
    						hours = hours .. " Hours"
    					end
    
    					if hours == "Permanent" then
    						reason = reason .. " (" .. hours .. ")"
    					else
    						reason = reason .. " (" .. hours .. ")"
    					end
    
    					
    					exports['admin-system']:addAdminHistory(targetPlayer, thePlayer, reason, 2 , rhours)
    					local banId = nil
    					if (seconds == 0) then
    						banId = addToBan(accountID, targetPlayerSerial, targetPlayerIP, getElementData(thePlayer, "account:id"), reason)
    						if banId and tonumber(banId) then
    							lastBan = mysql:query_fetch_assoc("SELECT * FROM bans WHERE id='"..banId.."'")
    							if lastBanTimer and isTimer(lastBanTimer) then
    								killTimer(lastBanTimer)
    								lastBanTimer = nil
    							end
    							lastBanTimer = setTimer(function()
    								lastBan = nil
    							end, 1000*60*5,1) --5 minutes
    						end
    					else
    						addBan(nil, nil, targetPlayerSerial, thePlayer, reason, seconds)
    					end
    
    					local adminUsername = getElementData(thePlayer, "account:username")
    					local adminUserID = getElementData(thePlayer, "account:id")
    					local adminTitle = exports.global:getPlayerAdminTitle(thePlayer)
    					makeForumThread(targetPlayerName or "N/A", username, hours, adminTitle , playerName, thePlayer, reason, adminUsername, adminUserID, banId )
    					for key, value in ipairs(getElementsByType("player")) do
    						if getPlayerSerial(value) == targetPlayerSerial then
    							kickPlayer(value, thePlayer, reason)
    						end
    					end
    
    					adminTitle = exports.global:getAdminTitle1(thePlayer)
    					if (hiddenAdmin==1) then
    						adminTitle = "A hidden admin"
    					end
    
    					if string.lower(commandName) == "sban" then
    						exports.global:sendMessageToAdmins("[SILENT-BAN] " .. adminTitle .. " silently banned " .. targetPlayerName .. ". (" .. hours .. ")")
    						exports.global:sendMessageToAdmins("[SILENT-BAN] Reason: " .. reason .. ".")
    					elseif string.lower(commandName) == "forceapp" then
    						outputChatBox("[FA] "..adminTitle .. " " .. playerName .. " forced app " .. targetPlayerName .. ".", root, 255,0,0,)
    						hours = "Permanent"
    						reason = "Failure to meet server standard. Please improve yourself then appeal on forums"
    						outputChatBox("[FA]: Reason: " .. reason .. "." ,root, 255,0,0, true)
    					else
    						outputChatBox("[BAN] " .. adminTitle .. " banned " .. targetPlayerName .. ". (" .. hours .. ")", root, 255,0,0)
    						outputChatBox("[BAN] Reason: " .. reason .. ".", root, 255,0,0, true)
    					end
    			end
    		end
    	end
    end
    addCommandHandler("pban", banAPlayer, false, false)
    addCommandHandler("sban", banAPlayer, false, false)

     

×
×
  • Create New...