Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- validWeapons = {[30] = true, [31] = true}
- playerWeapon = {}
- addEventHandler("onPlayerWeaponSwitch", root,
- function(prev, cur)
- if (validWeapons[cur]) then
- destroyWeapon(source)
- playerWeapon[source] = createObject(ID_do_objeto, unpack{getElementPosition(source)})
- setElementDimension(playerWeapon[source], getElementDimension(source))
- setElementInterior(playerWeapon[source], getElementInterior(source))
- exports["bone_attach"]:attachElementToBone(playerWeapon[source], source, 12, 0, 0, 0, 180, 90, 180)
- else
- destroyWeapon(source)
- end
- end
- )
- function destroyWeapon(player)
- if (isElement(playerWeapon[player])) then
- exports["bone_attach"]:detachElementFromBone(playerWeapon[player])
- destroyElement(playerWeapon[player])
- playerWeapon[player] = nil
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement