Jump to content

طلب كود


BeCooL

Recommended Posts

  
myMarker1 = createMarker( 1184.3974609375, -1315.8817138672, 12.572691917419, "cylinder", 2, 150, 150, 150, 160 ) 
myMarker2 = createMarker( 1174.0268554688, -1332.1184082031, 12.572691917419, "cylinder", 2, 150, 150, 150, 160 ) 
          
addEventHandler ( "onMarkerHit", myMarker1,   
    function ( hitPlayer ) 
        if ( isPedInVehicle ( hitPlayer ) ~= true ) then 
            theData = getElementData ( hitPlayer , "theCar" ) 
            if ( theData ) then 
                destroyElement ( theData ) 
            end 
            x, y, z = getElementPosition ( hitPlayer ) 
            myCar = createVehicle ( 481, x, y, z ) 
            warpPedIntoVehicle ( hitPlayer, myCar ) 
            setElementData ( hitPlayer, "theCar", myCar ) 
        end 
    end 
) 
  
addEventHandler ( "onMarkerHit", myMarker2,   
    function ( hitPlayer ) 
        if ( isPedInVehicle ( hitPlayer ) ~= true ) then 
            theData = getElementData ( hitPlayer , "theCar" ) 
            if ( theData ) then 
                destroyElement ( theData ) 
            end 
            x, y, z = getElementPosition ( hitPlayer ) 
            myCar = createVehicle ( 481, x, y, z ) 
            warpPedIntoVehicle ( hitPlayer, myCar ) 
            setElementData ( hitPlayer, "theCar", myCar ) 
        end 
    end 
) 
  

الماركر صار يطلع اكثر من سيارة!!

Link to comment
طيب جرب استخدم الجدول الي طرحه عناد

والله حاولت في الجدول ولا ظبط بس ياليت تعدل لي الكود اللي في الرد اللي قبل يطلع اكثر من سيارة انا ابغاها اذا طلع الاعب سيارة تروح اللي قبلها

Link to comment

الطريقة هذي مانصح فيها ابد . . لكن جرب يمكن يضبط

  
myMarker1 = createMarker( 1184.3974609375, -1315.8817138672, 12.572691917419, "cylinder", 2, 150, 150, 150, 160 ) 
myMarker2 = createMarker( 1174.0268554688, -1332.1184082031, 12.572691917419, "cylinder", 2, 150, 150, 150, 160 ) 
          
addEventHandler ( "onMarkerHit", myMarker1,   
    function ( hitPlayer ) 
        if ( isPedInVehicle ( hitPlayer ) == false ) then 
            theData = getElementData ( hitPlayer , "theCar" ) 
            if ( theData ) then 
                destroyElement ( theData ) 
            end 
            x, y, z = getElementPosition ( hitPlayer ) 
            myCar = createVehicle ( 481, x, y, z ) 
            warpPedIntoVehicle ( hitPlayer, myCar ) 
            setElementData ( hitPlayer, "theCar", myCar ) 
        end 
    end 
) 
  
addEventHandler ( "onMarkerHit", myMarker2,   
    function ( hitPlayer ) 
        if ( isPedInVehicle ( hitPlayer ) == false ) then 
            theData2 = getElementData ( hitPlayer , "theCar2" ) 
            if ( theData2 ) then 
                destroyElement ( theData2 ) 
            end 
            x, y, z = getElementPosition ( hitPlayer ) 
            myCar2 = createVehicle ( 481, x, y, z ) 
            warpPedIntoVehicle ( hitPlayer, myCar2 ) 
            setElementData ( hitPlayer, "theCar2", myCar2 ) 
        end 
    end 
) 
  

Link to comment
الطريقة هذي مانصح فيها ابد . . لكن جرب يمكن يضبط
  
myMarker1 = createMarker( 1184.3974609375, -1315.8817138672, 12.572691917419, "cylinder", 2, 150, 150, 150, 160 ) 
myMarker2 = createMarker( 1174.0268554688, -1332.1184082031, 12.572691917419, "cylinder", 2, 150, 150, 150, 160 ) 
          
