Jump to content

x[ طلب بسيط ]x تمت الافاده


Sfa7

Recommended Posts

صنع ماركر https://wiki.multitheftauto.com/wiki/CreateMarker

الحدث عند لمس الماركر https://wiki.multitheftauto.com/wiki/OnMarkerHit

معرفه نوع العنصر https://wiki.multitheftauto.com/wiki/GetElementType

صنع سياره https://wiki.multitheftauto.com/wiki/CreateVehicle

نقل اللاعب إلى السياره https://wiki.multitheftauto.com/wiki/WarpPedIntoVehicle

الكتابه بالشات https://wiki.multitheftauto.com/wiki/OutputChatBox

تغيير لون السياره https://wiki.multitheftauto.com/wiki/SetVehicleColor

مثال ..

vehicleM = createMarker(...) -- اكمل الكود بنفسك 
colorM = createMarker(...) -- اكمل الكود بنفسك 
addEventHandler("onMarkerHit",root, 
function (hitElement) 
if source == vehicleM and getElementType(hitElement) == "player" then 
local x,y,z = getElementPosition(hitElement) 
local vehicle = createVehicle(...) -- اكمل الكود بنفسك 
warpPedIntoVehicle(hitElement,vehicle) 
outputChatBox(...) -- اكمل الكود بنفسك 
elseif source == colorM and getElementByType(hitElement) == "vehicle" then 
setVehicleColor(hitElement,math.random(255),math.random(255),math.random(255)) 
local player = getVehicleController(hitElement) 
outputChatBox(...) -- اكمل الكود بنفسك 
end 
end) 
  

آسف نسيت شيء تم التعديل ..

Edited by Guest
Link to comment

لو اخذت من وقتك شوي وفتحت الروابط ، راح تشوف امثله واضحة جدا جدا

اقتح لك فنكشن وجمع اكواد من الروابط اللي فوق ، واطرح اكوادك هنا ونزود لك عليه ونصلحه لك اذا فيه مشاكل

Link to comment

-- Server Side !

Vehicles = {} 
  
VehicleM = createMarker ( x, y, z, "cylinder", size, r, g, b, alpha ) 
ColorM = createMarker ( x, y, z, "cylinder", size, r, g, b, alpha ) 
  
addEventHandler( "onMarkerHit", root, 
    function ( hitElement ) 
        if source == VehicleM and getElementType( hitElement ) == "player" then 
            if Vehicles[hitElement] and getElementType( Vehicles[hitElement] ) == "vehicle" then 
                destroyElement( Vehicles[hitElement] ) 
            end 
            local x,y,z = getElementPosition( hitElement ) 
            Vehicles[hitElement] = createVehicle ( ID, x, y, z ) 
            if Vehicles[hitElement] then 
                warpPedIntoVehicle( hitElement, Vehicles[hitElement] ) 
                outputChatBox( "Write Here", hitElement, r, g, b, true ) 
            end 
        elseif source == ColorM and getElementType( hitElement) == "player" and isPedInVehicle( hitElement ) then 
            local player = getPedOccupiedVehicle( hitElement ) 
            setVehicleColor( player, math.random(255), math.random(255), math.random(255) ) 
            outputChatBox( "Write Here", hitElement, r, g, b, true ) 
        end 
    end 
) 
  
addEventHandler( "onVehicleExplode", root, 
    function( ) 
        setTimer( destroyElement, 2000, 1, source ) 
    end 
) 
  
addEventHandler( "onPlayerQuit", root, 
    function( ) 
        if Vehicles[source] then 
            destroyElement( Vehicles[source] ) 
        end 
    end 
) 

الإستبدآل ,

الإستبدال في السطر الثالث والرابع :

x, y, z = الإحداثيات

size = الحجم حق الدائرة

r, g, b = (0-255) الألوان تقدر تحط كل واحده منها بين

^ 255, 120, 0 : مثآل

alpha = (0-255) الشفافية : يعني مدى وضوح الدائرة وتقدر تحطه بين

الإستبدال في سطر : 13

ID = رقم السيارة واذا انت تعرف نوعها لكن ما تعرف الرقم حقها تقدر تعرفه من هنا : https://wiki.multitheftauto.com/wiki/Vehicle_IDs

الإستبدال في سطر : 16

Write Here = الكتابة الي تبيها تجي بالشات

r, g, b = (0-255) الألوان تقدر تحط كل واحده منها بين

255, 120, 0 : مثآل ^

الإستبدال في سطر : 21

Write Here = الكتابة الي تبيها تجي بالشات

r, g, b = (0-255) الألوان تقدر تحط كل واحده منها بين

255, 120, 0 : مثآل ^

ملآحظة : الكود ذآ ما رح يجيب لاق للسيرفر لأنه سويته بحيث , إذا اللاعب دخل الدائرة وكان ماخذ سيارة من قبل ، تنسحب السيارة القديمة وتجيه سيارة جديدة ، وحتى لو كان بالسيارة تنسحب وتجيه سيارة جديدة , وإذا إنفجرت السيارة تنسحب , وإذا خرج اللاعب من السيرفر تنسحب السيارة الي أخذها من الماركر !

Edited by Guest
Link to comment

اخوي اوسامه انا سويت كذا بس ماضبط يطلع الماركر بس مايعطيني لا موتر ولا شي

Vehicles = {} 
  
Vehicle = createMarker ( 1490.6999511719, 1283.0999755859, 10.10000038147, "cylinder", 2, 255, 0, 0, 255 ) 
ColorM = createMarker ( 1474.6999511719, 1284.9000244141, 10.300000190735, "cylinder", 2, 0, 255, 0, 255 ) 
  
addEventHandler( "onMarkerHit", root, 
    function ( hitElement ) 
        if source == VehicleM and getElementType( hitElement ) == "player" then 
            if Vehicles[hitElement] and getElementType( Vehicles[hitElement] ) == "vehicle" then 
                destroyElement( Vehicles[hitElement] ) 
            end 
            local x,y,z = getElementPosition( hitElement ) 
            Vehicles[hitElement] = createVehicle ( 576, x, y, z ) 
            if Vehicles[hitElement] then 
                warpPedIntoVehicle( hitElement, Vehicles[hitElement] ) 
                outputChatBox( "لقد حصلت علي موتر ", hitElement, 255, 0, 0, true ) 
            end 
        elseif source == ColorM and getElementType( hitElement) == "player" and isPedInVehicle( hitElement ) then 
            local player = getPedOccupiedVehicle( hitElement ) 
            setVehicleColor( player, math.random(255), math.random(255), math.random(255) ) 
            outputChatBox( "تم تلوين موترك ", hitElement, 0, 255, 0, true ) 
        end 
    end 
) 
  
addEventHandler( "onVehicleExplode", root, 
    function( ) 
        setTimer( destroyElement, 2000, 1, source ) 
    end 
) 
  
addEventHandler( "onPlayerQuit", root, 
    function( ) 
        if Vehicles[source] then 
            destroyElement( Vehicles[source] ) 
        end 
    end 
) 

ماادري وين الخطا ...

Link to comment
Vehicles = {} 
  
VehicleM = createMarker ( 1490.6999511719, 1283.0999755859, 10.10000038147, "cylinder", 2, 255, 0, 0, 255 ) 
ColorM = createMarker ( 1474.6999511719, 1284.9000244141, 10.300000190735, "cylinder", 2, 0, 255, 0, 255 ) 
  
addEventHandler( "onMarkerHit", root, 
    function ( hitElement ) 
        if source == VehicleM and getElementType( hitElement ) == "player" then 
            if Vehicles[hitElement] and getElementType( Vehicles[hitElement] ) == "vehicle" then 
                destroyElement( Vehicles[hitElement] ) 
            end 
            local x,y,z = getElementPosition( hitElement ) 
            Vehicles[hitElement] = createVehicle ( 576, x, y, z ) 
            if Vehicles[hitElement] then 
                warpPedIntoVehicle( hitElement, Vehicles[hitElement] ) 
                outputChatBox( "لقد حصلت علي موتر ", hitElement, 255, 0, 0, true ) 
            end 
        elseif source == ColorM and getElementType( hitElement) == "player" and isPedInVehicle( hitElement ) then 
            local player = getPedOccupiedVehicle( hitElement ) 
            setVehicleColor( player, math.random(255), math.random(255), math.random(255) ) 
            outputChatBox( "تم تلوين موترك ", hitElement, 0, 255, 0, true ) 
        end 
    end 
) 
  
addEventHandler( "onVehicleExplode", root, 
    function( ) 
        setTimer( destroyElement, 2000, 1, source ) 
    end 
) 
  
addEventHandler( "onPlayerQuit", root, 
    function( ) 
        if Vehicles[source] then 
            destroyElement( Vehicles[source] ) 
        end 
    end 
) 

سوري حبيبي , بس أنا كنت ناسي احط آخر حرف من أسم الماركر

VehicleM

على كل حآل جرب الي فوقق ورح يشتغل 100% ذذ

Link to comment

مشكككوووور اخوي اسامه والله انك مببدع ولاتحرمني من مساعادتك

بس عندي استفسار بسيط يعني لو ابي كل مادوس ع الماركر يطلع موتر جديد يعني موموتر محدد كل مره موتر ذذ وبس ويعطيك الف عافيه :D

Link to comment
  
  
VehicleM = createMarker ( 1490.6999511719, 1283.0999755859, 10.10000038147, "cylinder", 2, 255, 0, 0, 255 ) 
ColorM = createMarker ( 1474.6999511719, 1284.9000244141, 10.300000190735, "cylinder", 2, 0, 255, 0, 255 ) 
  
IdCar = { 
{416}, 
{417}, 
{420}, 
{500}, 
} 
  
addEventHandler( "onMarkerHit", root, 
    function ( hitElement ) 
        if source == VehicleM and getElementType( hitElement ) == "player" then 
            if Vehicles[hitElement] and getElementType( Vehicles[hitElement] ) == "vehicle" then 
                destroyElement( Vehicles[hitElement] ) 
            end 
            local x,y,z = getElementPosition( hitElement ) 
            Vehicles[hitElement] = createVehicle ( IdCar[math.random(#IdCar)], x, y, z ) 
            if Vehicles[hitElement] then 
                warpPedIntoVehicle( hitElement, Vehicles[hitElement] ) 
                outputChatBox( "لقد حصلت علي موتر ", hitElement, 255, 0, 0, true ) 
            end 
        elseif source == ColorM and getElementType( hitElement) == "player" and isPedInVehicle( hitElement ) then 
            local player = getPedOccupiedVehicle( hitElement ) 
            setVehicleColor( player, math.random(255), math.random(255), math.random(255) ) 
            outputChatBox( "تم تلوين موترك ", hitElement, 0, 255, 0, true ) 
        end 
    end 
) 
  
addEventHandler( "onVehicleExplode", root, 
    function( ) 
        setTimer( destroyElement, 2000, 1, source ) 
    end 
) 
  
addEventHandler( "onPlayerQuit", root, 
    function( ) 
        if Vehicles[source] then 
            destroyElement( Vehicles[source] ) 
        end 
    end 
) 
  
  

حط رقم السيارة اللي تبيه داخل الجدول ذا

IdCar = {

{id},

}

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...