Raised This Month: $12 Target: $400
 3% 

knife bug


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jugule
AlliedModders Donor
Join Date: Apr 2020
Old 06-10-2020 , 14:37   knife bug
Reply With Quote #1

I use this function to wipe the knives extra. (without this function some players have 5 knives each), but I have this bug, I don't know why.
https://imgur.com/a/V8PLrYe

code:

PHP Code:
public void RemoveExtraKnives(int client)
{
    
int weapon GetPlayerWeaponSlot(client2);
       while (
weapon!= -1)
       {
        
RemovePlayerItem(clientweapon);
        
weapon GetPlayerWeaponSlot(client2);
    }
        
GivePlayerItem(client"weapon_knife");

jugule is offline
SpirT
Senior Member
Join Date: Sep 2018
Location: Portugal
Old 06-10-2020 , 15:19   Re: knife bug
Reply With Quote #2

Quote:
Originally Posted by jugule View Post
I use this function to wipe the knives extra. (without this function some players have 5 knives each), but I have this bug, I don't know why.
https://imgur.com/a/V8PLrYe

code:

PHP Code:
public void RemoveExtraKnives(int client)
{
    
int weapon GetPlayerWeaponSlot(client2);
       while (
weapon!= -1)
       {
        
RemovePlayerItem(clientweapon);
        
weapon GetPlayerWeaponSlot(client2);
    }
        
GivePlayerItem(client"weapon_knife");

Hey! If I'm sure, slot 2 is for the pistol. Try using slot 3
__________________
SpirT is offline
jugule
AlliedModders Donor
Join Date: Apr 2020
Old 06-10-2020 , 15:33   Re: knife bug
Reply With Quote #3

Quote:
Originally Posted by SpirT View Post
Hey! If I'm sure, slot 2 is for the pistol. Try using slot 3
I also tested slot 3 and slot 4. It only works on slot 2, they don't have 4-5 knives. I mention that I do not set the knife to players in any function.
jugule is offline
SpirT
Senior Member
Join Date: Sep 2018
Location: Portugal
Old 06-10-2020 , 15:58   Re: knife bug
Reply With Quote #4

Quote:
Originally Posted by jugule View Post
I also tested slot 3 and slot 4. It only works on slot 2, they don't have 4-5 knives. I mention that I do not set the knife to players in any function.
I took this from AdvancedAdmin plugin and used it on my new plugin. Maybe this can help on your custom function:

PHP Code:
void DisarmPlayer(int client)
{
    for(
int i 05i++)
    {
        
int weapon = -1;
        while((
weapon GetPlayerWeaponSlot(clienti)) != -1)
        {
            if(
IsValidEntity(weapon))
            {
                
RemovePlayerItem(clientweapon);
            }
        }
    }

__________________
SpirT is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:45.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode