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

[CS:GO] Always Weapon Skins [2.2.8 :: 2018.12.09]


Post New Thread Reply   
 
Thread Tools Display Modes
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 11-27-2014 , 17:26   Re: [CS:GO] Always Weapon Skins [1.6 :: 28.08.2014]
Reply With Quote #51

Your best running the extension on your server.

Make sure sourcemod is upto date (latest stable snapshot) and you have updated the gamedata for the extension (in first post)


edit: The update below should fix it for you.
__________________

Last edited by Neuro Toxin; 12-11-2014 at 07:03.
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 12-11-2014 , 07:01   Re: [CS:GO] Always Weapon Skins [1.7 :: 12.11.2014]
Reply With Quote #52

Version 1.7 Released
- Added cvar 'aws_enable' to disable/enable plugin
- Added cvar 'aws_delay' which delays the weapon respawn
- Added support for sm_hosties - Players in last request wont have their weapons replaced

If you run other plugins that process weapon equipping, this plugin may causes unexpected crashes. If you turn aws_delay to 0.1 or higher, this should stop any conflictions.
__________________
Neuro Toxin is offline
Root_
Veteran Member
Join Date: Jan 2012
Location: ryssland
Old 12-11-2014 , 08:31   Re: [CS:GO] Always Weapon Skins [1.7 :: 12.11.2014]
Reply With Quote #53

I really think code is too complicated. Also #include <lastrequest> is optional I guess,but without that you cant recompile plugin. You may use static instead of some global variables (like ProcessingClientWeapons). There's alot of things I would change, so I better just leave it here as example.
Spoiler
__________________


dodsplugins.com - Plugins and Resources for Day of Defeat
http://twitch.tv/zadroot
Root_ is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 12-11-2014 , 15:41   Re: [CS:GO] Always Weapon Skins [1.7 :: 12.11.2014]
Reply With Quote #54

Thanks for your feedback.

Your example is almost identical to the first version of this plugin minus the trie.

This is what I got from your feedback.

* static the client processing list
* use a trie to hold the weapon teams
* remove optional mark for lastrequest as its required

I would also like to point out that how your timer and process list is setup in your example. Only one gun can process at a time. This means if one had a shop with auto buy, only one weapon would replace if multiple weapons are purchased in the same frame. This makes your example look simple when comparing to this plugin.
__________________
Neuro Toxin is offline
Root_
Veteran Member
Join Date: Jan 2012
Location: ryssland
Old 12-11-2014 , 17:35   Re: [CS:GO] Always Weapon Skins [1.7 :: 12.11.2014]
Reply With Quote #55

Player receives weapon only once at its spawn. Since multiple weapons can be created/spawned/purchased at same frame (like multipurchase) a multiple callbacks will be called as well. So its fine when you buy/pick/whatever multiple weapons at a time. As of the LastPlayerWeapon string, if callback is fired twice and weapon is same as previous, it means weapon was already changed, so it clears the LPW string and stops weapon replacing process... again for every weapon, independent on its time receiving. Also GetTeamName(2/3) returns T/CT names appropriately, so you can not change weapon configs and use some optimizations further. I can add comments to my example so it will be more clear if you want.
__________________


dodsplugins.com - Plugins and Resources for Day of Defeat
http://twitch.tv/zadroot
Root_ is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 12-11-2014 , 18:26   Re: [CS:GO] Always Weapon Skins [1.7 :: 12.11.2014]
Reply With Quote #56

Thanks for feedback.

Ill do some testing and changes based on this.
__________________
Neuro Toxin is offline
h3bus
AlliedModders Donor
Join Date: Nov 2013
Old 12-12-2014 , 02:47   Re: [CS:GO] Always Weapon Skins [1.7 :: 12.11.2014]
Reply With Quote #57

Also for optimizations and code clarity you could always use m_iItemDefinitionIndex to identify a weapon (instead of using string comparison which are slower).
The optimization is really tiny though compared to the cost of spawning a new weapon.
h3bus is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 12-12-2014 , 19:55   Re: [CS:GO] Always Weapon Skins [1.7 :: 12.11.2014]
Reply With Quote #58

Quote:
Originally Posted by Root_ View Post
Also #include <lastrequest> is optional I guess,but without that you cant recompile plugin.
It's optional because if it's not marked this way, the plugin wont start without sm_hosties. It's got nothing to do with compilation without the lastrequest include file. For this reason, the lastrequest include file is part of the download.

