Jump to content

مشكلة في math.random


Recommended Posts

سلام عليكم

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

وكدا ما ظبطت وش المشكلة ؟

--- # Client
addEventHandler("onClientGUIClick",root,
  function ()
    if source == GUIEditor.checkbox[1] then
if (guiCheckBoxGetSelected(GUIEditor.checkbox[1]) == true) then
UnlimtedColorsTimer = setTimer(function()
triggerServerEvent( 'vehColorRandom', localPlayer )
end, 200, 0)
else if (guiCheckBoxGetSelected(GUIEditor.checkbox[1]) == false) then
killTimer(UnlimtedColorsTimer)
end
end
end
end
)
--- # Server

addEvent( 'vehColorRandom', true )
addEventHandler( 'vehColorRandom', root,
function( uPlayer )
		if isPedInVehicle( uPlayer ) then
			local uVehicle = getPedOccupiedVehicle( uPlayer )
			if uVehicle then
setVehicleColor(uVehicle, math.random(0, 255), math.random(0, 255), math.random(0, 255))
end
end
end
)

 

Link to comment
4 minutes ago, Mr.Mostafa said:

..

addEventHandler("onClientGUIClick",root,
  function ()
    if source == GUIEditor.checkbox[1] then
if (guiCheckBoxGetSelected(GUIEditor.checkbox[1]) == true) then
UnlimtedColorsTimer = setTimer(function()
triggerServerEvent( 'vehColorRandom', localPlayer )
end, 200, 0)
elseif (guiCheckBoxGetSelected(GUIEditor.checkbox[1]) == false) then
killTimer(UnlimtedColorsTimer)
end
end
end
)



addEvent( 'vehColorRandom', true )
addEventHandler( 'vehColorRandom', root,
function( uPlayer )
		if isPedInVehicle( uPlayer ) then
			local uVehicle = getPedOccupiedVehicle( uPlayer )
			if uVehicle then
setVehicleColor(uVehicle, math.random(0, 255), math.random(0, 255), math.random(0, 255))
end
end
end
)

جربب

Link to comment
    --- # Client
    addEventHandler("onClientGUIClick",root,
      function ()
        if source == GUIEditor.checkbox[1] then
			if (guiCheckBoxGetSelected(GUIEditor.checkbox[1]) == true) then
				UnlimtedColorsTimer = setTimer(function()
				triggerServerEvent( 'vehColorRandom', localPlayer )
			end, 200, 0)
			else
				killTimer(UnlimtedColorsTimer)
			end
		end
    end
)

    --- # Server

    addEvent( 'vehColorRandom', true )
    addEventHandler( 'vehColorRandom', root,
    function( uPlayer )
			if isPedInVehicle( uPlayer ) then
				local uVehicle = getPedOccupiedVehicle( uPlayer )
			if uVehicle then
				local r, g, b = math.random( 255 ), math.random( 255 ), math.random( 255 )
				setVehicleColor( uVehicle, r, g, b )
			end
		end
    end
)

 

Link to comment
6 minutes ago, *RayaN-Alharbi. said:

    --- # Client
    addEventHandler("onClientGUIClick",root,
      function ()
        if source == GUIEditor.checkbox[1] then
			if (guiCheckBoxGetSelected(GUIEditor.checkbox[1]) == true) then
				UnlimtedColorsTimer = setTimer(function()
				triggerServerEvent( 'vehColorRandom', localPlayer )
			end, 200, 0)
			else
				killTimer(UnlimtedColorsTimer)
			end
		end
    end
)

    --- # Server

    addEvent( 'vehColorRandom', true )
    addEventHandler( 'vehColorRandom', root,
    function( uPlayer )
			if isPedInVehicle( uPlayer ) then
				local uVehicle = getPedOccupiedVehicle( uPlayer )
			if uVehicle then
				local r, g, b = math.random( 255 ), math.random( 255 ), math.random( 255 )
				setVehicleColor( uVehicle, r, g, b )
			end
		end
    end
)

 

ما اشتغل

+ ملحوظة كود السيرفر والكلنت دول هما بس الي بالمود هل في اكواد تانية اضيفها عشان يلون ولا وش

Link to comment
Just now, Mr.Mostafa said:

ما اشتغل

+ ملحوظة كود السيرفر والكلنت دول هما بس الي بالمود هل في اكواد تانية اضيفها عشان يلون ولا وش

موجودة اكواد الوحة؟؟

Link to comment
1 minute ago, *RayaN-Alharbi. said:

موجودة اكواد الوحة؟؟

يب اكيد

بس الي اقصده ان الاكواد المتعلقة بالتلوين الكود حق الكلنت والسيرفر الي فوق دول بس 

يعني مافي اي اكواد تانية

عشان لو يمكن اضيف اكواد تانية او شي + ما اشتغل كودك 

Link to comment
    --- # Client
    addEventHandler("onClientGUIClick",root,
      function ()
        if source == GUIEditor.checkbox[1] then
			if (guiCheckBoxGetSelected(GUIEditor.checkbox[1]) == true) then
				ST = "Start"
				triggerServerEvent( 'vehColorRandom', localPlayer,ST )
			else
				ST = "Stop"
				triggerServerEvent( 'vehColorRandom', localPlayer,ST )
			end
		end
    end
)

    --- # Server

    addEvent( 'vehColorRandom', true )
    addEventHandler( 'vehColorRandom', root,
    function( uPlayer,ST )
			if ( ST == "Start" ) then
			if isPedInVehicle( uPlayer ) then
				local uVehicle = getPedOccupiedVehicle( uPlayer )
			if uVehicle then
			mathColor = setTimer(function( )
				local r, g, b = math.random( 255 ), math.random( 255 ), math.random( 255 )
				setVehicleColor( uVehicle, r, g, b )
			end,200,0 )
				end
			end
			else
			if mathColor then
			killTimer(mathColor)
			end
		end
    end
)

 

Link to comment
5 minutes ago, *RayaN-Alharbi. said:

    --- # Client
    addEventHandler("onClientGUIClick",root,
      function ()
        if source == GUIEditor.checkbox[1] then
			if (guiCheckBoxGetSelected(GUIEditor.checkbox[1]) == true) then
				ST = "Start"
				triggerServerEvent( 'vehColorRandom', localPlayer,ST )
			else
				ST = "Stop"
				triggerServerEvent( 'vehColorRandom', localPlayer,ST )
			end
		end
    end
)

    --- # Server

    addEvent( 'vehColorRandom', true )
    addEventHandler( 'vehColorRandom', root,
    function( uPlayer,ST )
			if ( ST == "Start" ) then
			if isPedInVehicle( uPlayer ) then
				local uVehicle = getPedOccupiedVehicle( uPlayer )
			if uVehicle then
			mathColor = setTimer(function( )
				local r, g, b = math.random( 255 ), math.random( 255 ), math.random( 255 )
				setVehicleColor( uVehicle, r, g, b )
			end,200,0 )
				end
			end
			else
			if mathColor then
			killTimer(mathColor)
			end
		end
    end
)

 

نفس المشكلة اللون ما يحصل له اي شي

Link to comment
14 minutes ago, Mr.Mostafa said:

ما يطلع شي

جرب ذولا

 




addEventHandler("onClientGUIClick",root,
  function ()
    if source == GUIEditor.checkbox[1] then
if (guiCheckBoxGetSelected(GUIEditor.checkbox[1]) == true) then
UnlimtedColorsTimer = setTimer(function()
triggerServerEvent( 'vehColorRandom', localPlayer )
end, 200, 0)
else if (guiCheckBoxGetSelected(GUIEditor.checkbox[1]) == false) then
killTimer(UnlimtedColorsTimer)
end
end
end
end
)











addEvent( 'vehColorRandom', true )
addEventHandler( 'vehColorRandom', root,
function(  )
		if isPedInVehicle( source ) then
			local uVehicle = getPedOccupiedVehicle( source )
			if uVehicle then
setVehicleColor(uVehicle, math.random(0, 255), math.random(0, 255), math.random(0, 255))
end
end
end
)

 

Link to comment
11 minutes ago, +Source|> said:

جرب ذولا

 




addEventHandler("onClientGUIClick",root,
  function ()
    if source == GUIEditor.checkbox[1] then
if (guiCheckBoxGetSelected(GUIEditor.checkbox[1]) == true) then
UnlimtedColorsTimer = setTimer(function()
triggerServerEvent( 'vehColorRandom', localPlayer )
end, 200, 0)
else if (guiCheckBoxGetSelected(GUIEditor.checkbox[1]) == false) then
killTimer(UnlimtedColorsTimer)
end
end
end
end
)











addEvent( 'vehColorRandom', true )
addEventHandler( 'vehColorRandom', root,
function(  )
		if isPedInVehicle( source ) then
			local uVehicle = getPedOccupiedVehicle( source )
			if uVehicle then
setVehicleColor(uVehicle, math.random(0, 255), math.random(0, 255), math.random(0, 255))
end
end
end
)

 

ما اشتغل

Link to comment
addEventHandler("onClientGUIClick", guiRoot,
	function ()
		if source == GUIEditor.checkbox[1] then
			if guiCheckBoxGetSelected(GUIEditor.checkbox[1]) then
				triggerServerEvent("vehColorRandom", localPlayer, true)
			else
				triggerServerEvent("vehColorRandom", localPlayer, false)
			end
		end
	end
)
---#Server
local timers = {}
addEvent("vehColorRandom", true )
addEventHandler("vehColorRandom", root,
	function(bool)
		if isPedInVehicle(source) then
			local vehicle = getPedOccupiedVehicle(source)
			if vehicle then
				if bool then
					if timers[source] then
						return
					end
					timers[source] = setTimer(setVehicleColor, 200, 0, vehicle, math.random(0, 255), math.random(0, 255),  math.random(0, 255))
				else
					if timers[source] then
						killTimer(timers[source])
						timers[source] = nil 
					end
				end
			end
		end
	end
)

 

Link to comment
7 minutes ago, #x1AhMeD,-09 said:

addEventHandler("onClientGUIClick", guiRoot,
	function ()
		if source == GUIEditor.checkbox[1] then
			if guiCheckBoxGetSelected(GUIEditor.checkbox[1]) then
				triggerServerEvent("vehColorRandom", localPlayer, true)
			else
				triggerServerEvent("vehColorRandom", localPlayer, false)
			end
		end
	end
)
---#Server
local timers = {}
addEvent("vehColorRandom", true )
addEventHandler("vehColorRandom", root,
	function(bool)
		if isPedInVehicle(source) then
			local vehicle = getPedOccupiedVehicle(source)
			if vehicle then
				if bool then
					if timers[source] then
						return
					end
					timers[source] = setTimer(setVehicleColor, 200, 0, vehicle, math.random(0, 255), math.random(0, 255),  math.random(0, 255))
				else
					if timers[source] then
						killTimer(timers[source])
						timers[source] = nil 
					end
				end
			end
		end
	end
)

 

ما اشتغل + اعتقد المشكلة من عندي يمكن من الموتر مدري بس خلاص مب مهم -

Link to comment
1 hour ago, Mr.Mostafa said:

ما اشتغل + اعتقد المشكلة من عندي يمكن من الموتر مدري بس خلاص مب مهم -

ممكن لأنك .. ماتغير التحديد الخاص بـ checkbox

يعني تشغل المود وتتركه زي ماهو.. جرب شيل التحديد وارجع حطه

لو مانفع من الموتر اللي تستعمله ممكن

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