Current version:
[cubescript]
bind mouse1 [ if (checkalias onAttack) onAttack; attack ]
onAttack = [ if (= (curweapon) 8) [ say "Fire in the hole!" ] ]
[/cubescript]
Next version:
[cubescript]checkinit onAttack [ if (= (curweapon) $GRENADES) [ say "Fire in the hole!" ] ][/cubescript]
If you want the message to appear as you let go of the grenade, no matter how long you have "cooked" it, you will need to tweak it a bit:
Current version:
[cubescript]
bind mouse1 [ if (checkalias onAttack) onAttack; WEAPON_USED = (curweapon); attack; onrelease [ if (checkalias offAttack) offAttack ] ]
offAttack = [ if (&& (alive) (= $WEAPON_USED 8)) [ say "Fire in the hole!" ] ]
[/cubescript]
Next version:
[cubescript]
bind mouse1 [ WEAPON_USED = (curweapon); attack; onrelease [ if (checkalias offAttack) offAttack ] ]
offAttack = [ if (&& (alive) (= $WEAPON_USED $GRENADES)) [ say "Fire in the hole!" ] ]
[/cubescript]
As pointed out previously, these kind of scripts are considered spam by many players. I tend to use /ignore on people who use such scripts.
[cubescript]
bind mouse1 [ if (checkalias onAttack) onAttack; attack ]
onAttack = [ if (= (curweapon) 8) [ say "Fire in the hole!" ] ]
[/cubescript]
Next version:
[cubescript]checkinit onAttack [ if (= (curweapon) $GRENADES) [ say "Fire in the hole!" ] ][/cubescript]
If you want the message to appear as you let go of the grenade, no matter how long you have "cooked" it, you will need to tweak it a bit:
Current version:
[cubescript]
bind mouse1 [ if (checkalias onAttack) onAttack; WEAPON_USED = (curweapon); attack; onrelease [ if (checkalias offAttack) offAttack ] ]
offAttack = [ if (&& (alive) (= $WEAPON_USED 8)) [ say "Fire in the hole!" ] ]
[/cubescript]
Next version:
[cubescript]
bind mouse1 [ WEAPON_USED = (curweapon); attack; onrelease [ if (checkalias offAttack) offAttack ] ]
offAttack = [ if (&& (alive) (= $WEAPON_USED $GRENADES)) [ say "Fire in the hole!" ] ]
[/cubescript]
As pointed out previously, these kind of scripts are considered spam by many players. I tend to use /ignore on people who use such scripts.