Raised This Month: $ Target: $400
 0% 

Solved CS:GO Can't give hammer, fists, axes, etc


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sarrus
Member
Join Date: May 2020
Location: France
Old 12-10-2020 , 09:01   CS:GO Can't give hammer, fists, axes, etc
Reply With Quote #1

Hello, I'm trying to make a plugin that gives a hammer or an axe to player when they spawn.
I've been through this thread and this one but both solution don't seem to work :c

I've tried this simple script:

Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>


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

public void Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
{
    int client = GetClientOfUserId(GetEventInt(event, "userid"));
    if(IsPlayerAlive(client))
    {
        int iAxe = GivePlayerItem(client, "weapon_axe");
        EquipPlayerWeapon(client, iAxe);
    }
}
It works in casual but not in deathmatch mode.
I've tried to copy paste every cvar in gamemode_casual_server.cfg to gamemode_deathmatch_server.cfg but that still doesn't work...


I have mp_drop_knife_enable 1 just in case.
Any help to debug this is appreciated!
Thanks in advance
__________________
Discord Coding Server | Steam Profile | Community Website | Github Profile

Taking paid requests (add me on Discord)

Last edited by Sarrus; 12-15-2020 at 10:32.
Sarrus is offline
FAQU
Member
Join Date: Sep 2020
Location: Romania
Old 12-11-2020 , 01:58   Re: CS:GO Can't give hammer, fists, axes, etc
Reply With Quote #2

Try this:
PHP Code:
int axe CreateEntityByName("weapon_axe");
if (
axe != -1)
{
    
DispatchSpawn(axe);
    
EquipPlayerWeapon(clientaxe);


Last edited by FAQU; 12-11-2020 at 01:59.
FAQU is offline
Sarrus
Member
Join Date: May 2020
Location: France
Old 12-11-2020 , 06:06   Re: CS:GO Can't give hammer, fists, axes, etc
Reply With Quote #3

Quote:
Originally Posted by FAQU View Post
Try this:
PHP Code:
int axe CreateEntityByName("weapon_axe");
if (
axe != -1)
{
    
DispatchSpawn(axe);
    
EquipPlayerWeapon(clientaxe);

Oh wow that works!
Thanks a lot!
There is still a problem when picking up the axe, it vanishes again...

I'll try to figure it out and post the solution below if it works!
__________________
Discord Coding Server | Steam Profile | Community Website | Github Profile

Taking paid requests (add me on Discord)
Sarrus is offline
FAQU
Member
Join Date: Sep 2020
Location: Romania
Old 12-13-2020 , 02:06   Re: CS:GO Can't give hammer, fists, axes, etc
Reply With Quote #4

Quote:
Originally Posted by Sarrus View Post
Oh wow that works!
There is still a problem when picking up the axe, it vanishes again...
That's strange. Maybe deathmatch just doesn't allow danger zone items.
FAQU 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 18:03.


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