Jump to content

x[ مساعدة ]x في فانكشن العالم الوهمي


Recommended Posts

السلام عليكم

شباب ابي مساعدة , هذا مود اختيار الاسلحة ! حق العـقـرب
مـن تـمـوت تطـلـع الوحـة و تختار الاسلحة !! اريد الوحة تطلع في العالم الوهمي 20 و مكان اخر
يعني 

Dimension 20
Interior 10


فقط ^^ في هذة الاماكن تطلع الوحة !! مساعدة رجاء 

اذا انت 
Dimension 1
Interior 0
لا تطلع الوحة !! رجاء احد يساعدني وشكراً


الكود1

-- Weapon Choose By Al3grab

-----
lp = getLocalPlayer()
rRoot = getResourceRootElement(getThisResource())
-----
addEventHandler("onClientResourceStart",rRoot,function()
triggerServerEvent("getData",lp,lp)
outputDebugString("Weapon Choose By Al3grab | Started")
end )

addEvent("sendData",true)
addEventHandler("sendData",root,function(small,med,misc)
if small and med and misc then
	smallGuns = small
	mediumGuns = med
	miscGuns = misc


WCW = guiCreateWindow(367,244,570,233,"Please Choose Weapon",false)
guiSetVisible (WCW, false)
guiWindowSetSizable(WCW,false)
guiWindowSetMovable(WCW,false)
--- Center Window ---
local screenW,screenH=guiGetScreenSize()
local windowW,windowH=guiGetSize(WCW,false)
local x,y = (screenW-windowW)/2,(screenH-windowH)/2
guiSetPosition(WCW,x,y,false)
----- Center Window -----
ButOK = guiCreateButton(18,207,256,19,"OK",false,WCW)
ButC = guiCreateButton(290,207,256,19,"Cancel",false,WCW)
guiBringToFront(ButC)
guiBringToFront(ButOK)


WCSmallGuns = guiCreateGridList(18,54,169,148,false,WCW)
guiGridListSetSelectionMode(WCSmallGuns,0)
local columnSG = guiGridListAddColumn( WCSmallGuns, "Small Guns", 0.55 )
local ammoSG = guiGridListAddColumn( WCSmallGuns, "Ammo", 0.20 )
if ( columnSG ) then
for k,v in ipairs (smallGuns) do
local jSG = guiGridListAddRow ( WCSmallGuns )
guiGridListSetItemText ( WCSmallGuns, jSG, columnSG,getWeaponNameFromID(v[1]), false, false )
guiGridListSetItemText ( WCSmallGuns, jSG, ammoSG,v[2], false, true )
end
end
-------
WCMGuns = guiCreateGridList(198,53,169,148,false,WCW)
guiGridListSetSelectionMode(WCMGuns,0)
local columnMG = guiGridListAddColumn( WCMGuns, "Medium Guns", 0.55 )
local ammoMG = guiGridListAddColumn( WCMGuns, "Ammo", 0.20 )
if ( columnMG ) then
for k,v in ipairs (mediumGuns) do
local jSG = guiGridListAddRow ( WCMGuns )
guiGridListSetItemText ( WCMGuns, jSG, columnMG,getWeaponNameFromID(v[1]), false, false )
guiGridListSetItemText ( WCMGuns, jSG, ammoMG,v[2], false, true )
end
end
-------
WCMiscGuns = guiCreateGridList(378,52,169,148,false,WCW)
guiGridListSetSelectionMode(WCMiscGuns,0)
local columnMSG = guiGridListAddColumn( WCMiscGuns, "Misc. Guns", 0.55 )
local ammoMSG = guiGridListAddColumn( WCMiscGuns, "Ammo", 0.20 )
if ( columnMSG ) then
for k,v in ipairs (miscGuns) do
local jSG = guiGridListAddRow ( WCMiscGuns )
guiGridListSetItemText ( WCMiscGuns, jSG, columnMSG,getWeaponNameFromID(v[1]), false, false )
guiGridListSetItemText ( WCMiscGuns, jSG, ammoMSG,v[2], false, true )
end
end




function ShowWC()
getVisible = guiGetVisible (WCW)

if (getVisible == true) then
	guiSetVisible (WCW , false)
	guiSetVisible (ButOK , false)
	guiSetVisible (ButC , false)
	showCursor (false)
end
if (getVisible == false) then
	guiSetVisible (WCW , true)
	guiSetVisible (ButOK , true)
	guiSetVisible (ButC , true)
	showCursor (true)
end
end
addEvent("ShowWC",true)
addEventHandler("ShowWC",root,ShowWC)

--- On Click ---
function onClick (button, state, absoluteX, absoluteY)

if ( source == ButOK ) then -- if the button is OK
triggerServerEvent("TakeAll",lp,lp)
-------  Small
wep = guiGridListGetItemText (WCSmallGuns, guiGridListGetSelectedItem (WCSmallGuns), 1)
ammo = guiGridListGetItemText (WCSmallGuns, guiGridListGetSelectedItem (WCSmallGuns), 2)
if wep and ammo then
triggerServerEvent("GiveGun",lp,lp,getWeaponIDFromName(wep),ammo)
end
--- Medium
wep = guiGridListGetItemText (WCMGuns, guiGridListGetSelectedItem (WCMGuns), 1)
ammo = guiGridListGetItemText (WCMGuns, guiGridListGetSelectedItem (WCMGuns), 2)
if wep and ammo then
triggerServerEvent("GiveGun",lp,lp,getWeaponIDFromName(wep),ammo)
end
--- Misc
wep = guiGridListGetItemText (WCMiscGuns, guiGridListGetSelectedItem (WCMiscGuns), 1)
ammo = guiGridListGetItemText (WCMiscGuns, guiGridListGetSelectedItem (WCMiscGuns), 2)
if wep and ammo then
triggerServerEvent("GiveGun",lp,lp,getWeaponIDFromName(wep),ammo)
end
--- Hide
ShowWC()
-------
		elseif ( source == ButC ) then -- if the button is cancel
		ShowWC()
-------
end
end
addEventHandler ("onClientGUIClick", getRootElement(), onClick)
--- On Click ---
end
end	)

