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

[CSGO] Axe and hammer pick up


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
root88
Senior Member
Join Date: May 2016
Old 12-08-2018 , 05:01   [CSGO] Axe and hammer pick up
Reply With Quote #1

Hi!
After CSGO Danger Zone Update there are axes and hammers. What I'd like to do is picking them up in normal game mode. You can spawn them for example with:
Code:
sv_cheats 1
give weapon_axe
give weapon_hammer
but you can't pick them up. Anyone?

*update
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>


public void OnPluginStart()
{
    
HookEvent("player_spawn"Event_PlayerSpawn);
}

public 
void Event_PlayerSpawn(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(GetEventInt(event"userid"));
    if(
IsPlayerAlive(client))
    {
        
int iAxe GivePlayerItem(client"weapon_axe");
        
EquipPlayerWeapon(clientiAxe);
    }

It will work, but I still can't pick them up from ground.
__________________

Last edited by root88; 12-08-2018 at 05:51. Reason: update, better code
root88 is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 12-08-2018 , 06:09   Re: [CSGO] Axe and hammer pick up
Reply With Quote #2

I think you should edit items_game.txt for that.

weapon_tablet and weapon_breachcharge have item_gear_slot key.
PHP Code:

"item_gear_slot"        "item"
"item_gear_slot"        "utility" 
__________________
Ilusion9 is offline
zipcore
Veteran Member
Join Date: Mar 2010
Location: m_flZipcore
Old 12-08-2018 , 07:12   Re: [CSGO] Axe and hammer pick up
Reply With Quote #3

weapon_fists work great like this btw

EDIT: jailbreak without knife as spawn weapon?
__________________

Last edited by zipcore; 12-08-2018 at 07:13.
zipcore is offline
root88
Senior Member
Join Date: May 2016
Old 12-08-2018 , 07:39   Re: [CSGO] Axe and hammer pick up
Reply With Quote #4

Quote:
Originally Posted by zipcore View Post
weapon_fists work great like this btw

EDIT: jailbreak without knife as spawn weapon?
Wow, nice! Thx!
__________________
root88 is offline
Trsak
Junior Member
Join Date: Jul 2018
Old 12-09-2018 , 05:52   Re: [CSGO] Axe and hammer pick up
Reply With Quote #5

So currently the only way to use new weapons in causal mode is to edit items_game.txt?
Trsak is offline
root88
Senior Member
Join Date: May 2016
Old 12-09-2018 , 08:12   Re: [CSGO] Axe and hammer pick up
Reply With Quote #6

You can use my code from first post to give players those weapons on spawn.
__________________

Last edited by root88; 12-09-2018 at 08:13.
root88 is offline
Bara
AlliedModders Donor
Join Date: Apr 2012
Location: Germany
Old 12-09-2018 , 08:33   Re: [CSGO] Axe and hammer pick up
Reply With Quote #7

You could work with SDKHooks and WeaponCanUse to pick up melee weapons or try `mp_drop_knife_enable 1`.
__________________
Discord (Bara#5006) | My Plugins (GitHub)
You like my work? Support is not a crime.
Bara is offline
root88
Senior Member
Join Date: May 2016
Old 12-09-2018 , 08:35   Re: [CSGO] Axe and hammer pick up
Reply With Quote #8

I've tried mp_drop_knife_enable 1 already, it doesn't work for axe etc.
__________________
root88 is offline
zipcore
Veteran Member
Join Date: Mar 2010
Location: m_flZipcore
Old 12-09-2018 , 09:52   Re: [CSGO] Axe and hammer pick up
Reply With Quote #9

If nobody has time earlier I would write a plugin to be able to pickup those new weapons end of the week. ( weapon_breachcharge works anyways btw. )

Esp. a fists plugin would be welcome for a lot of servers ( Power punch let your opponent drop their weapon ).

I was wasting some time on the new drones, but sadly havn't got them working yet ( to follow a player and carry items with them ). Looks like they need more then just "m_hMoveToThisEntity" & "m_hDeliveryCargo".

Writing a plugin with those droneguns seems to be pointless, their AI is too boooooring.

A money plugin killing floor style is now possible, or drop money on death.

++++ many more new cool plugins are incomming I guess ++++
__________________
zipcore is offline
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 12-09-2018 , 10:05   Re: [CSGO] Axe and hammer pick up
Reply With Quote #10

This will make you pickup all the new melee weapons.
Note that this is intended to be used with mp_drop_knife_enable set to 1, or you won't be able to drop your knife to pickup a dropped axe/wrench/hammer.
PHP Code:
public void OnPluginStart()
{
    
//Lateload
    
for (int i 1<= MaxClientsi++) if (IsClientInGame(i)) OnClientPutInServer(i);
}

public 
void OnClientPutInServer(int client)
{
    
SDKHook(clientSDKHook_WeaponCanUseHook_WeaponCanUse);
}

public 
Action Hook_WeaponCanUse(int clientint weapon)
{
    
char classname[64];
    
GetEntityClassname(weaponclassnamesizeof classname);
    
    if (
StrEqual(classname"weapon_melee") && !(HasWeapon(client"weapon_melee") || HasWeapon(client"weapon_knife")))
        
EquipPlayerWeapon(clientweapon);
}

stock bool HasWeapon(int client, const char[] classname)
{
    
int index;
    
int weapon;
    
char sName[64];
    
    while((
weapon GetNextWeapon(clientindex)) != -1)
    {
        
GetEdictClassname(weaponsNamesizeof(sName));
        if (
StrEqual(sNameclassname))
            return 
true;
    }
    return 
false;
}

stock int GetNextWeapon(int clientint &weaponIndex)
{
    static 
int weaponsOffset = -1;
    if (
weaponsOffset == -1)
        
weaponsOffset FindDataMapInfo(client"m_hMyWeapons");
    
    
int offset weaponsOffset + (weaponIndex 4);
    
    
int weapon;
    while (
weaponIndex 48
    {
        
weaponIndex++;
        
        
weapon GetEntDataEnt2(clientoffset);
        
        if (
IsValidEdict(weapon)) 
            return 
weapon;
        
        
offset += 4;
    }
    
    return -
1;

I've attached another plugin, if you'd like to play with the breaching charges throwing more than 3 at the same time, just use sm_breaches and it will fill you breach charge amount.
Attached Files
File Type: sp Get Plugin or Get Source (pickall.sp - 947 views - 1.6 KB)
File Type: sp Get Plugin or Get Source (morebreaches.sp - 797 views - 1.5 KB)
__________________
My Plugins
SPCode


Steam: hexer504
Telegram: Hexah
Discord: Hexah#6903

If you like my work you can donate here!

Last edited by Papero; 12-09-2018 at 10:19.
Papero 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 18:37.


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