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

Solved [DOD:s]How to prevent to take up arms


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mewbie222
Senior Member
Join Date: May 2018
Old 11-28-2018 , 05:01   [DOD:s]How to prevent to take up arms
Reply With Quote #1

I have a question . how can you ban raise/take weapons left after killing the player. Through item_pickup, in our game it is impossible. Is there any other way of such a ban? Look , there is a sort method through the SDK , but don't really know how to use it

Last edited by mewbie222; 12-05-2018 at 06:25. Reason: temp solved
mewbie222 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 11-29-2018 , 07:52   Re: [DOD:s]How to prevent to take up arms
Reply With Quote #2

...? If you want block players to collect weapons on ground, try use SDKHooks
__________________
Do not Private Message @me
Bacardi is offline
mewbie222
Senior Member
Join Date: May 2018
Old 11-29-2018 , 11:20   Re: [DOD:s]How to prevent to take up arms
Reply With Quote #3

Quote:
Originally Posted by Bacardi View Post
...? If you want block players to collect weapons on ground, try use SDKHooks
yes, but only on the contrary, so that they could not pick up weapons from the earth .. I just wanted to give an example for DOD:s. And I still do not understand SM much.
mewbie222 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 11-30-2018 , 09:30   Re: [DOD:s]How to prevent to take up arms
Reply With Quote #4

*edit
...here is example to block weapon pickup.
PHP Code:

char weapons
[][]=
{
    
"weapon_30cal",
    
"weapon_amerknife",
    
"weapon_bar",
    
//"weapon_basebomb",
    
"weapon_basedodgrenade",
    
"weapon_bazooka",
    
"weapon_c96",
    
"weapon_colt",
    
"weapon_dod_base",
    
"weapon_dod_base_gun",
    
"weapon_dod_base_melee",
    
"weapon_dodbaserpg",
    
"weapon_frag_ger",
    
"weapon_frag_ger_live",
    
"weapon_frag_us",
    
"weapon_frag_us_live",
    
"weapon_garand",
    
"weapon_ifm_base",
    
"weapon_ifm_base_camera",
    
"weapon_ifm_steadycam",
    
"weapon_k98",
    
"weapon_k98_scoped",
    
"weapon_m1carbine",
    
"weapon_mg42",
    
"weapon_mp40",
    
"weapon_mp44",
    
"weapon_p38",
    
"weapon_pschreck",
    
"weapon_riflegren_ger",
    
"weapon_riflegren_ger_live",
    
"weapon_riflegren_us",
    
"weapon_riflegren_us_live",
    
"weapon_smoke_ger",
    
"weapon_smoke_us",
    
"weapon_spade",
    
"weapon_spring",
    
"weapon_thompson"
}




bool block[MAXPLAYERS];

#include <sdkhooks>

public void OnPluginStart()
{
    
HookEventEx("player_spawn"player_);
    
HookEventEx("player_death"player_);
    
HookEventEx("player_team",  player_);

    for(
int i 1<= MaxClientsi++)
    {
        if(
IsClientInGame(i)) OnClientPutInServer(i);
    }
}

public 
void player_(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));

    if(
StrEqual(name"player_spawn"false))
    {
        
block[client] = true;
        return;
    }

    
block[client] = false;
}


public 
void OnClientPutInServer(int client)
{
    
SDKHookEx(clientSDKHook_WeaponCanUseWeaponCanUse);
}

