Sign in to follow this  
Mr.Mostafa

مشكلة في 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
)

 

Share this post


Link to post
12 minutes ago, Mr.Mostafa said:

uVehicle

uVehicle = معرفه ؟

Share this post


Link to post
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
)

جربب

Share this post


Link to post
    --- # 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
)

 

Share this post


Link to post
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
)

 

ما اشتغل

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

Share this post


Link to post
Just now, Mr.Mostafa said:

ما اشتغل

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

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

Share this post


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

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

يب اكيد

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

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

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

Share this post


Link to post
    --- # 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
)

 

Share this post


Link to post
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
)

 

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

Share this post


Link to post
1 minute ago, Mr.Mostafa said:

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

الدي بق؟

Share this post


Link to post
3 minutes ago, *RayaN-Alharbi. said:

الدي بق؟

ما يطلع شي

Share this post


Link to post
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
)

 

Share this post


Link to post
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
)

 

ما اشتغل

Share this post


Link to post
1 minute ago, Mr.Mostafa said:

ما اشتغل

تراه شغال معي

انت مسوي شي غلط

Share this post


Link to post
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
)

 

Share this post


Link to post
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
)

 

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

Share this post


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

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

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

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

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

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.