Xenon: Why would you want to switch to your sniper if it has no ammunition?
VenteX, it's definitely scriptable, I'll throw something together soon. I can't promise perfect 1104 compatibility though, might be a SVN + only thing.
Edit:
Something like this possibly?
[cubescript]// SVN + version:
tryswitch = [
weap = (toupper $arg1)
if (&& (checkmag $AKIMBO) (strcmp $weap PISTOL)) [ weap = AKIMBO ]
if (checkmag (getalias $weap)) [
weapon (getalias $weap)
] [ echo (red) error: no ammunition for weapon: $weap ]
]
// bind KEY [ tryswitch pistol ] // attempt a switch to secondary
// bind KEY [ tryswitch (at $WEAPONS (currentprimary)) ] // attempt a switch to primary
// bind KEY [ tryswitch grenades ] // attempt a switch to grenades
// ---------------------------------------------------------------------------------------
// 1104 compatible version:
tryswitch = [
weap = $arg1
if (&& (= $weap 1) (|| (magcontent 9) (magreserve 9))) [ weap = 9 ]
if (|| (magcontent $weap) (magreserve $weap)) [
weapon $weap
] [ echo (c 3) error: no ammunition for weapon: $weap ]
]
// bind KEY [ tryswitch 1 ] // attempt a switch to secondary
// bind KEY [ tryswitch (currentprimary) ] // attempt a switch to primary
// bind KEY [ tryswitch 8 ] // attempt a switch to grenades[/cubescript]
VenteX, it's definitely scriptable, I'll throw something together soon. I can't promise perfect 1104 compatibility though, might be a SVN + only thing.
Edit:
Something like this possibly?
[cubescript]// SVN + version:
tryswitch = [
weap = (toupper $arg1)
if (&& (checkmag $AKIMBO) (strcmp $weap PISTOL)) [ weap = AKIMBO ]
if (checkmag (getalias $weap)) [
weapon (getalias $weap)
] [ echo (red) error: no ammunition for weapon: $weap ]
]
// bind KEY [ tryswitch pistol ] // attempt a switch to secondary
// bind KEY [ tryswitch (at $WEAPONS (currentprimary)) ] // attempt a switch to primary
// bind KEY [ tryswitch grenades ] // attempt a switch to grenades
// ---------------------------------------------------------------------------------------
// 1104 compatible version:
tryswitch = [
weap = $arg1
if (&& (= $weap 1) (|| (magcontent 9) (magreserve 9))) [ weap = 9 ]
if (|| (magcontent $weap) (magreserve $weap)) [
weapon $weap
] [ echo (c 3) error: no ammunition for weapon: $weap ]
]
// bind KEY [ tryswitch 1 ] // attempt a switch to secondary
// bind KEY [ tryswitch (currentprimary) ] // attempt a switch to primary
// bind KEY [ tryswitch 8 ] // attempt a switch to grenades[/cubescript]