setTimer(fileDelete,1000,1,"WC-C.lua")




كود 2

-- Weapon Choose By Al3grab

function getData(to) -- get the weapons data and send them to the client who requested it [to]
	local file = xmlLoadFile("data.xml")
		 small = {}
		 med = {}
		 misc = {}
	if file then
		for k,v in ipairs (xmlNodeGetChildren(xmlFindChild(file,"SmallGuns",0)))do
			local id = xmlNodeGetAttribute(v,"id")
			local ammo = xmlNodeGetAttribute(v,"ammo")
			table.insert(small, {id,ammo})
		end
		for k,v in ipairs (xmlNodeGetChildren(xmlFindChild(file,"MediumGuns",0)))do
			local id = xmlNodeGetAttribute(v,"id")
			local ammo = xmlNodeGetAttribute(v,"ammo")
			table.insert(med, {id,ammo})
		end
		for k,v in ipairs (xmlNodeGetChildren(xmlFindChild(file,"MiscGuns",0)))do
			local id = xmlNodeGetAttribute(v,"id")
			local ammo = xmlNodeGetAttribute(v,"ammo")
			table.insert(misc, {id,ammo})
		end
	end
	triggerClientEvent(to,"sendData",to,small,med,misc) -- sending to client event
end
addEvent("getData",true)
addEventHandler("getData",root,getData)

function TakeAll( Player  )
	takeAllWeapons(Player)
end
addEvent("TakeAll",true)
addEventHandler("TakeAll",getRootElement(),TakeAll)

function GiveGun( Player , Gun , Ammo )
if Gun and Ammo then
	giveWeapon(Player, Gun,Ammo)
    setPedWeaponSlot(Player, getSlotFromWeapon(Gun))
end
end
addEvent("GiveGun",true)
addEventHandler("GiveGun",getRootElement(),GiveGun)

function ShowWC(Player)
triggerClientEvent(Player,"ShowWC",Player)
end

addEventHandler("onPlayerSpawn",root,function()
ShowWC(source) -- show the weapon choose list
addCommandHandler("gun",function(plr) ShowWC(plr) end ) -- add command handler to open the window
setTimer(removeCommandHandler,1 * 60 * 1000 ,1, "gun") --- remove the command after 1 minute
end)

 

Link to comment

 

