Jump to content

{مساعدة)


Recommended Posts

السلام عليكم ورحمة الله
لدي مشكلة ف مود ارسال اسلحة 
انه مايجيب اسماء لاعبين لما بتجي ترسل 

https://e.top4top.net/p_518beuc81.png

https://a.top4top.net/p_518tharg2.png

ارجو مساعدة وشكرا

---مود اف5
addEventHandler("onClientResourceStart", resourceRoot,
  function()
GUIEditor.Image = {}
GUIEditor = {
    button = {}
}


 Control = guiCreateStaticImage(346, 146, 831, 533, "images/rules.png", false)
 guiWindowSetSizable(Control, false)
guiWindowSetSizable(Control, false)
		guiSetVisible(Control, false)
		guiWindowSetMovable(Control, false)
        Controll = guiCreateStaticImage(260, 49, 306, 278, "images/tarkep.png", false, Control)
        button1 = guiCreateButton(6, 206, 203, 46, "لوحة فتح ابواب السيارة", false, Control)
        local font0_LLK = guiCreateFont("fonts/LK.ttf", 14)
        guiSetFont(button1, font0_LLK)
        guiSetProperty(button1, "NormalTextColour", "FFFF0000")
        button2 = guiCreateButton(6, 341, 203, 46, "لوحة ارسال اسلحة", false, Control)
        local font1_LLK = guiCreateFont("fonts/LK.ttf", 20)
        guiSetFont(button2, font1_LLK)
        guiSetProperty(button2, "NormalTextColour", "FFFD0101")
        button3 = guiCreateButton(6, 460, 203, 46, "لوحة حفط ملابس", false, Control)
        local font2_LLK = guiCreateFont("fonts/LK.ttf", 19)
        guiSetFont(button3, font2_LLK)
        guiSetProperty(button3, "NormalTextColour", "FFFD0101")
        button4 = guiCreateButton(618, 216, 203, 46, "اغاني", false, Control)
        local font3_LLK = guiCreateFont("fonts/LK.ttf", 25)
        guiSetFont(button4, font3_LLK)
        guiSetProperty(button4, "NormalTextColour", "FFFD0101")
        button5 = guiCreateButton(618, 347, 203, 46, "لوحة ارسال فلوس", false, Control)
        guiSetFont(button5, font1_LLK)
        guiSetProperty(button5, "NormalTextColour", "FFFD0101")
        button6 = guiCreateButton(618, 460, 203, 46, "لوحة اختيار ليزر", false, Control)
        local font4_LLK = guiCreateFont("fonts/LK.ttf", 26)
        guiSetFont(button6, font4_LLK)
        guiSetProperty(button6, "NormalTextColour", "FFFD0101")    
        By = guiCreateLabel(2, 506, 824, 22, "BY ismaeel 2017", false, Control)
        local font5_LLK = guiCreateFont("fonts/LK.ttf", 19)
        guiSetFont(By, font5_LLK)
        guiLabelSetColor(By, 0, 100, 150)
    end
)
bindKey("F5","down",
function ()
    guiSetVisible(Control,not guiGetVisible(Control))
    showCursor(guiGetVisible(Control))
end)   


addEventHandler ("onClientGUIClick", root,
        function()
        if (source == button1) then
         guiSetVisible(Car, true)
		 guiSetVisible(Control, false)
		 elseif (source == button3) then
		 guiSetVisible(Cj, true)
		 guiSetVisible(Control, false)
		 guiSetVisible(Control, false)
		 elseif (source == button5) then
		 guiSetVisible(panelmoney, true)
         Update ()
		 guiSetVisible(Control, false)
		 elseif (source == button6) then
		 guiSetVisible(laser, true)
		 guiSetVisible(Control, false)
         elseif (source == button2) then
		 guiSetVisible(wnd, true)
		 guiSetVisible(Control, false)
         elseif (source == button4) then
		 guiSetVisible(window, true)
		 guiSetVisible(Control, false)
        end
    end
)







---مود ارسال دخيرة
--- Client

--local KEY = "F10" -- Hot Key