addEventHandler ( "onMarkerHit", myMarker1,   
    function ( hitPlayer ) 
        if ( isPedInVehicle ( hitPlayer ) == false ) then 
            theData = getElementData ( hitPlayer , "theCar" ) 
            if ( theData ) then 
                destroyElement ( theData ) 
            end 
            x, y, z = getElementPosition ( hitPlayer ) 
            myCar = createVehicle ( 481, x, y, z ) 
            warpPedIntoVehicle ( hitPlayer, myCar ) 
            setElementData ( hitPlayer, "theCar", myCar ) 
        end 
    end 
) 
  
addEventHandler ( "onMarkerHit", myMarker2,   
    function ( hitPlayer ) 
        if ( isPedInVehicle ( hitPlayer ) == false ) then 
            theData2 = getElementData ( hitPlayer , "theCar2" ) 
            if ( theData2 ) then 
                destroyElement ( theData2 ) 
            end 
            x, y, z = getElementPosition ( hitPlayer ) 
            myCar2 = createVehicle ( 481, x, y, z ) 
            warpPedIntoVehicle ( hitPlayer, myCar2 ) 
            setElementData ( hitPlayer, "theCar2", myCar2 ) 
        end 
    end 
) 
  

اهو ظبط بس اذا طلعت سيارة من الماركر الاول وطلعت سيارة من الثاني ماتروح اللي من الماركر الاول :) فهمت علي ؟

Link to comment

اهو ظبط بس اذا طلعت سيارة من الماركر الاول وطلعت سيارة من الثاني ماتروح اللي من الماركر الاول :) فهمت علي ؟

جرب كذا

myMarker1 = createMarker( 1184.3974609375, -1315.8817138672, 12.572691917419, "cylinder", 2, 150, 150, 150, 160 ) 
myMarker2 = createMarker( 1174.0268554688, -1332.1184082031, 12.572691917419, "cylinder", 2, 150, 150, 150, 160 ) 
          
addEventHandler ( "onMarkerHit", myMarker1,   
    function ( hitPlayer ) 
        if ( isPedInVehicle ( hitPlayer ) == false ) then 
            theData = getElementData ( hitPlayer , "theCar" ) 
            if ( theData ) then 
                destroyElement ( theData ) 
                destroyElement ( theData2 ) 
            end 
            x, y, z = getElementPosition ( hitPlayer ) 
            myCar = createVehicle ( 481, x, y, z ) 
            warpPedIntoVehicle ( hitPlayer, myCar ) 
            setElementData ( hitPlayer, "theCar", myCar ) 
        end 
    end 
) 
  
addEventHandler ( "onMarkerHit", myMarker2,   
    function ( hitPlayer ) 
        if ( isPedInVehicle ( hitPlayer ) == false ) then 
            theData2 = getElementData ( hitPlayer , "theCar2" ) 
            if ( theData2 ) then 
                destroyElement ( theData2 ) 
                destroyElement ( theData ) 
            end 
            x, y, z = getElementPosition ( hitPlayer ) 
            myCar2 = createVehicle ( 481, x, y, z ) 
            warpPedIntoVehicle ( hitPlayer, myCar2 ) 
            setElementData ( hitPlayer, "theCar2", myCar2 ) 
        end 
    end 
) 

Link to comment

اهو ظبط بس اذا طلعت سيارة من الماركر الاول وطلعت سيارة من الثاني ماتروح اللي من الماركر الاول :) فهمت علي ؟

جرب كذا

myMarker1 = createMarker( 1184.3974609375, -1315.8817138672, 12.572691917419, "cylinder", 2, 150, 150, 150, 160 ) 
myMarker2 = createMarker( 1174.0268554688, -1332.1184082031, 12.572691917419, "cylinder", 2, 150, 150, 150, 160 ) 
          
addEventHandler ( "onMarkerHit", myMarker1,   
    function ( hitPlayer ) 
        if ( isPedInVehicle ( hitPlayer ) == false ) then 
            theData = getElementData ( hitPlayer , "theCar" ) 
            if ( theData ) then 
                destroyElement ( theData ) 
                destroyElement ( theData2 ) 
            end 
            x, y, z = getElementPosition ( hitPlayer ) 
            myCar = createVehicle ( 481, x, y, z ) 
            warpPedIntoVehicle ( hitPlayer, myCar ) 
            setElementData ( hitPlayer, "theCar", myCar ) 
        end 
    end 
) 
  
