Jump to content

[Help] Object Visible to all player


Recommended Posts

Hello

i have problem, my problem is other player can see my backpack

how to make this script "backpack" can be see all player in the server.

Please help me :cry: sorry for my bad english

Client

case = createObject(3026,0,0,0)    --(object,attachto,bone,x,y,z,rx,ry,rz) 
addCommandHandler("backpack",function() --local Player 
    exports.bone_attach:attachElementToBone(case,localPlayer,5,0,-0.4,0.02,0,0,80,1) --Optimized for backpack 
    exports.global:applyAnimation(localPlayer, "goggles", "goggles_put_on", 1000) -- Added animation if player put the backpack 
end) 
  
addCommandHandler("backpackoff",function() 
    exports.bone_attach:detachElementFromBone(case) 
    exports.global:applyAnimation(localPlayer, "goggles", "goggles_put_on", 1000) -- Added animation if player put off the backpack 
    moveObject(case, 1 ,0 ,0 ,0) 
end) 

Server

addCommandHandler("backpack", 
function() 
    triggerClientEvent ( "backpack", getRootElement(), case ) 
end 
) 
  
addCommandHandler("backpackoff", 
function() 
    triggerClientEvent ( "backpackoff", getRootElement(), removebriefcase ) 
end 
) 

Link to comment

Client

case = createObject(3026, 0, 0, 0) --(object attachto, bone, x, y, z, rx, ry, rz) 
addEvent("backpack", true) 
addEventHandler("backpack", localPlayer,  
   function() -- Local Player 
       exports.bone_attach:attachElementToBone(case, localPlayer, 5, 0, -0.4, 0.02, 0, 0, 80, 1) --Optimized for backpack 
       exports.global:applyAnimation(localPlayer, "goggles", "goggles_put_on", 1000) --Added animation if player put backpack 
    end 
) 
  
addEvent("backpackoff", true) 
addEventHandler("backpackoff", localPlayer, 
   function() 
       exports.bone:detachElementFromBone(case)  
       exports.global:applyAnimation(localPlayer, "goggles", "goggles_put_on", 1000) --Added animation if player put off the backpack 
       moveObject(case, 1, 0, 0, 0) 
    end 
) 
  

Server

addCommandHandler("backpack", 
    function() 
        triggerClientEvent("backpack", root, case) 
    end 
) 
  
addCommandHandler("backpackoff", 
    function() 
        triggerClientEvent("backpackoff", root, removebriefcase) 
    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...