Jump to content

[ مشكلة ] attempt compare .......


#Al3aGraB<3

Recommended Posts

السلام عليكم ورحمة الله وبركاته

انا حاط كود انه لما يضغط على زر يسحب منه فلوس ويعطيه داتا بس لما اضغط الزر يقول لي بدي بق

ERROR: tent/Client.lua:51: attempt to compare number with boolean

addEventHandler("onClientGUIClick", root,
function ()
if source == b1 then
setElementData(localPlayer, "tent", 1)
if getElementData(localPlayer, "Money") >= 200000 then
setElementData(localPlayer, "Money", getElementData(localPlayer, "Money") - 200000)
else
outputChatBox("#FF0000You Don't Have enought Money !!", player, 255, 0, 0, true)
end
end
end)

زي ماتشوفون هدا هو الكود اتمنى الحل بسرعة

وشكرا لكم

Link to comment

جرب هاذا 

addEventHandler ( "onClientGUIClick" , root , function ( )
if ( source == b1 ) then 
setElementData ( localPlayer , "tent" , 1 )
local Money_ = ( getElementData ( localPlayer , "Money" ) or 0 )
if ( Money_ >= 200000 ) then 
setElementData ( localPlayer , "Money" , Money_ - 200000 )
else
outputChatBox ( "You Don't Have enought Money",255,0,0,true)
end
end
end );

 

  • Like 1
Link to comment

بس هو راح يخلي الفلوس سالب + الزر لما اضغط عليه ماينقص فلوسي ليش ؟

addEventHandler ( "onClientGUIClick" , root , function ()
if ( source == b1 ) then 
local Money_ = ( getElementData ( localPlayer , "Money" ) or 0 )
if ( Money_ >= 200000 ) then 
setElementData ( localPlayer , "Money" , Money_ - 200000 )
setElementData ( localPlayer , "tent" , 1 )
outputChatBox ( "لقد تمت عملية الشراء !", 255,0,0,true)
else
outputChatBox ( "لايوجد لديك مال كافي !", 255,0,0,true)
end
end
end );

 

Link to comment

جرب هاذا وشوف . 

player = getLocalPlayer ( )
setElementData ( player , "Money" , 100000000 )
GUIEditor = { button = {} };

addEventHandler("onClientResourceStart", resourceRoot,
function()
GUIEditor["button"][1] = guiCreateButton(315, 234, 133, 40, "Hello_", false)  
end
)

addEventHandler ( "onClientGUIClick" , root, function ( )
if ( source == GUIEditor["button"][1] ) then 
local Money_ = ( getElementData ( player , "Money" ) or 0 )
if ( Money_ >= 2000000 ) then 
outputChatBox ( "." )
setElementData ( player , "Money" , Money_ - 2000000 )
else
outputChatBox ( "لاتمتلك المال الكافي" , 255 , 0 , 0 )
end
end
end );

addCommandHandler ( "mymoney" , function ( )
outputChatBox ( tostring ( ( getElementData ( player , "Money" ) or 0 ) ) )
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...