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

Make weapons not dropable


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Porcellian
Member
Join Date: Oct 2017
Old 09-04-2018 , 15:05   Make weapons not dropable
Reply With Quote #1

Hello,

I am running a gamemode that doesn't really allow weapons to be dropped. When a player dies, it's supposed to drop like usually. But how can I make it impossible to press "g" to drop a weapon?
Porcellian is offline
Porcellian
Member
Join Date: Oct 2017
Old 09-04-2018 , 15:13   Re: Make weapons not dropable
Reply With Quote #2

+ Hide the one who is talking in voice chat, the voice chat should work, but you shouldn't be able to see the one talking.
Porcellian is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 09-04-2018 , 15:38   Re: Make weapons not dropable
Reply With Quote #3

PHP Code:

    SDKHook
(clientSDKHook_WeaponDropOnWeaponDrop);

    public 
Action OnWeaponDrop(int clientint weapon)
    {
        return 
Plugin_Stop;
    } 

Last edited by Ilusion9; 09-04-2018 at 15:39.
Ilusion9 is offline
Porcellian
Member
Join Date: Oct 2017
Old 09-04-2018 , 17:19   Re: Make weapons not dropable
Reply With Quote #4

I got it working, but two problems.

First, I want the weapon to be dropped on death. But not if pressing to drop it, with e.g "g".

Also, it's strange but the gun started acting weird after I tried my script.

Quote:
#include <sdkhooks>
#include <sourcemod>

public OnPluginStart()
{
for (new i= 1; i<= MaxClients; i++)
{
if (IsClientInGame(i))
{
SDKHook(i, SDKHook_WeaponDrop, OnWeaponDrop);
}
}
}

public OnClientPutInServer(client)
{
SDKHook(client, SDKHook_WeaponDrop, OnWeaponDrop);
}

public Action OnWeaponDrop(int client, int weapon)
{
return Plugin_Stop;
}

Last edited by Porcellian; 09-04-2018 at 17:40.
Porcellian is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 09-04-2018 , 18:56   Re: Make weapons not dropable
Reply With Quote #5

Check IsPlayerAlive in the weapon drop callback.

If that doesnt work. Hook weapon drop on spawn and unhook on death via the takedamagealive foward.
__________________
Neuro Toxin is offline
Porcellian
Member
Join Date: Oct 2017
Old 09-05-2018 , 03:36   Re: Make weapons not dropable
Reply With Quote #6

Oh yea, stupid me. That should work.

However, when I try to drop the weapon with my script, it starts acting weird. The animations of the gun stops showing up. I can still shoot and reload, but it looks weird. Why is that?
Porcellian is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 09-05-2018 , 04:47   Re: Make weapons not dropable
Reply With Quote #7

Probably prediction errors.

Try on drop. Wait one frame. Equip the weapon again.
__________________

Last edited by Neuro Toxin; 09-05-2018 at 04:48.
Neuro Toxin is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 09-05-2018 , 09:53   Re: Make weapons not dropable
Reply With Quote #8

PHP Code:

mp_death_drop_gun 0 
Hook player_hurt, if hp < 1 then loop through client weapons and drop them.
Ilusion9 is offline
Porcellian
Member
Join Date: Oct 2017
Old 09-05-2018 , 12:56   Re: Make weapons not dropable
Reply With Quote #9

Sorry, I don't know how to do all this. I am new to this. Can someone help me a bit with the piece of code?
Porcellian is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 09-05-2018 , 18:30   Re: Make weapons not dropable
Reply With Quote #10

Quote:
Originally Posted by Porcellian View Post
Hello,

I am running a gamemode that doesn't really allow weapons to be dropped. When a player dies, it's supposed to drop like usually. But how can I make it impossible to press "g" to drop a weapon?
Please don't make us search your post history to figure out which game you're talking about, because it actually does make a difference in this case.
__________________
Not currently working on SourceMod plugin development.
Powerlord 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 08:12.


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