function centerWindow(center_window) 
    local screenW,screenH=guiGetScreenSize()
    local windowW,windowH=guiGetSize(center_window,false)
    local x,y = (screenW-windowW)/2,(screenH-windowH)/2
    guiSetPosition(center_window,x,y,false)
end

function getPedWeapons(ped) 
	local playerWeapons = {}
	if ped and isElement(ped) and getElementType(ped) == "ped" or getElementType(ped) == "player" then
		for i=2,9 do
			local wep = getPedWeapon(ped,i)
			if wep and wep ~= 0 then
				table.insert(playerWeapons,wep)
			end
		end
	else
		return false
	end
	return playerWeapons
end

-- ## Main Window ##
        wnd = guiCreateStaticImage(460, 155, 520, 513, "images/Window.png", false)
        guiWindowSetSizable(wnd, false) 
        guiSetVisible(wnd,false)
        players_grid = guiCreateGridList(4, 69, 161, 342, false, wnd)
        guiGridListAddColumn(players_grid, "Players", 0.9)
        guiGridListAddRow(players_grid)
        guiGridListSetItemText(players_grid, 0, 1, "-", false, false)
        edit = guiCreateEdit(196, 376, 314, 25, "", false, wnd)
        send = guiCreateButton(398, 408, 118, 41, "ارسال", false, wnd)
        local font0_LK = guiCreateFont("fonts/LK.ttf", 16)
        guiSetFont(send, font0_LK)
        weapons_grid = guiCreateGridList(369, 80, 147, 296, false, wnd)
        guiGridListAddColumn(weapons_grid, "Weapon", 0.5)
        guiGridListAddColumn(weapons_grid, "Ammo", 0.5)
        guiGridListAddRow(weapons_grid)
        guiGridListSetItemText(weapons_grid, 0, 1, "-", false, false)
        label = guiCreateLabel(0, 0, 369, 53, "لوحة ارسال الدخيرة ", false, wnd)
        local font1_LK = guiCreateFont("fonts/LK.ttf", 39)
        guiSetFont(label, font1_LK)
        guiLabelSetColor(label, 251, 207, 3)
        logo = guiCreateStaticImage(188, 113, 156, 193, "images/logo.png", false, wnd)
        info = guiCreateLabel(199, 404, 193, 23, "رجاء قم بكتابة عدد دخيرة مراد ارسالها", false, wnd)
        local font2_LK = guiCreateFont("fonts/LK.ttf", 10)
        guiSetFont(info, font2_LK)
        close = guiCreateButton(480, 3, 40, 40, "X", false, wnd)
        guiSetProperty(close, "NormalTextColour", "FFA50000")    
 

guiSetVisible(wnd,false)
centerWindow(wnd)

bindKey(KEY,"down",
	function ()
		if guiGetVisible(wnd) then
			guiSetVisible(wnd,false)
			showCursor(false)
			guiSetInputEnabled(false)
		else
			guiSetVisible(wnd,true)
			showCursor(true)
			guiSetInputEnabled(true)
			putPlayers()
			putWeapons()
		end
	end
)

function putPlayers()
	guiGridListClear(players_grid)
	for _,player in ipairs(getElementsByType("player")) do
		local row = guiGridListAddRow(players_grid)
		guiGridListSetItemText(players_grid,row,1,getPlayerName(player),false,false)
	end
end

function putWeapons()
	guiGridListClear(weapons_grid)
	for _,weapon in ipairs(getPedWeapons(localPlayer)) do
		if getPedTotalAmmo(localPlayer,getSlotFromWeapon(weapon)) > 0 then
			local row = guiGridListAddRow(weapons_grid)
			guiGridListSetItemText(weapons_grid,row,1,getWeaponNameFromID(weapon),false,false)
			guiGridListSetItemText(weapons_grid,row,2,getPedTotalAmmo(localPlayer,getSlotFromWeapon(weapon)),false,false)
		end
	end
end

function RefreshLists()
	putPlayers()
	putWeapons()
end

addEventHandler("onClientGUIClick",close,
	function ()
		guiSetVisible(wnd,false)
		showCursor(false)
		guiSetInputEnabled(false)
	end
,false)

addEventHandler("onClientGUIClick",send,
	function ()
		local sel_1 = guiGridListGetSelectedItem(players_grid)
		local sel_2 = guiGridListGetSelectedItem(weapons_grid)
		if sel_1 ~= -1 and sel_2 ~= -1 then
			local PlayerName = guiGridListGetItemText(players_grid,sel_1,1)
			local player = getPlayerFromName(PlayerName)
			if isElement(player) then
				if player ~= localPlayer then
					local WeaponName = guiGridListGetItemText(weapons_grid,sel_2,1)
					local WeaponAmmo = guiGridListGetItemText(weapons_grid,sel_2,2)
					local WeaponID = getWeaponIDFromName(WeaponName)
					local Ammo = guiGetText(ammo)
					if tonumber(Ammo) and tonumber(Ammo) >= 10 then
						if tonumber(WeaponAmmo) >= tonumber(Ammo) then
							setTimer(RefreshLists,500,1)
							triggerServerEvent("SendWeapon",localPlayer,player,WeaponID,Ammo)
						else
							outputChatBox("# ليس لديك دخيرة كافية لهادة السلاح",255,0,0)
						end
					else
						outputChatBox("رجاء قم بادخال قيمة مراد ارسالها ",255,0,0)
					end
				else
					outputChatBox("#لايمكنك ارسال المال لنفسك",255,0,0)
				end
			else
				RefreshLists()
				outputChatBox("# لم يتم عتور علي لاعب",255,0,0)
			end
		end
	end
)

---server

addEvent("SendWeapon",true)
addEventHandler("SendWeapon",root,
	function (player,id,ammo)
		local id = tonumber(id)
		local ammo = tonumber(ammo)
		giveWeapon(player,id,ammo)
		takeWeapon(source,id,ammo)
		outputChatBox("##0069c7 لقد قمت بارسال دخيرة " .. getWeaponNameFromID(id) .. "#0069c7الي #ffff000" .. getPlayerName(player),source,255,0,0,true)
		outputChatBox("# " .. getPlayerName(source) .. " #0069c7Has Sent #ff0000" .. getWeaponNameFromID(id) .. " #0069c7To You With #ff0000" .. ammo .. " #0069c7Ammo",player,255,0,0,true)
	end
)

 

Link to comment
---مود اف5




 Control = guiCreateStaticImage(346, 146, 831, 533, "images/rules.png", false)
 guiWindowSetSizable(Control, false)
guiWindowSetSizable(Control, false)
		guiSetVisible(Control, false)
		guiWindowSetMovable(Control, false)
        Controll = guiCreateStaticImage(260, 49, 306, 278, "images/tarkep.png", false, Control)
        button1 = guiCreateButton(6, 206, 203, 46, "لوحة فتح ابواب السيارة", false, Control)
        local font0_LLK = guiCreateFont("fonts/LK.ttf", 14)
        guiSetFont(button1, font0_LLK)
        guiSetProperty(button1, "NormalTextColour", "FFFF0000")
        button2 = guiCreateButton(6, 341, 203, 46, "لوحة ارسال اسلحة", false, Control)
        local font1_LLK = guiCreateFont("fonts/LK.ttf", 20)
        guiSetFont(button2, font1_LLK)
        guiSetProperty(button2, "NormalTextColour", "FFFD0101")
        button3 = guiCreateButton(6, 460, 203, 46, "لوحة حفط ملابس", false, Control)
        local font2_LLK = guiCreateFont("fonts/LK.ttf", 19)
        guiSetFont(button3, font2_LLK)
        guiSetProperty(button3, "NormalTextColour", "FFFD0101")
        button4 = guiCreateButton(618, 216, 203, 46, "اغاني", false, Control)
        local font3_LLK = guiCreateFont("fonts/LK.ttf", 25)
        guiSetFont(button4, font3_LLK)
        guiSetProperty(button4, "NormalTextColour", "FFFD0101")
        button5 = guiCreateButton(618, 347, 203, 46, "لوحة ارسال فلوس", false, Control)
        guiSetFont(button5, font1_LLK)
        guiSetProperty(button5, "NormalTextColour", "FFFD0101")
        button6 = guiCreateButton(618, 460, 203, 46, "لوحة اختيار ليزر", false, Control)
        local font4_LLK = guiCreateFont("fonts/LK.ttf", 26)
        guiSetFont(button6, font4_LLK)
        guiSetProperty(button6, "NormalTextColour", "FFFD0101")    
        By = guiCreateLabel(2, 506, 824, 22, "BY ismaeel 2017", false, Control)
        local font5_LLK = guiCreateFont("fonts/LK.ttf", 19)
        guiSetFont(By, font5_LLK)
        guiLabelSetColor(By, 0, 100, 150)

bindKey("F5","down",
function ()
    guiSetVisible(Control,not guiGetVisible(Control))
    showCursor(guiGetVisible(Control))
end)   









---مود ارسال دخيرة
--- Client

local KEY = "F10" -- Hot Key





function centerWindow(center_window) 
    local screenW,screenH=guiGetScreenSize()
    local windowW,windowH=guiGetSize(center_window,false)
    local x,y = (screenW-windowW)/2,(screenH-windowH)/2
    guiSetPosition(center_window,x,y,false)
end

function getPedWeapons(ped) 
	local playerWeapons = {}
	if ped and isElement(ped) and getElementType(ped) == "ped" or getElementType(ped) == "player" then
		for i=2,9 do
			local wep = getPedWeapon(ped,i)
			if wep and wep ~= 0 then
				table.insert(playerWeapons,wep)
			end
		end
	else
		return false
	end
	return playerWeapons
end


-- ## Main Window ##
        wnd = guiCreateStaticImage(460, 155, 520, 513, "images/Window.png", false)
        guiWindowSetSizable(wnd, false) 
        guiSetVisible(wnd,false)
        players_grid = guiCreateGridList(4, 69, 161, 342, false, wnd)
        guiGridListAddColumn(players_grid, "Players", 0.9)
        guiGridListAddRow(players_grid)
        guiGridListSetItemText(players_grid, 0, 1, "-", false, false)
        edit = guiCreateEdit(196, 376, 314, 25, "", false, wnd)
        send = guiCreateButton(398, 408, 118, 41, "ارسال", false, wnd)
        local font0_LK = guiCreateFont("fonts/LK.ttf", 16)
        guiSetFont(send, font0_LK)
        weapons_grid = guiCreateGridList(369, 80, 147, 296, false, wnd)
        guiGridListAddColumn(weapons_grid, "Weapon", 0.5)
        guiGridListAddColumn(weapons_grid, "Ammo", 0.5)
        guiGridListAddRow(weapons_grid)
        guiGridListSetItemText(weapons_grid, 0, 1, "-", false, false)
        label = guiCreateLabel(0, 0, 369, 53, "لوحة ارسال الدخيرة ", false, wnd)
        local font1_LK = guiCreateFont("fonts/LK.ttf", 39)
        guiSetFont(label, font1_LK)
        guiLabelSetColor(label, 251, 207, 3)
        logo = guiCreateStaticImage(188, 113, 156, 193, "images/logo.png", false, wnd)
        info = guiCreateLabel(199, 404, 193, 23, "رجاء قم بكتابة عدد دخيرة مراد ارسالها", false, wnd)
        local font2_LK = guiCreateFont("fonts/LK.ttf", 10)
        guiSetFont(info, font2_LK)
        close = guiCreateButton(480, 3, 40, 40, "X", false, wnd)
        guiSetProperty(close, "NormalTextColour", "FFA50000")    
 

guiSetVisible(wnd,false)
centerWindow(wnd)


function putPlayers()
	guiGridListClear(players_grid)
	for _,player in ipairs(getElementsByType("player")) do
		local row = guiGridListAddRow(players_grid)
		guiGridListSetItemText(players_grid,row,1,getPlayerName(player),false,false)
	end
end

function putWeapons()
	guiGridListClear(weapons_grid)
	for _,weapon in ipairs(getPedWeapons(localPlayer)) do
		if getPedTotalAmmo(localPlayer,getSlotFromWeapon(weapon)) > 0 then
			local row = guiGridListAddRow(weapons_grid)
			guiGridListSetItemText(weapons_grid,row,1,getWeaponNameFromID(weapon),false,false)
			guiGridListSetItemText(weapons_grid,row,2,getPedTotalAmmo(localPlayer,getSlotFromWeapon(weapon)),false,false)
		end
	end
end



addEventHandler ("onClientGUIClick", root,
        function()
        if (source == button1) then
         guiSetVisible(Car, true)
		 guiSetVisible(Control, false)
		 elseif (source == button3) then
		 guiSetVisible(Cj, true)
		 guiSetVisible(Control, false)
		 guiSetVisible(Control, false)
		 elseif (source == button5) then
		 guiSetVisible(panelmoney, true)
         Update ()
		 guiSetVisible(Control, false)
		 elseif (source == button6) then
		 guiSetVisible(laser, true)
		 guiSetVisible(Control, false)
         elseif (source == button2) then
		 guiSetVisible(wnd, true)
		 guiSetVisible(Control, false)
		  putPlayers()
		  putWeapons()
         elseif (source == button4) then
		 guiSetVisible(window, true)
		 guiSetVisible(Control, false)
        end
    end
)



bindKey(KEY,"down",
	function ()
		if guiGetVisible(wnd) then
			guiSetVisible(wnd,false)
			showCursor(false)
			guiSetInputEnabled(false)
		else
			guiSetVisible(wnd,true)
			showCursor(true)
			guiSetInputEnabled(true)
			putPlayers()
			putWeapons()
		end
	end
)



function RefreshLists()
	putPlayers()
	putWeapons()
end

addEventHandler("onClientGUIClick",close,
	function ()
		guiSetVisible(wnd,false)
		showCursor(false)
		guiSetInputEnabled(false)
	end
,false)

addEventHandler("onClientGUIClick",send,
	function ()
		local sel_1 = guiGridListGetSelectedItem(players_grid)
		local sel_2 = guiGridListGetSelectedItem(weapons_grid)
		if sel_1 ~= -1 and sel_2 ~= -1 then
			local PlayerName = guiGridListGetItemText(players_grid,sel_1,1)
			local player = getPlayerFromName(PlayerName)
			if isElement(player) then
				if player ~= localPlayer then
					local WeaponName = guiGridListGetItemText(weapons_grid,sel_2,1)
					local WeaponAmmo = guiGridListGetItemText(weapons_grid,sel_2,2)
					local WeaponID = getWeaponIDFromName(WeaponName)
					local Ammo = guiGetText(ammo)
					if tonumber(Ammo) and tonumber(Ammo) >= 10 then
						if tonumber(WeaponAmmo) >= tonumber(Ammo) then
							setTimer(RefreshLists,500,1)
							triggerServerEvent("SendWeapon",localPlayer,player,WeaponID,Ammo)
						else
							outputChatBox("# ليس لديك دخيرة كافية لهادة السلاح",255,0,0)
						end
					else
						outputChatBox("رجاء قم بادخال قيمة مراد ارسالها ",255,0,0)
					end
				else
					outputChatBox("#لايمكنك ارسال المال لنفسك",255,0,0)
				end
			else
				RefreshLists()
				outputChatBox("# لم يتم عتور علي لاعب",255,0,0)
			end
		end
	end
)

---server

addEvent("SendWeapon",true)
addEventHandler("SendWeapon",root,
	function (player,id,ammo)
		local id = tonumber(id)
		local ammo = tonumber(ammo)
		giveWeapon(player,id,ammo)
		takeWeapon(source,id,ammo)
		outputChatBox("##0069c7 لقد قمت بارسال دخيرة " .. getWeaponNameFromID(id) .. "#0069c7الي #ffff000" .. getPlayerName(player),source,255,0,0,true)
		outputChatBox("# " .. getPlayerName(source) .. " #0069c7Has Sent #ff0000" .. getWeaponNameFromID(id) .. " #0069c7To You With #ff0000" .. ammo .. " #0069c7Ammo",player,255,0,0,true)
	end
)

 

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...