Quote:
Originally Posted by Root_ View Post
You may use static instead of some global variables (like ProcessingClientWeapons).
ProcessingClientWeapons needs to be cleaned if a client disconnects while the timer is awaiting callback. For this reason, it CANT be static as in my code, PutClientInServer wont have access to clean the process list.

Quote:
Originally Posted by Root_ View Post
it means weapon was already changed, so it clears the LPW string and stops weapon replacing process... again for every weapon, independent on its time receiving.
I added debug messages to your example. This is what came back with multiple purchases at once.

Code:
[AWS] Timer_OnClientReceive(): client=3, classname=weapon_ak47
[AWS] Switching for class 'weapon_ak47'
[AWS] Timer_OnClientReceive(): client=3, classname=weapon_glock
[AWS] Switching for class 'weapon_glock'
[AWS] Timer_OnClientReceive(): client=3, classname=weapon_glock
[AWS] Completed switch for class 'weapon_glock'
[AWS] Timer_OnClientReceive(): client=3, classname=weapon_ak47
[AWS] Switching for class 'weapon_ak47'
[AWS] Timer_OnClientReceive(): client=3, classname=weapon_ak47
[AWS] Completed switch for class 'weapon_ak47'
You can see this doesn't work as you intend. The AK is added first and then the Glock. You can see the Glock completes first and wipes the current processing weapon for the AK. So when the AK comes back it starts the replacement again.

My Comments

With all this said, I'm still taking your advise on using Trie's, however, the complexity you talk about is all required. I started off with something similar to your example and I've had to make it more complex then your example for it to work as intended.

I will be releasing a new version soon with some updates based on your feedback, however, It's still going to be complex.

Also note that using OnEntityCreated followed by a timer was causing issues (server crashes in rare instances) over the round restarting. This is why we opt'd for OnPostWeaponEquip as you are guaranteed to have the correct client, and the weapon hasn't magically disappeared.

I do notice in your example the use of EntRefToEntIndex which could have been the causes of our previous crashes. Either way, if the cvar for the delay is enabled, I now use EntRefToEntIndex when passing the weapon through the timer.
__________________
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 12-13-2014 , 19:57   Re: [CS:GO] Always Weapon Skins [1.7 :: 12.11.2014]
Reply With Quote #59

Quote:
Originally Posted by h3bus View Post
Also for optimizations and code clarity you could always use m_iItemDefinitionIndex to identify a weapon (instead of using string comparison which are slower).
The optimization is really tiny though compared to the cost of spawning a new weapon.
I attempted to use m_iItemDefinitionIndex instead of a classname. However: Map weapons on some maps do not have a definition index and I would to need to complete a classname lookup for the plugin to work properly.

For this reason, I have decided to keep everything class based otherwise I break the cvar functionality for aws_alwaysreplace.
__________________
Neuro Toxin is offline
Root_
Veteran Member
Join Date: Jan 2012
Location: ryssland
Old 12-16-2014 , 13:43   Re: [CS:GO] Always Weapon Skins [1.7 :: 12.11.2014]
Reply With Quote #60

Quote:
Originally Posted by Neuro Toxin View Post
It's optional because if it's not marked this way, the plugin wont start without sm_hosties. It's got nothing to do with compilation without the lastrequest include file. For this reason, the lastrequest include file is part of the download.
Use #tryinclude <hosties>, and check #ifdef hosties_included_ with #endif on hosties code, so everyone can compile plugin without hosties stuff.
Quote:
Originally Posted by Neuro Toxin View Post
ProcessingClientWeapons needs to be cleaned if a client disconnects while the timer is awaiting callback. For this reason, it CANT be static as in my code, PutClientInServer wont have access to clean the process list.
Quote:
Originally Posted by Neuro Toxin View Post
I added debug messages to your example. This is what came back with multiple purchases at once.

You can see this doesn't work as you intend. The AK is added first and then the Glock. You can see the Glock completes first and wipes the current processing weapon for the AK. So when the AK comes back it starts the replacement again.
Have you really tested that plugin ingame? It works perfectly for me, otherwise I would not give false suggestions.
Quote:
Originally Posted by Neuro Toxin View Post
Also note that using OnEntityCreated followed by a timer was causing issues (server crashes in rare instances) over the round restarting. This is why we opt'd for OnPostWeaponEquip as you are guaranteed to have the correct client, and the weapon hasn't magically disappeared.
I havent met any crashes for like 1 year with this code, and OEC is way clearer than OnPostEquip IMO.
__________________


dodsplugins.com - Plugins and Resources for Day of Defeat
http://twitch.tv/zadroot
Root_ 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 06:13.


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