DoD Plugins

Go Back   DoD Plugins > General > Requests for DoD Plugins

Requests for DoD Plugins Here you can ask nicely to get something you want as a plugin made...this may or may not be answered! So be patient!

» Navigation
 > FAQ
» Forum Actions
» Programming
 > VERC
» Server Links
For Linking to Us
AvaMods
=|[76AD]|=
GameSpy Rangers
{DFH} Clan
AMX Mod X
Reply
 
Thread Tools Display Modes
  #1  
Old 03-14-2008, 11:46 PM
Eleven0 Eleven0 is offline
Junior Member
 
Join Date: Apr 2007
Posts: 22
No nades on certain maps

I want to get rid of nades on certain maps. Is there a plugin to restrict nades?

I have "One weapon mod", but this gets rid of knife and pistol too.
Reply With Quote
  #2  
Old 04-15-2008, 09:20 AM
Vet's Avatar
Vet Vet is offline
Senior Member
 
Join Date: Oct 2006
Posts: 229
Try this...

Code:
#include <amxmisc> #include <fakemeta> #include <dodfun> #define PLUGIN "DOD_NoNades" #define VERSION "0.9" #define AUTHOR "Vet(3TT3V)" #define HAND_BIT (1 << DODW_HANDGRENADE) #define STICK_BIT (1 << DODW_STICKGRENADE) new g_enabled = 0 new g_mapnames[][] = { "dod_frenzy", "dod_crazyjump", "dod_rennes_b2" } public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_event("ResetHUD", "player_spawn", "be") new mapname[32] get_mapname(mapname, 31) for (new i = 0; i < sizeof g_mapnames; i++) { if (equali(mapname, g_mapnames[i])) { g_enabled = 1 break } } } public player_spawn(id) { if (g_enabled) { new pevdata = pev(id, pev_weapons) if (get_user_team(id) == ALLIES) { set_pev(id, pev_weapons, pevdata & ~HAND_BIT) dod_set_user_ammo(id, DODW_HANDGRENADE, 0) client_cmd(id, "weapon_handgrenade;lastinv") } else { set_pev(id, pev_weapons, pevdata & ~STICK_BIT) dod_set_user_ammo(id, DODW_STICKGRENADE, 0) client_cmd(id, "weapon_stickgrenade;lastinv") } } }

Just replace/add the maps (varable g_mapnames) with the ones you want.
__________________
=====================================
- My Plugins -
=====================================

Last edited by Vet; 04-27-2008 at 11:40 PM.
Reply With Quote
  #3  
Old 04-15-2008, 11:11 AM
Wilson [29th ID]'s Avatar
Wilson [29th ID] Wilson [29th ID] is offline
developer
Developer
 
Join Date: Oct 2005
Location: London
Posts: 623
Great plugin Vet. Interesting that you have it subtracting the bit though. I've always used wpnbits & ~DODW_HANDGRENADE etc. Did you know about that and just find this a better method?
Reply With Quote
  #4  
Old 04-15-2008, 11:51 AM
Vet's Avatar
Vet Vet is offline
Senior Member
 
Join Date: Oct 2006
Posts: 229
I have trouble getting that bit shi(f)t stuff through my thick skull. But one question, wouldn't
wpnbits & ~DODW_HANDGRENADE
clear bits 8, 4 and 1 (13)? Shouldn't I use something like...
#DEFINE HAND_BIT (1 << DODW_HANDGRENADE)
wpnbits & ~HAND_BIT
???
Not sure. Like I said, bits give me headaches.

Also, I was thinking it may be wise to clear the pdata for the nades too, just in case. Because this method doesn't eliminate the nades, it only keeps you from selecting them. So I should probably add ...
dod_set_user_ammo(id, DODW_HANDGRENADE, 0) and
dod_set_user_ammo(id, DODW_STICKGRENADE, 0)
to the routines. I know that if you use my dod_deathnades plugin with this, it will still drop the nades.

I'll whip up a version that uses a .cfg for the applicable maps too. Make it sweeter.
__________________
=====================================
- My Plugins -
=====================================

Last edited by Vet; 04-15-2008 at 08:24 PM.
Reply With Quote
  #5  
Old 04-15-2008, 08:01 PM
Vet's Avatar
Vet Vet is offline
Senior Member
 
Join Date: Oct 2006
Posts: 229
Found and fixed a couple glitches, You DO have to set the grenade ammo pdata to 0. Otherwise a clever player could still select a grenade by using the command weapon_handgrenade or weapon_stickgrenade. Also, while this prevented using grenades, it still produced a 'no-weapon' screen if the player used those commands. So I stuck in a quick-switch to update the game info. The above code has been updated to reflect these changes as well as implementing Wilson's weapon bit manipulation.

EDIT:
Subsequent testing showed that when using a quick-switch to update the game info, you don't need to set the pev_weapons. Just setting the ammo and switching is good enough.
__________________
=====================================
- My Plugins -
=====================================

Last edited by Vet; 04-15-2008 at 10:51 PM.
Reply With Quote
  #6  
Old 04-15-2008, 08:54 PM
Wilson [29th ID]'s Avatar
Wilson [29th ID] Wilson [29th ID] is offline
developer
Developer
 
Join Date: Oct 2005
Location: London
Posts: 623
hmm..the client_cmd() stuff seems a bit unreliable because lag will delay it..isn't sending those cmd's simply activating a CurWeapon that tells the client he "ain't got no nades"? Why not just send the CurWeapon?

This is just semantics - the plugin works fine I'm sure...just interested in the most efficient way as it seems you are :P
Reply With Quote
  #7  
Old 04-15-2008, 10:17 PM
Vet's Avatar
Vet Vet is offline
Senior Member
 
Join Date: Oct 2006
Posts: 229
Quote:
isn't sending those cmd's simply activating a CurWeapon that tells the client he "ain't got no nades"?

I don't know. You would probably know better then me. I didn't notice any detectable lag when testing it. But in the interest of saving a few mils, I included the 'lastinv' with the command.

Quote:
Why not just send the CurWeapon?

Would that be faster? If so, I'd gladly do it that way.

Quote:
This is just semantics - the plugin works fine I'm sure...just interested in the most efficient way as it seems you are :P

Always. And I appreciate the input. If you come up with anything else, let me know. I'll dink around with it a little more and see what happens.

Also, I figure it might be wise to leave those pev_weapons statements in there, 'just in case'.
__________________
=====================================
- My Plugins -
=====================================

Last edited by Vet; 04-15-2008 at 10:49 PM.
Reply With Quote
  #8  
Old 04-15-2008, 11:40 PM
Vet's Avatar
Vet Vet is offline
Senior Member
 
Join Date: Oct 2006
Posts: 229
I tried it by sending CurWeapon message(s). But it only updated the HUD. It didn't actually switch the weapons. Either that or I didn't do it right.
__________________
=====================================
- My Plugins -
=====================================
Reply With Quote
  #9  
Old 04-16-2008, 10:53 AM
Wilson [29th ID]'s Avatar
Wilson [29th ID] Wilson [29th ID] is offline
developer
Developer
 
Join Date: Oct 2005
Location: London
Posts: 623
If you check out my Custom Supply plugin, which was quite effective at removing nades and making them unselectable, it does:

1. A basic dod_set_user_ammo() for nades to 0
2. Sends an AmmoX message to have 0 backpack ammo (pretty sure this is done when you do the client_cmd() we were takling about)
PHP Code:
    message_begin(MSG_ONE,get_user_msgid("AmmoX"),{0,0,0},id);
    
write_byte(AMMO_GREN);
    
write_byte(0);
    
message_end(); 

3. Uses a remove_weapon() stock to stop nades from being selected

PHP Code:
stock remove_weaponidwpnid ) {
    new 
m_bitmask pevidpev_weapons );
    
m_bitmask &= ~(1<<wpnid);
    
    
set_pevidpev_weaponsm_bitmask );


Reply With Quote
  #10  
Old 04-16-2008, 02:00 PM
Vet's Avatar
Vet Vet is offline
Senior Member
 
Join Date: Oct 2006
Posts: 229
Oh OK. I thought you meant to send a CurWeapon message. I'll do the Ammox thing and see how it goes.
__________________
=====================================
- My Plugins -
=====================================
Reply With Quote
Reply

Bookmarks

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Nades plogan64 Requests for DoD Plugins 6 11-24-2009 12:58 AM

» Donations
If you like this website, and would like to give something in return, you can make a donation. Your donation will be used to pay for hosting service, domain, & maintenance costs only!

$

Select your donation amount and then press the Donate button.




» Log in
User Name:

Password:

Not a member yet?
Register Now!
Powered by vBadvanced CMPS v3.2.3

All times are GMT -3. The time now is 01:33 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
dodplugins.net