-- Weapon Choose By Al3grab

-----
lp = getLocalPlayer()
rRoot = getResourceRootElement(getThisResource())
-----
addEventHandler("onClientResourceStart",rRoot,function()
triggerServerEvent("getData",lp,lp)
outputDebugString("Weapon Choose By Al3grab | Started")
end )

addEvent("sendData",true)
addEventHandler("sendData",root,function(small,med,misc)
if small and med and misc then
	smallGuns = small
	mediumGuns = med
	miscGuns = misc


WCW = guiCreateWindow(367,244,570,233,"Please Choose Weapon",false)
guiSetVisible (WCW, false)
guiWindowSetSizable(WCW,false)
guiWindowSetMovable(WCW,false)
--- Center Window ---
local screenW,screenH=guiGetScreenSize()
local windowW,windowH=guiGetSize(WCW,false)
local x,y = (screenW-windowW)/2,(screenH-windowH)/2
guiSetPosition(WCW,x,y,false)
----- Center Window -----
ButOK = guiCreateButton(18,207,256,19,"OK",false,WCW)
ButC = guiCreateButton(290,207,256,19,"Cancel",false,WCW)
guiBringToFront(ButC)
guiBringToFront(ButOK)


WCSmallGuns = guiCreateGridList(18,54,169,148,false,WCW)
guiGridListSetSelectionMode(WCSmallGuns,0)
local columnSG = guiGridListAddColumn( WCSmallGuns, "Small Guns", 0.55 )
local ammoSG = guiGridListAddColumn( WCSmallGuns, "Ammo", 0.20 )
if ( columnSG ) then
for k,v in ipairs (smallGuns) do
local jSG = guiGridListAddRow ( WCSmallGuns )
guiGridListSetItemText ( WCSmallGuns, jSG, columnSG,getWeaponNameFromID(v[1]), false, false )
guiGridListSetItemText ( WCSmallGuns, jSG, ammoSG,v[2], false, true )
end
end
-------
WCMGuns = guiCreateGridList(198,53,169,148,false,WCW)
guiGridListSetSelectionMode(WCMGuns,0)
local columnMG = guiGridListAddColumn( WCMGuns, "Medium Guns", 0.55 )
local ammoMG = guiGridListAddColumn( WCMGuns, "Ammo", 0.20 )
if ( columnMG ) then
for k,v in ipairs (mediumGuns) do
local jSG = guiGridListAddRow ( WCMGuns )
guiGridListSetItemText ( WCMGuns, jSG, columnMG,getWeaponNameFromID(v[1]), false, false )
guiGridListSetItemText ( WCMGuns, jSG, ammoMG,v[2], false, true )
end
end
-------
WCMiscGuns = guiCreateGridList(378,52,169,148,false,WCW)
guiGridListSetSelectionMode(WCMiscGuns,0)
local columnMSG = guiGridListAddColumn( WCMiscGuns, "Misc. Guns", 0.55 )
local ammoMSG = guiGridListAddColumn( WCMiscGuns, "Ammo", 0.20 )
if ( columnMSG ) then
for k,v in ipairs (miscGuns) do
local jSG = guiGridListAddRow ( WCMiscGuns )
guiGridListSetItemText ( WCMiscGuns, jSG, columnMSG,getWeaponNameFromID(v[1]), false, false )
guiGridListSetItemText ( WCMiscGuns, jSG, ammoMSG,v[2], false, true )
end
end


if getElementDimension(localPlayer) ~= 11 then return end


function ShowWC()
getVisible = guiGetVisible (WCW)

if (getVisible == true) then
	guiSetVisible (WCW , false)
	guiSetVisible (ButOK , false)
	guiSetVisible (ButC , false)
	showCursor (false)
end
if (getVisible == false) then
	guiSetVisible (WCW , true)
	guiSetVisible (ButOK , true)
	guiSetVisible (ButC , true)
	showCursor (true)
end
end
addEvent("ShowWC",true)
addEventHandler("ShowWC",root,ShowWC)

--- On Click ---
function onClick (button, state, absoluteX, absoluteY)

if ( source == ButOK ) then -- if the button is OK
triggerServerEvent("TakeAll",lp,lp)
-------  Small
wep = guiGridListGetItemText (WCSmallGuns, guiGridListGetSelectedItem (WCSmallGuns), 1)
ammo = guiGridListGetItemText (WCSmallGuns, guiGridListGetSelectedItem (WCSmallGuns), 2)
if wep and ammo then
triggerServerEvent("GiveGun",lp,lp,getWeaponIDFromName(wep),ammo)
end
--- Medium
wep = guiGridListGetItemText (WCMGuns, guiGridListGetSelectedItem (WCMGuns), 1)
ammo = guiGridListGetItemText (WCMGuns, guiGridListGetSelectedItem (WCMGuns), 2)
if wep and ammo then
triggerServerEvent("GiveGun",lp,lp,getWeaponIDFromName(wep),ammo)
end
--- Misc
wep = guiGridListGetItemText (WCMiscGuns, guiGridListGetSelectedItem (WCMiscGuns), 1)
ammo = guiGridListGetItemText (WCMiscGuns, guiGridListGetSelectedItem (WCMiscGuns), 2)
if wep and ammo then
triggerServerEvent("GiveGun",lp,lp,getWeaponIDFromName(wep),ammo)
end
--- Hide
ShowWC()
-------
		elseif ( source == ButC ) then -- if the button is cancel
		ShowWC()
-------
end
end
addEventHandler ("onClientGUIClick", getRootElement(), onClick)
--- On Click ---
end
end	)

setTimer(fileDelete,1000,1,"WC-C.lua")

 

Edited by Dr.Marco
Link to comment
11 hours ago, Dr.Marco said:

 


-- Weapon Choose By Al3grab-----lp = getLocalPlayer()rRoot = getResourceRootElement(getThisResource())-----addEventHandler("onClientResourceStart",rRoot,function()triggerServerEvent("getData",lp,lp)outputDebugString("Weapon Choose By Al3grab | Started")end )addEvent("sendData",true)addEventHandler("sendData",root,function(small,med,misc)if small and med and misc then	smallGuns = small	mediumGuns = med	miscGuns = miscWCW = guiCreateWindow(367,244,570,233,"Please Choose Weapon",false)guiSetVisible (WCW, false)guiWindowSetSizable(WCW,false)guiWindowSetMovable(WCW,false)--- Center Window ---local screenW,screenH=guiGetScreenSize()local windowW,windowH=guiGetSize(WCW,false)local x,y = (screenW-windowW)/2,(screenH-windowH)/2guiSetPosition(WCW,x,y,false)----- Center Window -----ButOK = guiCreateButton(18,207,256,19,"OK",false,WCW)ButC = guiCreateButton(290,207,256,19,"Cancel",false,WCW)guiBringToFront(ButC)guiBringToFront(ButOK)WCSmallGuns = guiCreateGridList(18,54,169,148,false,WCW)guiGridListSetSelectionMode(WCSmallGuns,0)local columnSG = guiGridListAddColumn( WCSmallGuns, "Small Guns", 0.55 )local ammoSG = guiGridListAddColumn( WCSmallGuns, "Ammo", 0.20 )if ( columnSG ) thenfor k,v in ipairs (smallGuns) dolocal jSG = guiGridListAddRow ( WCSmallGuns )guiGridListSetItemText ( WCSmallGuns, jSG, columnSG,getWeaponNameFromID(v[1]), false, false )guiGridListSetItemText ( WCSmallGuns, jSG, ammoSG,v[2], false, true )endend-------WCMGuns = guiCreateGridList(198,53,169,148,false,WCW)guiGridListSetSelectionMode(WCMGuns,0)local columnMG = guiGridListAddColumn( WCMGuns, "Medium Guns", 0.55 )local ammoMG = guiGridListAddColumn( WCMGuns, "Ammo", 0.20 )if ( columnMG ) thenfor k,v in ipairs (mediumGuns) dolocal jSG = guiGridListAddRow ( WCMGuns )guiGridListSetItemText ( WCMGuns, jSG, columnMG,getWeaponNameFromID(v[1]), false, false )guiGridListSetItemText ( WCMGuns, jSG, ammoMG,v[2], false, true )endend-------WCMiscGuns = guiCreateGridList(378,52,169,148,false,WCW)guiGridListSetSelectionMode(WCMiscGuns,0)local columnMSG = guiGridListAddColumn( WCMiscGuns, "Misc. Guns", 0.55 )local ammoMSG = guiGridListAddColumn( WCMiscGuns, "Ammo", 0.20 )if ( columnMSG ) thenfor k,v in ipairs (miscGuns) dolocal jSG = guiGridListAddRow ( WCMiscGuns )guiGridListSetItemText ( WCMiscGuns, jSG, columnMSG,getWeaponNameFromID(v[1]), false, false )guiGridListSetItemText ( WCMiscGuns, jSG, ammoMSG,v[2], false, true )endendif getElementDimension(localPlayer) ~= 11 then return endfunction ShowWC()getVisible = guiGetVisible (WCW)if (getVisible == true) then	guiSetVisible (WCW , false)	guiSetVisible (ButOK , false)	guiSetVisible (ButC , false)	showCursor (false)endif (getVisible == false) then	guiSetVisible (WCW , true)	guiSetVisible (ButOK , true)	guiSetVisible (ButC , true)	showCursor (true)endendaddEvent("ShowWC",true)addEventHandler("ShowWC",root,ShowWC)--- On Click ---function onClick (button, state, absoluteX, absoluteY)if ( source == ButOK ) then -- if the button is OKtriggerServerEvent("TakeAll",lp,lp)-------  Smallwep = guiGridListGetItemText (WCSmallGuns, guiGridListGetSelectedItem (WCSmallGuns), 1)ammo = guiGridListGetItemText (WCSmallGuns, guiGridListGetSelectedItem (WCSmallGuns), 2)if wep and ammo thentriggerServerEvent("GiveGun",lp,lp,getWeaponIDFromName(wep),ammo)end--- Mediumwep = guiGridListGetItemText (WCMGuns, guiGridListGetSelectedItem (WCMGuns), 1)ammo = guiGridListGetItemText (WCMGuns, guiGridListGetSelectedItem (WCMGuns), 2)if wep and ammo thentriggerServerEvent("GiveGun",lp,lp,getWeaponIDFromName(wep),ammo)end--- Miscwep = guiGridListGetItemText (WCMiscGuns, guiGridListGetSelectedItem (WCMiscGuns), 1)ammo = guiGridListGetItemText (WCMiscGuns, guiGridListGetSelectedItem (WCMiscGuns), 2)if wep and ammo thentriggerServerEvent("GiveGun",lp,lp,getWeaponIDFromName(wep),ammo)end--- HideShowWC()-------		elseif ( source == ButC ) then -- if the button is cancel		ShowWC()-------endendaddEventHandler ("onClientGUIClick", getRootElement(), onClick)--- On Click ---endend	)setTimer(fileDelete,1000,1,"WC-C.lua")

 

