Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- [25]={true,false,['bone']=,['x']=,['y']=,['z']=,['rx']=,['ry']=,['rz']=,},
- primaryWeapons={
- --Default: 3,-0.1,-0.13,0.1,0,55,0
- [25]={true,true},
- [27]={true,true},
- [35]={true,false,['bone']=3,['x']=-0.1,['y']=-0.13,['z']=-0.2,['rx']=0,['ry']=55,['rz']=0,},
- [37]={true,true},
- [36]={true,true},
- [38]={true,true},
- [33]={true,true},
- [34]={true,true},
- [29]={true,true},
- [30]={true,true},
- [31]={true,true},
- }
- secondaryWeapons={
- --Default: 13,-0.045,0,0,0,-90,90
- [3]={true,false,['bone']=13,['x']=0.35,['y']=0,['z']=0,['rx']=0,['ry']=0,['rz']=90,},
- [4]={true,false,['bone']=13,['x']=0.35,['y']=0,['z']=0,['rx']=0,['ry']=0,['rz']=90,},
- [5]={true,false,['bone']=13,['x']=0.35,['y']=0,['z']=0,['rx']=0,['ry']=0,['rz']=90,},
- [8]={true,true},
- [22]={true,true},
- [23]={true,true},
- [24]={true,true},
- [28]={true,true},
- [32]={true,true},
- [26]={true,true},
- }
- equipment={
- --Default:
- [16]={true,true},
- [17]={true,true},
- [18]={true,true},
- [39]={true,true},
- [43]={true,true},
- [44]={true,true},
- [45]={true,true},
- [46]={true,true},
- }
- weaponModels={
- [1]=331,
- [2]=333,
- [3]=334,
- [4]=335,
- [5]=336,
- [6]=337,
- [7]=338,
- [8]=339,
- [9]=341,
- [10]=321,
- [11]=322,
- [12]=323,
- [13]=nil,
- [14]=325,
- [15]=326,
- [16]=342,
- [17]=343,
- [18]=344,
- [19]=nil,
- [20]=nil,
- [21]=nil,
- [22]=346,
- [23]=347,
- [24]=348,
- [25]=349,
- [26]=350,
- [27]=351,
- [28]=352,
- [29]=353,
- [30]=355,
- [31]=356,
- [32]=372,
- [33]=357,
- [34]=358,
- [35]=359,
- [36]=360,
- [37]=361,
- [38]=362,
- [39]=363,
- [40]=364,
- [41]=365,
- [42]=366,
- [43]=367,
- [44]=368,
- [45]=369,
- [46]=371,
- }
- local visibleWeapons={}
- function displayWeapons()
- local player=source
- setTimer(function()
- for id,element in pairs(visibleWeapons) do
- if isElement(element) then
- destroyElement(element)
- end
- end
- visibleWeapons={}
- currentWeapons={}
- for i=1,12 do
- weapon=getPedWeapon(player,i)
- ammo=getPedTotalAmmo(player,i)
- if weapon==getPedWeapon(player) then
- currentWeapon=weapon
- else
- if ammo>0 then
- currentWeapons[weapon]=true
- end
- end
- end
- for weapon,_ in pairs(currentWeapons) do
- if primaryWeapons[weapon]~=nil then
- if primaryWeapons[weapon][1] then
- visibleObject=createObject(weaponModels[weapon],0,0,0)
- if primaryWeapons[weapon][2] then
- exports.bone_attach:attachElementToBone(visibleObject,player,3,-0.1,-0.13,0.1,0,235-180,0)
- else
- positioning=primaryWeapons[weapon]
- exports.bone_attach:attachElementToBone(visibleObject,player,positioning["bone"],positioning["x"],positioning["y"],positioning["z"],positioning["rx"],positioning["ry"],positioning["rz"])
- end
- end
- end
- if secondaryWeapons[weapon]~=nil then
- if secondaryWeapons[weapon][1] then
- visibleObject=createObject(weaponModels[weapon],0,0,0)
- if secondaryWeapons[weapon][2] then
- attached=exports.bone_attach:attachElementToBone(visibleObject,player,13,-0.045,0,0,0,-90,90)
- else
- positioning=secondaryWeapons[weapon]
- exports.bone_attach:attachElementToBone(visibleObject,player,positioning["bone"],positioning["x"],positioning["y"],positioning["z"],positioning["rx"],positioning["ry"],positioning["rz"])
- end
- end
- end
- if equipment[weapon]~=nil then
- if equipment[weapon][1] then
- visibleObject=createObject(weaponModels[weapon],0,0,0)
- if equipment[weapon][2] then
- exports.bone_attach:attachElementToBone(visibleObject,player,5,0,0,0,0,-90,0)
- else
- positioning=equipment[weapon]
- exports.bone_attach:attachElementToBone(visibleObject,player,positioning["bone"],positioning["x"],positioning["y"],positioning["z"],positioning["rx"],positioning["ry"],positioning["rz"])
- end
- end
- end
- visibleWeapons[#visibleWeapons+1]=visibleObject
- end
- end,50,1)
- end
- addEventHandler("onPlayerWeaponSwitch",getRootElement(),displayWeapons)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement