Page 1 of 1

Cancel weapon reload

Posted: Mon May 11, 2020 5:17 am
by ReQ220
Hi! I am trying to find a way how can I cancel the weapon reload.
For example below, I have there if a player has nova which has less than 8 bullets in his clip, I want him to can not reload.
If there any ideas how can I do that? I searched the whole SP wiki for any command like this, but I could not find it :(
Thank you in advance!

Code: Select all

@Event('weapon_reload')
def weapon_reload(event):
    userid = event['userid']
    player = Player.from_userid(userid)
    weapon = player.get_active_weapon()
    checkgun = (weapon.item_definition_index)
    nova = 35
    result = (str('CAN NOT RELOAD'))
   
    if checkgun == nova:
        value = weapon.clip
        If value < 7
            #here I need to cancel reload...
            print (result)

Re: Cancel weapon reload

Posted: Mon May 11, 2020 5:47 am
by L'In20Cible

Syntax: Select all

from listeners import OnPlayerRunCommand
from players.constants import PlayerButtons

@OnPlayerRunCommand
def on_player_run_command(player, user_cmd):
# Block the +reload key
user_cmd.buttons &= ~PlayerButtons.RELOAD