Jump to content

setVehicleComponentPosition


Recommended Posts

السلام عليكم

في عندي مشكله بي هاد الفنكشن إنه بس إلي أطلقه يشوف إل بزشن الجديد أي

إنه بس بيشتغل بال كلاينت هل يوجد طريقة لحل هذه المشكله؟ مع العلم إنه لو كنت جالس جمب السائق تشوف التغيير زيه أما إلي بينظر من الخارج ما يشوف إل بزشن الجديد

و شكرا

setVehicleComponentPosition 

Link to comment
الفنكشن جانب كلنت فقط يعني للاعب نفسه فقط .

لا مو ضروري في فنقشن مثل إل playsound3d إذا عملتله ترجر من إل سيرفر يسمعه كل الأشخاض إلي جمبه مع إنه كلاينت بعدين أنا قلت إنه لو كنت جالس جمب إل سائق تشوف إل تغيير

Link to comment

server :

function bindKeysOnJoin(source)  
       bindKey(source, "l", "down", setit) 
end 
addEventHandler("onVehicleEnter", getRootElement(), bindKeysOnJoin) 
  
function bindKeysOnJoin2(source) 
    unbindKey(source, "l", "down", setit) 
end 
addEventHandler("onVehicleExit", getRootElement(), bindKeysOnJoin2) 
  
  
  
function winghide(source, key, keystate, veh) 
    triggerClientEvent( "setit", root, veh ) 
end 
  

Client :

  
 addEvent ( "setit", true ) --if the vehicle is a car 
 addEventHandler ( "setit", root, 
        function ( veh ) 
        theVeh = getPedOccupiedVehicle(localPlayer) 
                if (theVeh) then 
             outputChatBox("Working !") --tester 
             x, y, z = getVehicleComponentPosition(theVeh, "coveral") -- get the position of the component 
             setVehicleComponentPosition(theVeh, "coveral", x, y+0.1, z)  
         
end) 

Link to comment

addEventHandler ( "onResourceStart", resourceRoot, function ( ) 
  for _,p in ipairs ( getElementsByType ( "player" ) ) do 
         bindKey ( p, "l", "down", triggerAll ) 
   end 
end ) 
  
addEventHandler ( "onPlayerJoin", root, function ( ) 
        bindKey ( source, "l", "down", triggerAll ) 
end ) 
  
  
triggerAll = function ( player ) 
    local vehicle = getPedOccupiedVehicle( player ) 
    if ( vehicle ) then 
          triggerClientEvent( root, "setit", root, vehicle ) 
    end 
end 
Link to comment
addEventHandler ( "onResourceStart", resourceRoot, function ( ) 
  for _,p in ipairs ( getElementsByType ( "player" ) ) do 
         bindKey ( p, "l", "down", triggerAll ) 
   end 
end ) 
  
addEventHandler ( "onPlayerJoin", root, function ( ) 
        bindKey ( source, "l", "down", triggerAll ) 
end ) 
  
  
triggerAll = function ( player ) 
    local vehicle = getPedOccupiedVehicle( player ) 
    if ( vehicle ) then 
          triggerClientEvent( root, "setit", root, vehicle ) 
    end 
end 

بجرب الكود بس يجي صديقي , شكرا

Link to comment

العفو .. بس نسيت اعدل جانب كلنت .. :

addEvent ( "setit", true ) --if the vehicle is a car 
addEventHandler ( "setit", root, function ( vehicle ) 
          outputChatBox("Working !") --tester 
          x, y, z = getVehicleComponentPosition( vehicle, "coveral") -- get the position of the component 
          setVehicleComponentPosition( vehicle, "coveral", x, y+0.1, z)   
end ) 
Link to comment
العفو .. بس نسيت اعدل جانب كلنت .. :

addEvent ( "setit", true ) --if the vehicle is a car 
addEventHandler ( "setit", root, function ( vehicle ) 
          outputChatBox("Working !") --tester 
          x, y, z = getVehicleComponentPosition( vehicle, "coveral") -- get the position of the component 
          setVehicleComponentPosition( vehicle, "coveral", x, y+0.1, z)   
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...