Jump to content

شئ بسيط ذذ


Recommended Posts

'onClientGUIClick'
triggerServerEvent
getPlayerMoney
takePlayerMoney
triggerClientEvent
setWorldSpecialPropertyEnabled

إستخدم الوظائف . ^ .

واذا واجهتك أخطاء اطرحها ومانقصر معاك إن شاء الله . 

Link to comment

مع اني فاضي, سويت لك الكود.

addEventHandler ( "onClientGUIClick", button, function ( )
	triggerServerEvent ( "Give", localPlayer )
end, false )

addEvent ( "Accept", true )
addEventHandler ( "Accept", root,
	function ( )
		setWorldSpecialPropertyEnabled ( "extrajump", true )
	end
) ;


-- Server
local Money = 500 -- بدل رقم المال حقك

addEvent ( "Give", true )
addEventHandler ( "Give", root,
	function ( )
		if ( getPlayerMoney ( source ) >= tonumber ( Money ) ) then
			takePlayerMoney ( source, money )
			triggerClientEvent ( source, "Accept", source )
		else
			outputChatBox ( "you don't have money!", source, 255 , 0, 0, true )
		end
	end
) ;

 

Edited by Deativated
Link to comment
5 minutes ago, #BrosS said:

getPlayerMoney , takePlayerMoney

يشتغلو بالكلينت

:bday:

Note: Using this function client side (not recommended) will not change a players money server side.

 

Note: The amount may vary between the server and client, you shouldn't trust the client side value to always be accurate.

Link to comment
3 minutes ago, #,+( _xiRoc[K]; > said:

Note: Using this function client side (not recommended) will not change a players money server side.

 

Note: The amount may vary between the server and client, you shouldn't trust the client side value to always be accurate.

يخي **** البرمجة والويكي ذا

ويقولك ماننصحك تستعملها بالكلينت shared ليه حاططينها 

!!!!!!!!!!!!!!!!!!!!!!!!!

:redhotevil:::evil:::twisted:

Link to comment
1 hour ago, #BrosS said:

يخي **** البرمجة والويكي ذا

ويقولك ماننصحك تستعملها بالكلينت shared ليه حاططينها 

!!!!!!!!!!!!!!!!!!!!!!!!!

:redhotevil:::evil:::twisted:

اعتقد وهمي بالكلنت ؟

Link to comment
addEventHandler ( "onClientGUIClick", button, function ( ) -- بدا اسم الزر
triggerServerEvent ( "Give", localPlayer )
end
)

addEvent ( "Accept", true )
addEventHandler ( "Accept", root,
	function ( )
		setWorldSpecialPropertyEnabled ( "extrajump", true )
	end
) 


-- Server

addEvent ( "Give", true )
addEventHandler ( "Give", root,
function ( )
if ( getPlayerMoney ( source ) >= 500 ) then -- فلوسك
takePlayerMoney ( source, 500 )
triggerClientEvent ( source, "Accept", source )
else
outputChatBox ( "you don't have money!", source, 255 , 0, 0, true )
end
end
) 

تعديل بسيط عشان الكود فوق كان فيه خطا

Link to comment
12 hours ago, #MR.NaiF said:

addEventHandler ( "onClientGUIClick", button, function ( ) -- بدا اسم الزر
triggerServerEvent ( "Give", localPlayer )
end
)

addEvent ( "Accept", true )
addEventHandler ( "Accept", root,
	function ( )
		setWorldSpecialPropertyEnabled ( "extrajump", true )
	end
) 


-- Server

addEvent ( "Give", true )
addEventHandler ( "Give", root,
function ( )
if ( getPlayerMoney ( source ) >= 500 ) then -- فلوسك
takePlayerMoney ( source, 500 )
triggerClientEvent ( source, "Accept", source )
else
outputChatBox ( "you don't have money!", source, 255 , 0, 0, true )
end
end
) 

تعديل بسيط عشان الكود فوق كان فيه خطا

addEventHandler ( "onClientGUIClick", button, function ( ) -- بدا اسم الزر
triggerServerEvent ( "Give", localPlayer )
end
)

الكود دا راح يتنفذ على اي شي مو شرط زر

Link to comment
--- # client 

addEventHandler ( "onClientGUIClick" , resourceRoot , function ()
if ( source == yourbutton ) then 
triggerServerEvent ( "checkMoney" , localPlayer ) ;
end
end ) ; 

addEvent("setAction",true)
addEventHandler("setAction",root,function()
setWorldSpecialPropertyEnabled ( "extrajump" , true ) ; 
end ) 

---- # server

addEvent ( "checkMoney" , true )
addEventHandler ( "checkMoney" , root, function ( )
if ( getPlayerMoney ( source ) >= 5000 ) then 
triggerClientEvent ( source , "setAction" , source ) ; 
takePlayerMoney ( source , 5000 )
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...