public 
Action WeaponCanUse(int clientint weapon)
{
    if(!
block[client]) return Plugin_Continue;


    
char classname[MAX_NAME_LENGTH];
    
GetEntityClassname(weaponclassnamesizeof(classname));

    for(
int w 0sizeof(weapons); w++)
    {
        if(
StrEqual(weapons[w], classnamefalse))
        {
            
PrintToServer("block weapon %s"weapons[w]);
            return 
Plugin_Handled;
        }
    }

    return 
Plugin_Continue;

Maybe better way is remove players weapons when they die

Last edited by Bacardi; 11-30-2018 at 11:07. Reason: wait... not work when spawn
Bacardi is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 11-30-2018 , 10:20   Re: [DOD:s]How to prevent to take up arms
Reply With Quote #5

maybe there's a netprop m_bCanBePickedUp (I found this on csgo).

PHP Code:

public void OnPluginStart()
{
    for (
int i 1<= MaxClientsi++)
    {
        if (
IsClientInGame(i))
        {
            
OnClientPutInServer(i);
        }
    }
}

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

public 
void OnWeaponDrop_Post(int clientint weapon)
{
    
SetEntProp(weaponProp_Send"m_bCanBePickedUp"0); // or Prop_Data, if you get errors

__________________
Ilusion9 is offline
mewbie222
Senior Member
Join Date: May 2018
Old 12-05-2018 , 06:23   Re: [DOD:s]How to prevent to take up arms
Reply With Quote #6

Quote:
Originally Posted by Bacardi View Post
*edit
...here is example to block weapon pickup.

Maybe better way is remove players weapons when they die
Ok , Thank you, we will try..

Quote:
Originally Posted by Ilusion9 View Post
maybe there's a netprop m_bCanBePickedUp (I found this on csgo).
OK , Thank you, we will test...

added - after testing code Bacardi.
Tested with bots , so weapons from all the bots are gone.. I'm okay ..well there it seems still check it is necessary to add IsPlayerAlive. Here it seems to be
Quote:
if(IsClientInGame(i)& IsPlayerAlive) OnClientPutInServer (i);
an error is thrown when compiling, just in this line error 76 syntax error. and how to properly check add on" live " players and bots add then.

Last edited by mewbie222; 12-05-2018 at 06:47. Reason: temp - solved
mewbie222 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 12-05-2018 , 08:29   Re: [DOD:s]How to prevent to take up arms
Reply With Quote #7

I noticed in DOD:S, dropped weapons will disappear in spawn area. When move out from spawn those weapons should stay, but again shortly. Could there be cvar for this ?

---
Those specific players, who you want block weapon pickup, you need once SDKHook them.
- So you hook player when he is entering in server (OnClientPutInServer(client)).
- If you load/reload plugin (late load), that loop in OnPluginStart() hook players again, not need change level everytime

You not need IsPlayerAlive(client) in hookin process, but maybe somewhere else in plugin source code.




*edit
here is dump files of entity properties.
Attached Files
File Type: zip dods_entity_props.zip (205.4 KB, 104 views)
__________________
Do not Private Message @me

Last edited by Bacardi; 12-05-2018 at 08:34.
Bacardi is offline
mewbie222
Senior Member
Join Date: May 2018
Old 12-05-2018 , 08:43   Re: [DOD:s]How to prevent to take up arms
Reply With Quote #8

Now it seems there is already a cvar to disappearing guns , although I was looking for but never found . But the weapon is lost Yes , but not immediately and within minutes. That is , it is very long, that is, a live player can pick it up . A glitch , after starting the server - check on your server launch the server with the plugin.And then, already all the bots were without weapons, that is, from the beginning. And I have a gun - this is all OK . That is here is that it removes the weapons from all the bots after a respawn or the start of the round - probably so. OK I'll try to add validation somewhere else .. Thank you I will try . Sorry for bad English. Thank you , I will experiment !!!

Add : Bacardi,thank you for the additional information..

Last edited by mewbie222; 12-06-2018 at 05:51.
mewbie222 is offline
mewbie222
Senior Member
Join Date: May 2018
Old 02-20-2019 , 09:43   Re: [DOD:s]How to prevent to take up arms
Reply With Quote #9

I have a question for the pros , and if you just off. 1(primary,main slot), whether there will be lags and other problems in the plugin .Would like here https://github.com/zadroot/DoD_Bonus...ng/dod_bres.sp add to could not polymath weapons.
And the second question based on the first question, whether it is necessary to prescribe on. the main primary slot ?
Maybe it will be easier and less difficult !

Last edited by mewbie222; 02-20-2019 at 09:47.
mewbie222 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 05:11.


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