Search the Community
Showing results for tags 'setelementalpha'.
-
I have a script-chec k, if the player has a sniper rifle in his hands and he is aiming, then a message is displayed in the chat. In the sight I see the model of the object (id 321) that I replaced and attached using bone_attach. I want it to become transparent in aiming mode. How do I apply setElementAlpha to this object? I made a transparent texture for the default rifle (id 34). And with the help of bone_attach, I attached the object (id 321), which I replaced with the new SVD model. When I am in aiming mode I see the SVD model, I need to make it transparent (invisible) Client side: function aimAction (key, state) if (getPedWeapon (localPlayer) ~= 34) then return end outputChatBox ("You are aiming now", 255, 0, 0) for control in pairs (getBoundControls(key)) do setPedControlState (control, false) end end bindKey ("mouse2", "down", aimAction) Server side: function attachSVD (thePlayer) local x, y, z = getElementPosition (thePlayer) local objPick = createObject (321, x, y, z) setTimer (function (thePlayer) giveWeapon ( thePlayer, 34, 200, true ) exports.bone_attach:attachElementToBone (objPick, thePlayer, 12, 0, 0, 0, 0, -90, 0) end, 1000, 1, thePlayer) end addCommandHandler ("svd", attachSVD) Repale models: function replaceWeapon() -- Invisible defolt sniper riflle txd = engineLoadTXD ( "mdls/weapons/sniper_rifle/sniper.txd" ) engineImportTXD ( txd, 358) -- SVD model -- txd = engineLoadTXD ( "mdls/weapons/sniper_rifle/svd.txd" ) engineImportTXD ( txd, 321) dff = engineLoadDFF ( "mdls/weapons/sniper_rifle/svd.dff") engineReplaceModel ( dff, 321) end addEventHandler ( "onClientResourceStart", resourceRoot, replaceWeapon)