Jump to content

استفسار


Recommended Posts

السلام عليكم

وش احلي طريقه اسوي بيها كنترول للمهمات

يعني مهمه تخلص تيجي المهمه الي بعدها وكذا

جربت اسويها ب الاكسبورت مدري ليش يكرر

المهم ايش احلي طريقه ؟

Link to comment

انا بقول انو تسوي دوال في كل مهمة وظيفتهم تشغيل المهمات بس لا تشغلهم 

وفي مهمة واحده منهم شغل الدالة الخاصة بها 

( export )  ولما تخلص المهمة اعمل اتصال 

 بمهمة من المهمات على دالات التشغيل الخاصة بها 

وفي داخل الدوال تسوي تايمر لوقت المهمة والخ ... ^_^ وش رايك 

 

Edited by Debo15
Link to comment

من رأي يسوي مود متحكم للمهمات

MissionManager

انا مسويه - نظام جداول تحط المهمات بالترتيب الي تباه بالجدول و و روح للمهمات و سوي بها وظيفه اسمها

startMission

بعدين بقا لما يجي المود يفتح ( المتحكم ) يسوي اتصال بالمهمه الأولي بالجدول

بعدين سوي لما المهمه تخلص يسوي اتصال بالمتحكم يخله يبداء المهمه الي بعدها - ذي افضل طريقه من الطرق الي جربتها

مثال بسيط : 

--#Ex
local currentMission = 1
local MyMissions = {
	--#Mission name, resource name
	[1] = {"CVR", "CVRMission"},
	[2] = {"TEST", "TESTMission"}
}

addEventHandler("onResourceStart", resourceRoot,
	function()
		local res = getResourceFromName(MyMissions[currentMission][2])
		if res and getResourceState(res) == "running" then
			exports[MyMissions[currentMission][2]]:startMission()
		else
			nextMission()
		end
	end
)

function nextMission()
	currentMission = currentMission + 1
	if currentMission > #MyMissions then
		currentMission = 1
	end
	local res = getResourceFromName(MyMissions[currentMission][2])
	if res and getResourceState(res) == "running" then
		exports[MyMissions[currentMission][2]]:startMission()
	else
		nextMission()
	end
end				

 

Edited by #َxLysandeR
Link to comment
42 minutes ago, #َxLysandeR said:

من رأي يسوي مود متحكم للمهمات

MissionManager

انا مسويه - نظام جداول تحط المهمات بالترتيب الي تباه بالجدول و و روح للمهمات و سوي بها وظيفه اسمها

startMission

بعدين بقا لما يجي المود يفتح ( المتحكم ) يسوي اتصال بالمهمه الأولي بالجدول

بعدين سوي لما المهمه تخلص يسوي اتصال بالمتحكم يخله يبداء المهمه الي بعدها - ذي افضل طريقه من الطرق الي جربتها

مثال بسيط : 


--#Ex
local currentMission = 1
local MyMissions = {
	--#Mission name, resource name
	[1] = {"CVR", "CVRMission"},
	[2] = {"TEST", "TESTMission"}
}

addEventHandler("onResourceStart", resourceRoot,
	function()
		local res = getResourceFromName(MyMissions[currentMission][2])
		if res and getResourceState(res) == "running" then
			exports[MyMissions[currentMission][2]]:startMission()
		else
			nextMission()
		end
	end
)

function nextMission()
	currentMission = currentMission + 1
	if currentMission > #MyMissions then
		currentMission = 1
	end
	local res = getResourceFromName(MyMissions[currentMission][2])
	if res and getResourceState(res) == "running" then
		exports[MyMissions[currentMission][2]]:startMission()
	else
		nextMission()
	end
end				

 

طريقتك حلوة بجربها

Edited by MA[S]RIY
Link to comment
1 hour ago, #َxLysandeR said:

من رأي يسوي مود متحكم للمهمات

MissionManager

انا مسويه - نظام جداول تحط المهمات بالترتيب الي تباه بالجدول و و روح للمهمات و سوي بها وظيفه اسمها

startMission

بعدين بقا لما يجي المود يفتح ( المتحكم ) يسوي اتصال بالمهمه الأولي بالجدول

بعدين سوي لما المهمه تخلص يسوي اتصال بالمتحكم يخله يبداء المهمه الي بعدها - ذي افضل طريقه من الطرق الي جربتها

مثال بسيط : 


--#Ex
local currentMission = 1
local MyMissions = {
	--#Mission name, resource name
	[1] = {"CVR", "CVRMission"},
	[2] = {"TEST", "TESTMission"}
}

addEventHandler("onResourceStart", resourceRoot,
	function()
		local res = getResourceFromName(MyMissions[currentMission][2])
		if res and getResourceState(res) == "running" then
			exports[MyMissions[currentMission][2]]:startMission()
		else
			nextMission()
		end
	end
)

function nextMission()
	currentMission = currentMission + 1
	if currentMission > #MyMissions then
		currentMission = 1
	end
	local res = getResourceFromName(MyMissions[currentMission][2])
	if res and getResourceState(res) == "running" then
		exports[MyMissions[currentMission][2]]:startMission()
	else
		nextMission()
	end
end				

 

الحين انا شغلت المود شغل اول مهمه تمام وبعدان اول مهمه خلصت اشتغلت اول مهمه ثاني وثاني مهمه مع بض ؟

Edited by MA[S]RIY
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...