Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function weaponReplace(previousWeaponID,currentWeaponID)
- local weapon1 = getElementData(source,"currentweapon_1")
- local weapon2 = getElementData(source,"currentweapon_2")
- if not weapon1 and not weapon2 then return end
- local ammoData1,weapID1 = getWeaponAmmoType(weapon1)
- local ammoData2,weapID2 = getWeaponAmmoType(weapon2)
- local x,y,z = getElementPosition(source)
- local rx,ry,rz = getElementRotation(source)
- if elementWeaponRaplace[source] then
- destroyElement(elementWeaponRaplace[source])
- elementWeaponRaplace[source] = false
- end
- local model = changeWeapons[weapon1]
- if currentWeaponID == weapID2 then
- model = changeWeapons[weapon2]
- setElementData(source,"selectedWeapon",weapon2)
- elseif currentWeaponID == weapID1 then
- setElementData(source,"selectedWeapon",weapon1)
- end
- if currentWeaponID == weapID1 or currentWeaponID == weapID2 then
- if model then
- elementWeaponRaplace[source] = createObject(model,x,y,z +15)
- if attachPositions[weapon] then
- local tbl = attachPositions[weapon].attach
- attachElementToBone(elementWeaponRaplace[source],source,tbl[1],tbl[2],tbl[3],tbl[4],tbl[5],tbl[6],tbl[7])
- end
- end
- end
- end
- addEventHandler("onPlayerWeaponSwitch",getRootElement(),weaponReplace)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement