CurWeapon jitter
I wrote a quickie plugin for knives-only for DOD and it works for almost all players. But a few players can circumvent the plugin by quickly switching weapons back and forth. Its like the CurWeapon event isn't being caught and processed every time for them. So the code works. But a few players can trick it somehow. I've tried various combinations of event conditions, and tried putting a weapon check in the event function, but none of that made any difference. Any ideas why?
Code:
|
Re: CurWeapon jitter
why not just download the knifes only plugin? well if they shoot the other weapon they are gona switch to knife again, curweapon doesnt catch all when the switch really fast
|
Re: CurWeapon jitter
I am supprised this line compiled, you have an unterminated string...
Code:
|
Re: CurWeapon jitter
Replace
client_cmd(id, "weapon_knife") by engclient_cmd(id, "weapon_knife") |
Re: CurWeapon jitter
Quote:
ones through cmd and ones through client's engine or something right? |
Re: CurWeapon jitter
Ya, the example code was just hand typed in and is not the actual code I'm using. Its just a representation for my question.
The whole point isn't the code itself. The point is, that a few players in the game are able to exploit/circumvent the CurWeapon event by quickly switching weapons back and forth with invprev, or continually pressing a gun key. Quote:
|
Re: CurWeapon jitter
A much better method would be to alter the pev_weapons variable. Use the following stock to "remove" the weapons from the variable:
Code:
For what you want to do, however, since all you want is a knife for any class, I would alter the pev_weapons bitmask to only include DODW_AMERKNIFE (if british or american) or DODW_GERKNIFE / DODW_SPADE (if axis) and simply set the variable to that bitmask. This way you won't have to worry about sending client commands and switching weapons and risking a "reach-around" - it prevents the client from pulling out the weapon in the first place. For a very basic example: Code:
Then allow_weapon( id, DODW_AMERKNIFE ) if the player is allies, etc. |
Re: CurWeapon jitter
I had no idea you could do such a thing! Thanks for posting that Wilson :D
|
Re: CurWeapon jitter
That's a good idea. I'll give it a try.
Currently, since the other method didn't work perfectly, I used fm_strip_user_weapons and fm_give_item to accomplish it. And all worked great. But then, another problem popped up. The players were still able to pick up weapons on the ground left by dead players. OK, so I added a routine to remove the dead weapons when touched. Everything was honky-dorey when tested on a listen server. But to my dismay, after being installed on the game server, the strip function would not act on a live player if the plugin was enabled mid-game. I checked for plugin contention, but couldn't find anything obvious. So Wilson, in your opinion, can the CurWeapon event be a bit iffy at times? |
Re: CurWeapon jitter
If I understood Wilson correctly, removing a weapon from the player's bit mask disables the player from accessing that weapon altogether.
I think this would work, using Wilson's suggestion. (It's probably not the best or most efficient way, though.) PHP Code:
|
| All times are GMT -4. The time now is 21:30. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.