Jump to content

مشكلة في math.random


Recommended Posts

Posted

سلام عليكم

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

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

--- # 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
)

 

330xum0.jpg

p_862d3zvf1.png

* تم آلآفتتآح مرة اخري , حياكم الله *

ip : * mtasa://145.239.212.62:22003 *

330xum0.jpg

Posted
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
)

جربب

Posted
    --- # 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
)

 

سقطت تفاحة واحدة ففهم الأنسان معنى الجاذبية

سقطت الملايين من الجثث ولم يفهم الأنسان معنى الأنسانية

===========

One apple fell and people understood Gravity

Millions of bodies fell and people did not understand the meaning of humanity

Spoiler

SOCIAL MEDIA / التواصل الإجتماعي

~[ p_8157bqso1.png SnapChat : xry-n .  ]~

~[ p_815kbq0c2.png 0506748951 . ]~

 

Posted
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
)

 

ما اشتغل

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

330xum0.jpg

p_862d3zvf1.png

* تم آلآفتتآح مرة اخري , حياكم الله *

ip : * mtasa://145.239.212.62:22003 *

330xum0.jpg

Posted
Just now, Mr.Mostafa said:

ما اشتغل

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

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

سقطت تفاحة واحدة ففهم الأنسان معنى الجاذبية

سقطت الملايين من الجثث ولم يفهم الأنسان معنى الأنسانية

===========

One apple fell and people understood Gravity

Millions of bodies fell and people did not understand the meaning of humanity

Spoiler

SOCIAL MEDIA / التواصل الإجتماعي

~[ p_8157bqso1.png SnapChat : xry-n .  ]~

~[ p_815kbq0c2.png 0506748951 . ]~

 

Posted
1 minute ago, *RayaN-Alharbi. said:

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

يب اكيد

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

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

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

330xum0.jpg

p_862d3zvf1.png

* تم آلآفتتآح مرة اخري , حياكم الله *

ip : * mtasa://145.239.212.62:22003 *

330xum0.jpg

Posted
    --- # 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
)

 

سقطت تفاحة واحدة ففهم الأنسان معنى الجاذبية

سقطت الملايين من الجثث ولم يفهم الأنسان معنى الأنسانية

===========

One apple fell and people understood Gravity

Millions of bodies fell and people did not understand the meaning of humanity

Spoiler

SOCIAL MEDIA / التواصل الإجتماعي

~[ p_8157bqso1.png SnapChat : xry-n .  ]~

~[ p_815kbq0c2.png 0506748951 . ]~

 

Posted
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
)

 

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

330xum0.jpg

p_862d3zvf1.png

* تم آلآفتتآح مرة اخري , حياكم الله *

ip : * mtasa://145.239.212.62:22003 *

330xum0.jpg

Posted
1 minute ago, Mr.Mostafa said:

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

الدي بق؟

سقطت تفاحة واحدة ففهم الأنسان معنى الجاذبية

سقطت الملايين من الجثث ولم يفهم الأنسان معنى الأنسانية

===========

One apple fell and people understood Gravity

Millions of bodies fell and people did not understand the meaning of humanity

Spoiler

SOCIAL MEDIA / التواصل الإجتماعي

~[ p_8157bqso1.png SnapChat : xry-n .  ]~

~[ p_815kbq0c2.png 0506748951 . ]~

 

Posted
3 minutes ago, *RayaN-Alharbi. said:

الدي بق؟

ما يطلع شي

330xum0.jpg

p_862d3zvf1.png

* تم آلآفتتآح مرة اخري , حياكم الله *

ip : * mtasa://145.239.212.62:22003 *

330xum0.jpg

Posted
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
)

 

Posted
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
)

 

ما اشتغل

330xum0.jpg

p_862d3zvf1.png

* تم آلآفتتآح مرة اخري , حياكم الله *

ip : * mtasa://145.239.212.62:22003 *

330xum0.jpg

Posted
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
)

 

Chillin' with some demons, satans and vamps

Posted
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
)

 

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

330xum0.jpg

p_862d3zvf1.png

* تم آلآفتتآح مرة اخري , حياكم الله *

ip : * mtasa://145.239.212.62:22003 *

330xum0.jpg

Posted
1 hour ago, Mr.Mostafa said:

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

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

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

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

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