تفضل هذا الكود , مسويه من زمان ومجرب وشغال 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 )