xanexxxx Posted January 18, 2021 Share Posted January 18, 2021 I've done this before but it was a few years ago. I have two seperate references, two seperate buttons. But when i click ONE of them, both weapons get removed.. I don't get it. Can anyone see a problem? Here is my script: ScriptName xanesweapons begin onactivate player If GetIsid EHHiddenWeaponsBULL Short inventory Short onstand Set inventory to player.getitemcount WeapRBnrMMP Set onstand to bullREF2.getdisabled If onstand == 1 If inventory >= 1 Player.removeitem WeapRBnrMMP 1 bullREF2.enable 1 Endif Endif Endif If onstand == 0 bullREF2.disable Player.AddItem WeapRBnrMMP 1 Player.AddItem ModNVRBullBPMMP 1 Player.AddItem ModNVRBullLBMMP 1 EndIf ;------------------------------------------------------------------------------------------------------------------ elseif GetIsid EHHiddenWeaponsPISTOL Set inventory to player.getitemcount WeapMHKUSPMMP Set onstand to EHuspREF2.getdisabled If onstand == 1 If inventory >= 1 Player.removeitem WeapMHKUSPMMP 1 EHuspREF2.enable 1 Endif Endif Endif If onstand == 0 EHuspREF2.disable Player.AddItem ModNVMHKUSPExtMMP 1 Player.AddItem ModNVMHKUSPMatchMMP 1 Player.AddItem ModNVMHKUSPSupMMP 1 EndIf ;------------------------------------------------------------------------------------------------------------------------------------------- end Link to comment Share on other sites More sharing options...
dubiousintent Posted January 18, 2021 Share Posted January 18, 2021 Your logic is confusing because your indentation is misleading. It currently reads (adjusted properly): ScriptName xanesweapons Short inventory Short onstand begin onactivate player If GetIsid EHHiddenWeaponsBULL Set inventory to player.getitemcount WeapRBnrMMP Set onstand to bullREF2.getdisabled If onstand == 1 If inventory >= 1 Player.removeitem WeapRBnrMMP 1 bullREF2.enable 1 Endif ; of "Inventory" Endif ; of "onstand == 1" Endif ; of "GetIsid" If onstand == 0 bullREF2.disable Player.AddItem WeapRBnrMMP 1 Player.AddItem ModNVRBullBPMMP 1 Player.AddItem ModNVRBullLBMMP 1 EndIf ;------------------------------------------------------------------------------------------------------------------ elseif GetIsid EHHiddenWeaponsPISTOL ; ElseIf from what? Terminated all previous conditional blocks with "EndIf"s Set inventory to player.getitemcount WeapMHKUSPMMP Set onstand to EHuspREF2.getdisabled If onstand == 1 If inventory >= 1 Player.removeitem WeapMHKUSPMMP 1 EHuspREF2.enable 1 Endif ; of "Inventory" Endif ; of "onstand == 1" Endif ; of the "ElseIf" If onstand == 0 EHuspREF2.disable Player.AddItem ModNVMHKUSPExtMMP 1 Player.AddItem ModNVMHKUSPMatchMMP 1 Player.AddItem ModNVMHKUSPSupMMP 1 EndIf ;------------------------------------------------------------------------------------------------------------------------------------------- end ; of the "Begin" block Try correcting from that version. -Dubious- Link to comment Share on other sites More sharing options...
xanexxxx Posted January 18, 2021 Author Share Posted January 18, 2021 Your logic is confusing because your indentation is misleading. It currently reads (adjusted properly): ScriptName xanesweapons Short inventory Short onstand begin onactivate player If GetIsid EHHiddenWeaponsBULL Set inventory to player.getitemcount WeapRBnrMMP Set onstand to bullREF2.getdisabled If onstand == 1 If inventory >= 1 Player.removeitem WeapRBnrMMP 1 bullREF2.enable 1 Endif ; of "Inventory" Endif ; of "onstand == 1" Endif ; of "GetIsid" If onstand == 0 bullREF2.disable Player.AddItem WeapRBnrMMP 1 Player.AddItem ModNVRBullBPMMP 1 Player.AddItem ModNVRBullLBMMP 1 EndIf ;------------------------------------------------------------------------------------------------------------------ elseif GetIsid EHHiddenWeaponsPISTOL ; ElseIf from what? Terminated all previous conditional blocks with "EndIf"s Set inventory to player.getitemcount WeapMHKUSPMMP Set onstand to EHuspREF2.getdisabled If onstand == 1 If inventory >= 1 Player.removeitem WeapMHKUSPMMP 1 EHuspREF2.enable 1 Endif ; of "Inventory" Endif ; of "onstand == 1" Endif ; of the "ElseIf" If onstand == 0 EHuspREF2.disable Player.AddItem ModNVMHKUSPExtMMP 1 Player.AddItem ModNVMHKUSPMatchMMP 1 Player.AddItem ModNVMHKUSPSupMMP 1 EndIf ;------------------------------------------------------------------------------------------------------------------------------------------- end ; of the "Begin" block Try correcting from that version. -Dubious- Thank you very much! That solved it! :) Link to comment Share on other sites More sharing options...
Recommended Posts