View Single Post
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 09-27-2023 , 12:49   Re: Sprint - Run Faster [Double-Tap System]
Reply With Quote #39

Quote:
Originally Posted by Siska1 View Post
Can someone help me make this plugin only work if i have a knife in my hand ?

Code:
public fwd_PlayerPreThink(id) {
    if (!UserCanSprint[id] || get_user_weapon(id) != CSW_KNIFE) {
        return;
    }
maybe something like that should be added ?
Your solution would work, but a more efficient way would be adding another boolean for whether the player is holding a knife and flipping that boolean in "message_cur_weapon" event based on the player's weapon. I am not sure but repeatedly calling get_user_weapon in PlayerPreThink may lower plugin's performance.
akcaliberg is offline