Jump to content

بخصوص ال Data


#TeKa

Recommended Posts

السلام عليكم اولا شكرا لمستر جراند 
ثانين
المود اشتغل حق توزيع الفلوس 
ولكن لما اجي اشتري شييء من ال محل الطعام Food
ما يفعل اي شييء
كود توزيع الفلوس
 

function Sending (Money,Name)
for i,v in ipairs(getElementsByType("player")) do
local data = givePlayerMoney ( v, tonumber(Money))
getElementData( data, "Money" )
end
exports["guimessages"]:outputServer ( getRootElement(),"#3399FF[Gta-Tw] : #C00000"..Name.."#00FF00 Has Give All Players #FFFF00[ #66AA0D $".. Money .." Money #FFFF00 ]", 0, 255, 255,true)
playSoundFrontEnd(getRootElement(), 44)
end
addEvent("OnGiveMoneyall", true)
addEventHandler("OnGiveMoneyall",getRootElement(), Sending)

كود شراء الطعام 
 

addEvent( 'FOOD1', true )
addEventHandler( 'FOOD1', root,
    function( )
	local Money = getElementData(source,"Money") or 0
        if( tonumber( Money ) >= 20 )then
		local health = getElementHealth(source)
		local maxHealth = getPlayerMaxHealth(source) or 100
		if (health <= (maxHealth - 20)) then
			setElementHealth(source, health + 20)
			setElementData(source,"Money",(getElementData(source,"Money") or 0) - 20 )
		elseif (health <= (maxHealth - 1)) and (health > (maxHealth - 20)) and (health < maxHealth) then
			setElementHealth(source, 200)
			setElementData(source,"Money",(getElementData(source,"Money") or 0) - (maxHealth - health) )
		end
        else
            outButDxChat ( 'you dont have money', source, 255, 0, 0 )
        end
    end
)

ياريت الي يصحح يصحح الكود و يحطو تحت !!

Link to comment
function Sending (Money,Name)
for i,v in ipairs(getElementsByType("player")) do
setElementData(v,"Money",(getElementData(v,"Money")or 0 )+ Money)
end
exports["guimessages"]:outputServer ( getRootElement(),"#3399FF[Gta-Tw] : #C00000"..Name.."#00FF00 Has Give All Players #FFFF00[ #66AA0D $".. Money .." Money #FFFF00 ]", 0, 255, 255,true)
playSoundFrontEnd(getRootElement(), 44)
end
addEvent("OnGiveMoneyall", true)
addEventHandler("OnGiveMoneyall",getRootElement(), Sending)


----


addEvent( 'FOOD1', true )
addEventHandler( 'FOOD1', root,
    function( )
	local Money = getElementData(source,"Money") or 0
        if( tonumber( Money ) >= 20 )then
		local health = getElementHealth(source)
		local maxHealth = getPlayerMaxHealth(source) or 100
		if (health <= (maxHealth - 20)) then
			setElementHealth(source, health + 20)
			setElementData(source, "Money", getElementData(source, "Money") - 20)
		elseif (health <= (maxHealth - 1)) and (health > (maxHealth - 20)) and (health < maxHealth) then
			setElementHealth(source, 200)
			setElementData(source, "Money", getElementData(source, "Money") - (maxHealth - health))
		end
        else
            outButDxChat ( 'you dont have money', source, 255, 0, 0 )
        end
    end
)

غير مجرب ... اذا ما اشتغل شوف الديبق وش يقول واطرحه هنا

Edited by #BrosS
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...