Raised This Month: $32 Target: $400
 8% 

Solved How to remove weapon from client's hands


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
impossible_cc
Senior Member
Join Date: Sep 2018
Location: Ukraine
Old 10-31-2018 , 14:14   How to remove weapon from client's hands
Reply With Quote #1

I just need to remove all weapons but grenades, c4 and knife to give client new weapon after deleting old one. (slot1 and slot2)
Game - csgo.

Last edited by impossible_cc; 02-21-2019 at 14:14.
impossible_cc is offline
Maxximou5
AlliedModders Donor
Join Date: Feb 2013
Old 10-31-2018 , 15:53   Re: How to remove weapon from client's hands
Reply With Quote #2

There's different methods.
PHP Code:
// Slot 0 = InGame 1 = Primary Weapon
// Slot 1 = InGame 2 = Secondary Weapon

// While
void RemoveWeapons(int client)
{
    for (
int i 02i++)
    {
        
int weapon;
        while ((
weapon GetPlayerWeaponSlot(clienti)) != -1)
        {
            
RemovePlayerItem(clientweapon);
            
RemoveEntity(weapon);
        }
    }
}

// If 
void RemoveWeapons(int client)
{
    
int weapon;
    if (
GetPlayerWeaponSlot(client0)) != -1)
    {
        
RemovePlayerItem(clientweapon);
        
RemoveEntity(weapon);
    }
    if (
GetPlayerWeaponSlot(client1)) != -1)
    {
        
RemovePlayerItem(clientweapon);
        
RemoveEntity(weapon);
    }

Maxximou5 is offline
impossible_cc
Senior Member
Join Date: Sep 2018
Location: Ukraine
Old 11-01-2018 , 10:49   Re: How to remove weapon from client's hands
Reply With Quote #3

Quote:
Originally Posted by Maxximou5 View Post
There's different methods.
PHP Code:
// Slot 0 = InGame 1 = Primary Weapon
// Slot 1 = InGame 2 = Secondary Weapon

// While
void RemoveWeapons(int client)
{
    for (
int i 02i++)
    {
        
int weapon;
        while ((
weapon GetPlayerWeaponSlot(clienti)) != -1)
        {
            
RemovePlayerItem(clientweapon);
            
RemoveEntity(weapon);
        }
    }
}

// If 
void RemoveWeapons(int client)
{
    
int weapon;
    if (
GetPlayerWeaponSlot(client0)) != -1)
    {
        
RemovePlayerItem(clientweapon);
        
RemoveEntity(weapon);
    }
    if (
GetPlayerWeaponSlot(client1)) != -1)
    {
        
RemovePlayerItem(clientweapon);
        
RemoveEntity(weapon);
    }

//if
if ((weapon = GetPlayerWeaponSlot(client, 0)) != -1)

Otherwise it works fine. Thanks )
impossible_cc is offline
Reply



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:16.


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