Raised This Month: $170 Target: $400
 42% 

Snark Glitch Fix 1.15


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Sven Coop        Category:   Server Management        Approver:   Emp` (115)
CubicVirtuoso
Senior Member
Join Date: Sep 2004
Location: Canada
Old 01-18-2007 , 22:10   Snark Glitch Fix 1.15
Reply With Quote #1

This is a quick plugin for SvenCoop that fixes the snark glitch. I will not describe here how to USE the snark glitch, but I can say for sure
it has been fixed. However; I'm surprised this hasn't been done by anyone else yet. This bug in SvenCoop has been around since 3.0 and should be fixed when 3.5 comes out. As soon as 3.5 comes out this plugin will be not needed and I will pull it from AMXX.



Commands:

None



CVARS:

None



Notes:

a) I'm not sure how much resources this plugin would take up. It checks the users weapon quite frequently.

b) Most of everything you see here was taken from: http://forums.alliedmods.net/showthread.php?t=41265 I just added the conditionals



Version Notes:

1.00 : Initial Release
1.1 : Code optimization as per request.
1.15 : More optimization
Attached Files
File Type: sma Get Plugin or Get Source (snarkfix.sma - 1368 views - 1.9 KB)
__________________
Sig Under Construction.

Last edited by CubicVirtuoso; 01-20-2007 at 13:36.
CubicVirtuoso is offline
Send a message via ICQ to CubicVirtuoso Send a message via AIM to CubicVirtuoso Send a message via MSN to CubicVirtuoso Send a message via Yahoo to CubicVirtuoso
VEN
Veteran Member
Join Date: Jan 2005
Old 01-19-2007 , 07:54   Re: Snark Glitch Fix
Reply With Quote #2

Hints:

1. It's possible to omit weapon index dynamical retrieval:
Code:
// from HLSDK #define WEAPON_SNARK   15

2. It's possible to use a static variables declaration to increace performance especially in an intensive code areas. You migh be interested in review of the folowing article: http://wiki.amxmodx.org/index.php/Optimizing_Plugins

3. It's possible to use only fakemeta instead of fakemeta and engine.

4. It's possible to shorten the block of code
Code:
if (wid != WPN_SNK)         return PLUGIN_CONTINUE if (wammo != 0)         return PLUGIN_CONTINUE if(!is_user_alive(id))         return PLUGIN_CONTINUE
to
Code:
if (wid != WPN_SNK || wammo || !is_user_alive(id))         return PLUGIN_CONTINUE
I'd not say that it's more efficient and this is not the case but i believe that in some of the cases it could increase a readability.
VEN is offline
CubicVirtuoso
Senior Member
Join Date: Sep 2004
Location: Canada
Old 01-19-2007 , 08:53   Re: Snark Glitch Fix
Reply With Quote #3

Ok Its updated and I optimized the things you asked for. However I have to use engine for the following line:

entity_set_int(id, EV_INT_button, entity_get_int(id,EV_INT_button) & ~IN_ATTACK);

Thanks for the input.
__________________
Sig Under Construction.
CubicVirtuoso is offline
Send a message via ICQ to CubicVirtuoso Send a message via AIM to CubicVirtuoso Send a message via MSN to CubicVirtuoso Send a message via Yahoo to CubicVirtuoso
VEN
Veteran Member
Join Date: Jan 2005
Old 01-19-2007 , 10:30   Re: Snark Glitch Fix 1.1
Reply With Quote #4

Let me clear this up a bit. I didn't asked or requested for any changes or updates. It is just a useful information that may help you to improve your plugin if you interested.

Also a hint: there is nothing in engine that fakemeta can't do.

And as i can see you misiterpreted the first hint. I didn't meant to hardcode the weapon index like that. You have to define the value like shown above and then use a defined marco constant when it's necessary.

Last edited by VEN; 01-19-2007 at 10:44.
VEN is offline
CubicVirtuoso
Senior Member
Join Date: Sep 2004
Location: Canada
Old 01-19-2007 , 10:40   Re: Snark Glitch Fix 1.1
Reply With Quote #5

Quote:
Originally Posted by VEN View Post
Let me clear this up a bit. I didn't asked or requested for any changes or update. It is just a useful information that may help you to improve your plugin if you interested.

Also a hint: there is nothing in engine that fakameta can't do.

And as i can see you misiterpreted the first hint. I didn't meant to hardcode the weapon index like that. You have to define the value like shown above and then use the definition marco constant when it's necessary.
I know you didn't request it but they were good suggestions so I did them

http://www.amxmodx.org/funcwiki.php?..._int&go=search Says that entity_set_int is only in engine, also when I tried compiling without engine it sayed entity_set_int not found etc.

I know I can just simply use the define included in the includes but I'd rather just use the hardcoded number. If we are talking optimization then it would save fractions of milliseconds.
__________________
Sig Under Construction.
CubicVirtuoso is offline
Send a message via ICQ to CubicVirtuoso Send a message via AIM to CubicVirtuoso Send a message via MSN to CubicVirtuoso Send a message via Yahoo to CubicVirtuoso
jim_yang
Veteran Member
Join Date: Aug 2006
Old 01-19-2007 , 10:49   Re: Snark Glitch Fix 1.1
Reply With Quote #6

set_pev(id, pev_button, pev(id, pev_button) & ~IN_ATTACK)
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 01-19-2007 , 11:23   Re: Snark Glitch Fix 1.1
Reply With Quote #7

Quote:
entity_set_int is only in engine
You a correct here, while the fakemeta module have an equivalent natives. pev are similar to entity_get_* natives and set_pev are similar to entity_set_* natives.

Here is how you would use that natives:
Code:
new owner = pev(ent, pev_owner) // get an integer set_pev(ent, pev_owner, owner) // set an integer   new classname[32] pev(ent, pev_classname, classname, 31) // get a string set_pev(ent, pev_classname, classname) // set a string   new Float:float_ pev(ent, pev_health, float_) // get a float set_pev(ent, pev_health, float_) // set a float   new Float:origin[3] pev(ent, pev_origin, origin) // get a vector set_pev(ent, pev_origin, origin) // set a vector

I would highly not recommend to hardcode such common constants as weapon indeces. It is complicate reading of the code. You rather should define the constant once as shown above and then operating with the constant name, not the value itself. For example: if (MY_CONSTANT != something) // ... You should note that this will not affect the performance at all.
VEN is offline
CubicVirtuoso
Senior Member
Join Date: Sep 2004
Location: Canada
Old 01-19-2007 , 11:28   Re: Snark Glitch Fix 1.1
Reply With Quote #8

OK, sounds great, I'll fix those things when I get home then. At work right now.
__________________
Sig Under Construction.
CubicVirtuoso is offline
Send a message via ICQ to CubicVirtuoso Send a message via AIM to CubicVirtuoso Send a message via MSN to CubicVirtuoso Send a message via Yahoo to CubicVirtuoso
liv3d
SourceMod Donor
Join Date: Oct 2006
Old 01-20-2007 , 09:58   Re: Snark Glitch Fix 1.1
Reply With Quote #9

Quote:
Originally Posted by CubicVirtuoso View Post
This is a quick plugin for SvenCoop that fixes the snark glitch. I will not describe here how to USE the snark glitch, but I can say for sure it has been fixed. However; I'm surprised this hasn't been done by anyone else yet.
Hi,
This has been done before, a quick search of the plugins forum's would have told you so.

http://forums.alliedmods.net/showthr...ighlight=snark

Yes, I know its in the "Unapproved" section, but it was still done before this plugin, good luck on getting this Approved.
__________________
[MPUK]liv3d

I work for Multiplay any words are however, my own
liv3d is offline
CubicVirtuoso
Senior Member
Join Date: Sep 2004
Location: Canada
Old 01-20-2007 , 13:36   Re: Snark Glitch Fix 1.1
Reply With Quote #10

Updated with more optimization as per request.

Quote:
Yes, I know its in the "Unapproved" section, but it was still done before this plugin, good luck on getting this Approved.
Well I know mine works 100 percent so I hope it gets approved, this is a very useful asset to all SvenCoop server hosters. I'm trying to get sniper to post something on svencoop.com about this plugin.
__________________
Sig Under Construction.
CubicVirtuoso is offline
Send a message via ICQ to CubicVirtuoso Send a message via AIM to CubicVirtuoso Send a message via MSN to CubicVirtuoso Send a message via Yahoo to CubicVirtuoso
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 19:05.


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