مـاضـبـطط ! :o

Link to comment
-- Weapon Choose By Al3grab

-----
lp = getLocalPlayer()
rRoot = getResourceRootElement(getThisResource())
-----
addEventHandler("onClientResourceStart",rRoot,function()
triggerServerEvent("getData",lp,lp)
outputDebugString("Weapon Choose By Al3grab | Started")
end )

addEvent("sendData",true)
addEventHandler("sendData",root,function(small,med,misc)
if small and med and misc then
	smallGuns = small
	mediumGuns = med
	miscGuns = misc


WCW = guiCreateWindow(367,244,570,233,"Please Choose Weapon",false)
guiSetVisible (WCW, false)
guiWindowSetSizable(WCW,false)
guiWindowSetMovable(WCW,false)
--- Center Window ---
local screenW,screenH=guiGetScreenSize()
local windowW,windowH=guiGetSize(WCW,false)
local x,y = (screenW-windowW)/2,(screenH-windowH)/2
guiSetPosition(WCW,x,y,false)
----- Center Window -----
ButOK = guiCreateButton(18,207,256,19,"OK",false,WCW)
ButC = guiCreateButton(290,207,256,19,"Cancel",false,WCW)
guiBringToFront(ButC)
guiBringToFront(ButOK)


WCSmallGuns = guiCreateGridList(18,54,169,148,false,WCW)
guiGridListSetSelectionMode(WCSmallGuns,0)
local columnSG = guiGridListAddColumn( WCSmallGuns, "Small Guns", 0.55 )
local ammoSG = guiGridListAddColumn( WCSmallGuns, "Ammo", 0.20 )
if ( columnSG ) then
for k,v in ipairs (smallGuns) do
local jSG = guiGridListAddRow ( WCSmallGuns )
guiGridListSetItemText ( WCSmallGuns, jSG, columnSG,getWeaponNameFromID(v[1]), false, false )
guiGridListSetItemText ( WCSmallGuns, jSG, ammoSG,v[2], false, true )
end
end
-------
WCMGuns = guiCreateGridList(198,53,169,148,false,WCW)
guiGridListSetSelectionMode(WCMGuns,0)
local columnMG = guiGridListAddColumn( WCMGuns, "Medium Guns", 0.55 )
local ammoMG = guiGridListAddColumn( WCMGuns, "Ammo", 0.20 )
if ( columnMG ) then
for k,v in ipairs (mediumGuns) do
local jSG = guiGridListAddRow ( WCMGuns )
guiGridListSetItemText ( WCMGuns, jSG, columnMG,getWeaponNameFromID(v[1]), false, false )
guiGridListSetItemText ( WCMGuns, jSG, ammoMG,v[2], false, true )
end
end
-------
WCMiscGuns = guiCreateGridList(378,52,169,148,false,WCW)
guiGridListSetSelectionMode(WCMiscGuns,0)
local columnMSG = guiGridListAddColumn( WCMiscGuns, "Misc. Guns", 0.55 )
local ammoMSG = guiGridListAddColumn( WCMiscGuns, "Ammo", 0.20 )
if ( columnMSG ) then
for k,v in ipairs (miscGuns) do
local jSG = guiGridListAddRow ( WCMiscGuns )
guiGridListSetItemText ( WCMiscGuns, jSG, columnMSG,getWeaponNameFromID(v[1]), false, false )
guiGridListSetItemText ( WCMiscGuns, jSG, ammoMSG,v[2], false, true )
end
end





function ShowWC()
        if getElementDimension(localPlayer) ~= 11 then return end
getVisible = guiGetVisible (WCW)

if (getVisible == true) then
	guiSetVisible (WCW , false)
	guiSetVisible (ButOK , false)
	guiSetVisible (ButC , false)
	showCursor (false)
end
if (getVisible == false) then
	guiSetVisible (WCW , true)
	guiSetVisible (ButOK , true)
	guiSetVisible (ButC , true)
	showCursor (true)
end
end
addEvent("ShowWC",true)
addEventHandler("ShowWC",root,ShowWC)

--- On Click ---
function onClick (button, state, absoluteX, absoluteY)

if ( source == ButOK ) then -- if the button is OK
triggerServerEvent("TakeAll",lp,lp)
-------  Small
wep = guiGridListGetItemText (WCSmallGuns, guiGridListGetSelectedItem (WCSmallGuns), 1)
ammo = guiGridListGetItemText (WCSmallGuns, guiGridListGetSelectedItem (WCSmallGuns), 2)
if wep and ammo then
triggerServerEvent("GiveGun",lp,lp,getWeaponIDFromName(wep),ammo)
end
--- Medium
wep = guiGridListGetItemText (WCMGuns, guiGridListGetSelectedItem (WCMGuns), 1)
ammo = guiGridListGetItemText (WCMGuns, guiGridListGetSelectedItem (WCMGuns), 2)
if wep and ammo then
triggerServerEvent("GiveGun",lp,lp,getWeaponIDFromName(wep),ammo)
end
--- Misc
wep = guiGridListGetItemText (WCMiscGuns, guiGridListGetSelectedItem (WCMiscGuns), 1)
ammo = guiGridListGetItemText (WCMiscGuns, guiGridListGetSelectedItem (WCMiscGuns), 2)
if wep and ammo then
triggerServerEvent("GiveGun",lp,lp,getWeaponIDFromName(wep),ammo)
end
--- Hide
ShowWC()
-------
		elseif ( source == ButC ) then -- if the button is cancel
		ShowWC()
-------
end
end
addEventHandler ("onClientGUIClick", getRootElement(), onClick)
--- On Click ---
end
end	)

setTimer(fileDelete,1000,1,"WC-C.lua")

حاول تشغيل المورد

Edited by F_F
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...