addEventHandler ( "onMarkerHit", myMarker2,   
    function ( hitPlayer ) 
        if ( isPedInVehicle ( hitPlayer ) == false ) then 
            theData2 = getElementData ( hitPlayer , "theCar2" ) 
            if ( theData2 ) then 
                destroyElement ( theData2 ) 
                destroyElement ( theData ) 
            end 
            x, y, z = getElementPosition ( hitPlayer ) 
            myCar2 = createVehicle ( 481, x, y, z ) 
            warpPedIntoVehicle ( hitPlayer, myCar2 ) 
            setElementData ( hitPlayer, "theCar2", myCar2 ) 
        end 
    end 
) 

نفس المشكله وآسف تعبتكم معاي :D

Link to comment
واحد ElementData خل الـ

في الوظيفتين

فيه احتمال يضبط = )

ما ضبظ وهذا الكود اذا كنت انا غلطان فيه

myMarker1 = createMarker( 1184.3974609375, -1315.8817138672, 12.572691917419, "cylinder", 2, 150, 150, 150, 160 ) 
myMarker2 = createMarker( 1174.0268554688, -1332.1184082031, 12.572691917419, "cylinder", 2, 150, 150, 150, 160 ) 
          
addEventHandler ( "onMarkerHit", myMarker1,   
    function ( hitPlayer ) 
        if ( isPedInVehicle ( hitPlayer ) == false ) then 
            theData = getElementData ( hitPlayer , "theCar" ) 
            if ( theData ) then 
                destroyElement ( theData ) 
                destroyElement ( theData ) 
            end 
            x, y, z = getElementPosition ( hitPlayer ) 
            myCar = createVehicle ( 481, x, y, z ) 
            warpPedIntoVehicle ( hitPlayer, myCar ) 
            setElementData ( hitPlayer, "theCar", myCar ) 
        end 
    end 
) 
  
addEventHandler ( "onMarkerHit", myMarker2,   
    function ( hitPlayer ) 
        if ( isPedInVehicle ( hitPlayer ) == false ) then 
            theData2 = getElementData ( hitPlayer , "theCar2" ) 
            if ( theData ) then 
                destroyElement ( theData ) 
                destroyElement ( theData ) 
            end 
            x, y, z = getElementPosition ( hitPlayer ) 
            myCar2 = createVehicle ( 481, x, y, z ) 
            warpPedIntoVehicle ( hitPlayer, myCar2 ) 
            setElementData ( hitPlayer, "theCar2", myCar2 ) 
        end 
    end 
) 

Link to comment
vehicle = {} 
  
Marker1 = createMarker(1184.4, -1315.9, 12.6, "cylinder", 2, 150, 150, 150, 160) 
Marker2 = createMarker(1174, -1332.1, 12.6, "cylinder", 2, 150, 150, 150, 160) 
          
addEventHandler("onMarkerHit", root, 
function(player) 
     if source == Marker1 or source == Marker2 then 
          if getElementType(player) == "player" and not isPedInVehicle(player) then 
               if isElement(vehicle[player]) then 
                    destroyElement(vehicle[player]) 
                    vehicle[player] = nil 
               end 
               local x, y, z = getElementPosition(player) 
               vehicle[player] = createVehicle(481, x, y, z) 
               warpPedIntoVehicle(player, vehicle[player]) 
          end 
     end 
end) 

Link to comment

تعقيب على كود تابل

اذا كانت الماركرات الي راح تسويها حق اعطاء اللاعب سيارة هي الوحيدة في السكربت

استخدم ذا الكود، يكون اسهل لك

vehicle = {} 
  
createMarker(1184.4, -1315.9, 12.6, "cylinder", 2, 150, 150, 150, 160) 
createMarker(1174, -1332.1, 12.6, "cylinder", 2, 150, 150, 150, 160) 
          
addEventHandler("onMarkerHit", getResourceRootElement(), 
function(player) 
    if getElementType(player) == "player" and not isPedInVehicle(player) then 
        if isElement(vehicle[player]) then 
            destroyElement(vehicle[player]) 
            vehicle[player] = nil 
        end 
        local x, y, z = getElementPosition(player) 
        vehicle[player] = createVehicle(481, x, y, z) 
        warpPedIntoVehicle(player, vehicle[player]) 
    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...