Jump to content

حل مشكله


MA[S]RIY

Recommended Posts

السلام عليكم

addCommandHandler("test",
function ( source )
local _Data = getElementData( source, "Warning" )
if _Data then
if _Data == 3 then
outputChatBox( _Data, source, 255, 0, 0, true )
setElementData( source, "Warning", 0 )
else
setElementData( source, "Warning", _Data + 1 )
outputChatBox( _Data + 1, source, 255, 0, 0, true )
end
else
setElementData( source, "Warning", 1 )
outputChatBox( "1", source, 255, 0, 0, true )
end
end
)

ابي اعرف وين المشكله الي بالكود

م في اي اخطاء تطلع بالدي بق

 

الكود عبار عن لما تكتب باف 8 امر

يطلع لك رقم 1

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

ولما يكتبها ثالث مره يطلع له بالشات 3 ويصفر الداتا

وين الخطاء ؟

Link to comment
addCommandHandler("test",
  function( source )
local data = getElementData(source, "Warning")
if ( data == 3 ) then
setElementData(source, "Warning", 0)
outputChatBox(data, source, 255, 0, 0, true )
elseif ( data == 0 ) then
setElementData(source,"Warning", data+1)
outputChatBox("1", source, 255, 0, 0, true )
elseif ( data == 1 ) then
setElementData(source,"Warning", data+1)
outputChatBox("2", source, 255, 0, 0, true )
end
end)

 

Edited by #Himoo
Link to comment
addCommandHandler( 'test',
function( Player )
	local Data = ( getElementData( Player, 'Warning' ) or 0 ) + 1
	if ( Data < 3 ) then 
		return outputChatBox( Data, Player, 0, 0, 0, true ), setElementData( Player, 'Warning', Data )
	else
		outputChatBox( 'Error', Player, 0, 0, 0, true )
	end
end )

* جوال *

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