Raised This Month: $51 Target: $400
 12% 

[CS:GO] Team Logo Manager 1.4.2 [2016.04.09]


Post New Thread Reply   
 
Thread Tools Display Modes
decowboy
AlliedModders Donor
Join Date: Oct 2015
Location: Guadalajara, Mexico
Old 02-27-2016 , 18:30   Re: [CS:GO] Team Logo Manager 1.3.1 [26.04.2015]
Reply With Quote #111

I hadn't considered the scenario of someone manually setting mp_teamlogo_* to a certain value, the auto team function overriding it and then, when a player whose clan tag is different joins, the auto team function setting it to blank, where one might want it to revert to the value that was initially set manually.

Your solution makes a lot of sense.

If we would cache the value of mp_teamlogo_* before the auto team function changes it, then it would indeed be perfect if the auto team function would revert the value from cache when a player with a different clan tag joins.

That same cache would come in handy if someone decides to change teamlogo_autologos from 1 to 0. It would make sense if that would revert the value of mp_teamlogo_* from cache, instead of the auto team function just stopping to update it.

EDIT: I just implemented the proposed solution and made a merge request. I am fairly confident the code should do its job, but I don't have access to my private server right now, so I wasn't able to properly test it. Looking forward to hearing your thoughts on the matter.

Last edited by decowboy; 02-27-2016 at 19:00. Reason: merge request
decowboy is offline
decowboy
AlliedModders Donor
Join Date: Oct 2015
Location: Guadalajara, Mexico
Old 02-27-2016 , 19:09   Re: [CS:GO] Team Logo Manager 1.3.1 [26.04.2015]
Reply With Quote #112

I missed a tiny part of code that should've been changed. Perhaps you could take care of this and save me yet another merge request :)

On line 136:
PHP Code:
    else if (cvar == g_hAutoLogos)
    {
        
g_bAutoLogos StringToInt(newVal) == false true;
        if (
g_bAutoLogos)
        {
            
SetTeamAutoLogo(CS_TEAM_CT);
            
SetTeamAutoLogo(CS_TEAM_T);
        }
    } 
This should be changed to:

PHP Code:
    else if (cvar == g_hAutoLogos)
    {
        
g_bAutoLogos StringToInt(newVal) == false true;
        
SetTeamAutoLogo(CS_TEAM_CT);
        
SetTeamAutoLogo(CS_TEAM_T);
    } 
The if-statement used to be neccesary, but it isn't anymore since SetTeamAutoLogo now also takes care of reverting the logo to the cached value, which would be desirable when g_bAutoLogos changes to false.
decowboy is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 02-27-2016 , 20:31   Re: [CS:GO] Team Logo Manager 1.3.1 [26.04.2015]
Reply With Quote #113

Nice,

I'm just doing updates on my bhop server atm. I'll dive into it shortly for you

Sounds we are are almost done!
__________________
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 02-27-2016 , 22:17   Re: [CS:GO] Team Logo Manager 1.3.1 [26.04.2015]
Reply With Quote #114

Ok, a couple more updates around when caching occurs.

This should hopefully be the final one.

https://github.com/ntoxin66/CSGO-Tea...ager/tree/pr/5
__________________
Neuro Toxin is offline
decowboy
AlliedModders Donor
Join Date: Oct 2015
Location: Guadalajara, Mexico
Old 02-28-2016 , 05:39   Re: [CS:GO] Team Logo Manager 1.3.1 [26.04.2015]
Reply With Quote #115

I must say the code is looking fine indeed. :)

I am still not able to properly test the plugin, as my private server is usually empty. That's because my server is so super awesome, that a lot of players don't dare to join. No, that's a lie. I just don't have a lot of friends.

Anyhow.

I get what you did there with removing the two booleans, as that makes the code a bit more elegant. I fear it re-introduced a bug though. I am not able to reproduce the bug as I would need more players in my server, so perhaps you could have a look at the code with me:
In the case where teamlogo_randomlogos is set to 0, the initial values of mp_teamlogo_* will be "" (empty string). Say a players joins CT. The auto team logo function will now set mp_teamlogo_1 to a certain logo and the cache of mp_teamlogo_1 will be set to "" (empty string).

Now another player joins CT, but with a different clan tag. The auto team logo function will notice that the clan tags in CT no longer match and will attempt to restore the value of mp_teamlogo_1 from cache. Seems fine.

But since the cache of mp_teamlogo_1 is "" (empty string), the restore team logo function will (incorrectly) think that there is no cache to be restored. Because of this, mp_teamlogo_1 will remain to be the logo of that first player's clan, where it should actually be set to "" (empty string).

My proposed solution would be to re-introduce the booleans, but perhaps you'd prefer another workaround.
decowboy is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 02-28-2016 , 07:23   Re: [CS:GO] Team Logo Manager 1.3.1 [26.04.2015]
Reply With Quote #116

When the cache is being restored.

If the cache is empty and teamlogo_randomlogos is 0. Force the logo to "".
__________________
Neuro Toxin is offline
decowboy
AlliedModders Donor
Join Date: Oct 2015
Location: Guadalajara, Mexico
Old 02-28-2016 , 07:54   Re: [CS:GO] Team Logo Manager 1.3.1 [26.04.2015]
Reply With Quote #117

EDIT:

Unfortunately, that would create a new bug.

Let's say teamlogo_randomlogos is set to 0, but the server admin manually sets mp_teamlogo_1 to some value. A player joins CT, so mp_teamlogo_1 is automatically updated and the previous value will be cached. Now, let's say another players joins CT with a different clan tag. At first this will restore mp_teamlogo_1 to the cached value, which is correct. But that will also clear the cache. On the next player spawn, disconnect or team change, the cache will be empty and teamlogo_randomlogos will still be 0. This will force the logo to "" (empty string), which is incorrect. It should've stayed at the manually set value (which was previously restored from cache).

We either need to change the way the cache is cleared or re-introduce the booleans, it seems.

Last edited by decowboy; 02-28-2016 at 08:31.
decowboy is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 02-29-2016 , 04:31   Re: [CS:GO] Team Logo Manager 1.3.1 [26.04.2015]
Reply With Quote #118

Try this one on for size.

https://github.com/ntoxin66/CSGO-Tea...ager/tree/pr/5

Caching occurs on the team logo cvar changes. However, you can see the flag to block caching.

This flag is inside your code to stop any auto team logo values from caching.

The caching restoration doesn't discriminate anymore. It just always does it's thing.
__________________

Last edited by Neuro Toxin; 02-29-2016 at 04:34.
Neuro Toxin is offline
decowboy
AlliedModders Donor
Join Date: Oct 2015
Location: Guadalajara, Mexico
Old 02-29-2016 , 04:37   Re: [CS:GO] Team Logo Manager 1.3.1 [26.04.2015]
Reply With Quote #119

I just did a merge request, but it seems that at the same time you already updated the code with your own solution.
Went ahead with the merge request anyway, but perhaps you've already fixed it. I'll have a look.
decowboy is offline
decowboy
AlliedModders Donor
Join Date: Oct 2015
Location: Guadalajara, Mexico
Old 02-29-2016 , 04:47   Re: [CS:GO] Team Logo Manager 1.3.1 [26.04.2015]
Reply With Quote #120

It's a very elegant solution you implemented.
As far as I can tell this would work smoothly. :)
decowboy 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 07:26.


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