Jump to content

Bug weapons on the back


Pedro Colto

Recommended Posts

Hello friends, well when I equip the selected weapons they appear in my more coast to a bug when reloga the gun stays floating if not destroy after the login or reconnect

code:

elementWeaponbBack = {} 
function weaponSwitchbBack ( previousWeaponID, currentWeaponID ) 
 local weapon1 = getElementData(source,"currentweapon_2") 
 if not weapon1 then return end 
 local ammoData1,weapID1 = getWeaponAmmoType(weapon1) 
 local x,y,z = getElementPosition(source) 
 local rx,ry,rz = getElementRotation(source) 
          if previousWeaponID == weapID1 then 
           if elementWeaponbBack[source] then 
            detachElementFromBone(elementWeaponbBack[source]) 
            destroyElement(elementWeaponbBack[source]) 
            elementWeaponbBack[source] = false 
           end 
           if weapon1 == "Machado" then 
           elementWeaponbBack[source] = createObject(339,x,y,z) 
           setObjectScale(elementWeaponbBack[source],0.999) 
           elseif weapon1 == "Crowbar" then 
           elementWeaponbBack[source] = createObject(333,x,y,z) 
           setObjectScale(elementWeaponbBack[source],0.999) 
           elseif weapon1 == "Baseball Bat" then 
           elementWeaponbBack[source] = createObject(336,x,y,z) 
           setObjectScale(elementWeaponbBack[source],0.999) 
           elseif weapon1 == "Shovel" then 
           elementWeaponbBack[source] = createObject(337,x,y,z) 
           setObjectScale(elementWeaponbBack[source],0.999) 
           elseif weapon1 == "Chainsaw" then 
           elementWeaponbBack[source] = createObject(341,x,y,z) 
           setObjectScale(elementWeaponbBack[source],0.999) 
           elseif weapon1 == "--" then 
           else 
           elementWeaponbBack[source] = createObject(getWeaponObjectID(weapID1),x,y,z) 
           setObjectScale(elementWeaponbBack[source],0.875) 
           end 
           if elementBackpack[source] then 
            attachElementToBone(elementWeaponbBack[source],source,3,-0.18,-0.05,-0.1,-0.1,0,260) 
           else 
            attachElementToBone(elementWeaponbBack[source],source,3,-0.18,-0.05,-0.1,-0.1,0,260) 
           end 
          elseif currentWeaponID == weapID1 then 
           detachElementFromBone(elementWeaponbBack[source]) 
           destroyElement(elementWeaponbBack[source]) 
           elementWeaponbBack[source] = false 
          end 
 end 
addEventHandler ( "onPlayerWeaponSwitch", getRootElement(), weaponSwitchbBack ) 

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