AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [CSGO] Axe and hammer pick up (https://forums.alliedmods.net/showthread.php?t=312551)

root88 12-08-2018 05:01

[CSGO] Axe and hammer pick up
 
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.

Ilusion9 12-08-2018 06:09

Re: [CSGO] Axe and hammer pick up
 
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" 


zipcore 12-08-2018 07:12

Re: [CSGO] Axe and hammer pick up
 
weapon_fists work great like this btw

EDIT: jailbreak without knife as spawn weapon? :D

root88 12-08-2018 07:39

Re: [CSGO] Axe and hammer pick up
 
Quote:

Originally Posted by zipcore (Post 2627538)
weapon_fists work great like this btw

EDIT: jailbreak without knife as spawn weapon? :D

Wow, nice! Thx!

Trsak 12-09-2018 05:52

Re: [CSGO] Axe and hammer pick up
 
So currently the only way to use new weapons in causal mode is to edit items_game.txt?

root88 12-09-2018 08:12

Re: [CSGO] Axe and hammer pick up
 
You can use my code from first post to give players those weapons on spawn.

Bara 12-09-2018 08:33

Re: [CSGO] Axe and hammer pick up
 
You could work with SDKHooks and WeaponCanUse to pick up melee weapons or try `mp_drop_knife_enable 1`.

root88 12-09-2018 08:35

Re: [CSGO] Axe and hammer pick up
 
I've tried mp_drop_knife_enable 1 already, it doesn't work for axe etc.

zipcore 12-09-2018 09:52

Re: [CSGO] Axe and hammer pick up
 
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 ). :P

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 ++++

Papero 12-09-2018 10:05

Re: [CSGO] Axe and hammer pick up
 
2 Attachment(s)
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.


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

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