#STZ Posted August 21, 2016 Share Posted August 21, 2016 السلام عليكم و رحمة الله و بركاته عندي فش مشكلة في كود فكرة الكود انه لما يضغط الزر يخصم منه 20 دولار و يعطيه سيارة addEventHandler("onClientGUIClick",resourceRoot,function ( ) if source == GUIEditor.button[1] then triggerServerEvent("bikes",localPlayer,522) local plr = getPlayerMoney(source) plr >=20then takePlayerMoney(20) else outputChatBox("لا يوجد لديك مال كافئ", source, 255, 0, 0) cancelEvent () end end end ) اتمني التصحيح Link to comment
^iiEcoo'x_) Posted August 21, 2016 Share Posted August 21, 2016 [b] Client addEventHandler("onClientGUIClick", root, function() if ( source == b1 ) then triggerServerEvent("car",getLocalPlayer()) end end )[/b] [b]Server vehicle = {} addEvent("car", true) addEventHandler("car", root, function(amount) if isElement(vehicle[source]) then destroyElement(vehicle[source]) end local x, y, z = getElementPosition(source) vehicle[source] = createVehicle(599, x, y, z) warpPedIntoVehicle(source, vehicle[source]) local money = getPlayerMoney(source) if money >= amount then takePlayerMoney (source,amount) outputChatBox ("لقد اشتريت سيارة",source,255,0,0,true) else outputChatBox ("لايوجد معك مال كافي ",source,255,0,0) end end) end ) addEventHandler("onPlayerQuit", root, function() if isElement(vehicle[source]) then destroyElement(vehicle[source]) vehicle[source] = nil end end) [/b] Link to comment
Ahmed Ly Posted August 22, 2016 Share Posted August 22, 2016 --- Client addEventHandler("onClientGUIClick",root,function ( ) if source == GUIEditor.button[1] then triggerServerEvent("bikes",localPlayer) end end ) --- Server vehicle = {} addEvent("bikes", true) addEventHandler("bikes", root, function() if isElement(vehicle[source]) then destroyElement(vehicle[source]) end if getPlayerMoney(source) >= 15000 then takePlayerMoney (source,15000) x, y, z = getElementPosition(source) vehicle[source] = createVehicle(599, x, y, z) warpPedIntoVehicle(source, vehicle[source]) outputChatBox ("لقد اشتريت سيارة",source,0,255,0,true) else outputChatBox ("لايوجد معك مال كافي ",source,0,255,0,true) end end ) addEventHandler("onPlayerQuit", root, function() if isElement(vehicle[source]) then destroyElement(vehicle[source]) vehicle[source] = nil end end ) Link to comment
Mr.R Posted August 22, 2016 Share Posted August 22, 2016 تفضل هذا الكود , مسويه من زمان ومجرب وشغال 100% ملاحظه : سطر 10 بملف سيرفر غير رقم 411 بايدي السيارهـ الي تبيها #Client addEventHandler ( "onClientGUIClick", resourceRoot, function ( ) if ( source == اسم الزر ) then triggerServerEvent ( "GiveVehicle", localPlayer ) end end ) #Server local Vehicle = { }; addEvent ( "GiveVehicle", true ) addEventHandler ( "GiveVehicle", root, function ( ) if ( Vehicle[source] ) and ( isElement ( Vehicle[source] ) ) then destroyElement ( Vehicle[source] ) end local x, y, z = getElementPosition ( source ) Vehicle[source] = createVehicle ( 411, x, y, z ) warpPedIntoVehicle ( source, Vehicle[source] ) if ( getPlayerMoney ( source ) >= 2000 ) then takePlayerMoney ( source, 2000 ) outputChatBox ( "* تم شراء السيارهـ بنجاح", source, 255, 255, 255, true ) else outputChatBox ( "* لا تملك المال الكافي لـ شراء السيارهـ", source, 255, 255, 255, true ) end end ) Link to comment
Adham Posted August 22, 2016 Share Posted August 22, 2016 جرب كلنت addEventHandler ( "onClientGUIClick", root, function ( ) if source == button then triggerServerEvent( "Car", localPlayer ) end end) سرفر Cars = {} addEvent ( "Car", true ) addEventHandler ( "Car" ,root, function ( ) if isElement(Cars[source]) then destroyElement(Cars[source]) if getPlayerMoney ( source ) >= 2500 then takePlayerMoney ( source, 2500 ) x,y,z = getElementPosition( source ) Cars[source] = createVehicle(ID, x, y, z) end end end) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now