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

[L4D1 & L4D2] Votekick - no black screen (Coop & Versus)


Post New Thread Reply   
 
Thread Tools Display Modes
alliedfront
Junior Member
Join Date: Jan 2024
Location: Germany
Old 01-30-2024 , 13:46   Re: [L4D1 & L4D2] Votekick (no black screen)
Reply With Quote #51

Quote:
Originally Posted by Dragokas View Post
@alliedfront, looks fine. Much thanks!
I just did optimizations. Please, check in production.

1st post is updated. Not tested.
@Dragokas, with pleasure! I tested 3.1 on my test server and found some bugs + did a small clarification in the text about a cfg variable. Also did a small grammatical correction in the translation file. Attached are the two fixed files + diffs to 3.1. I will now also activate it on my live server.
Attached Files
File Type: sp Get Plugin or Get Source (l4d_votekick.sp - 19 views - 40.4 KB)
File Type: txt l4d_votekick.phrases.txt (4.5 KB, 10 views)
File Type: txt diff_l4d_votekick_3.1_fixed.txt (3.2 KB, 12 views)
File Type: txt diff_l4d_votekick.phrases_3.1_fixed.txt (310 Bytes, 10 views)
alliedfront is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 01-30-2024 , 13:49   Re: [L4D1 & L4D2] Votekick - no black screen (Coop & Versus)
Reply With Quote #52

@alliedfront, no need for diff, since I'm using WinMerge or Beyond Compare to do that.

Also, I don't agree with you in 2 things:
1) I'm not native English speaker, but I don't think adding "is" is appropriate here:
Code:
"{green}%N {orange}is started vote for kick: {cyan}%s\n"
verb is not "-ing" and also subject (%N) directly execute the action ("start"), so "is" isn't required here AFAIK.

2) Why do you think
Code:
bool IsVoteAllowed(int client, int target)
{
	if( target <= 0 )
		return false;
this check isn't appropriate to do at the very begin of the routine?
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
alliedfront
Junior Member
Join Date: Jan 2024
Location: Germany
Old 01-30-2024 , 13:59   Re: [L4D1 & L4D2] Votekick - no black screen (Coop & Versus)
Reply With Quote #53

Quote:
Originally Posted by Dragokas View Post
@alliedfront, no need for diff, since I'm using WinMerge or Beyond Compare to do that.

Also, I don't agree with you in 2 things:
1) I'm not native English speaker, but I don't think adding "is" is appropriate here:
Code:
"{green}%N {orange}is started vote for kick: {cyan}%s\n"
verb is not "-ing" and also subject (%N) directly execute the action ("start"), so "is" isn't required here AFAIK.

2) Why do you think
Code:
bool IsVoteAllowed(int client, int target)
{
	if( target <= 0 )
		return false;
this check isn't appropriate to do at the very begin of the routine?
1) The diff was: fixed version to old 3.1 version, so "is" was removed in new version. Please check new version. Next time no diffs. : )
2) The check is not appropriate because target == -1 is also the index of a kicked player. You cannot un-kick him with your check because the function returns false.

Last edited by alliedfront; 01-30-2024 at 14:08.
alliedfront is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 01-30-2024 , 14:06   Re: [L4D1 & L4D2] Votekick - no black screen (Coop & Versus)
Reply With Quote #54

@alliedfront, ahh, sorry, I almost sleeping. Will do an update tomorrow.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
alliedfront
Junior Member
Join Date: Jan 2024
Location: Germany
Old 01-30-2024 , 14:24   Re: [L4D1 & L4D2] Votekick - no black screen (Coop & Versus)
Reply With Quote #55

Quote:
Originally Posted by Dragokas View Post
@alliedfront, ahh, sorry, I almost sleeping. Will do an update tomorrow.
Np, @Dragokas. I appreciate your quick response and that you check changes and carry out optimizations. I will game a little. : )

Last edited by alliedfront; 01-30-2024 at 14:31.
alliedfront is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 01-31-2024 , 05:28   Re: [L4D1 & L4D2] Votekick - no black screen (Coop & Versus)
Reply With Quote #56

Ok, looks good. I left it as is.

Plugin is updated.

Quote:
3.2 (30-Jan-2024) by alliedfront
- Fixed regression: unkick didn't work because of incorrect access check.
- Fixed access check to allow everybody to kick players if the flag string is empty.
- Fixed spelling.
- Translation file is updated.

3.3 (31-Jan-2024)
- Added kick reason "Team killer".
- Translation file is updated.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
glhf3000
Member
Join Date: Aug 2010
Location: middle-universe
Old 02-02-2024 , 09:21   Re: [L4D1 & L4D2] Votekick - no black screen (Coop & Versus)
Reply With Quote #57

Add reason to hint pls.
PHP Code:
CreateTimer(g_fCvarAnnounceDelayTimer_VoteDelayedmenu);
if ( 
g_bIsVersus 
    if( 
bHasPhrase )
        
CPrintHintTextToTeam"%t\n%t""vote_started_announce"g_sName"ReasonHint"sReasonEng);
    else 
        
CPrintHintTextToTeam"%t""vote_started_announce"g_sName);
else
    
CPrintHintTextToAll("%t""vote_started_announce"g_sName); 
Code:
"ReasonHint"
{
	"#format"	"{1:t}"
	"en"		"Reason: {1}"
	"ru"		"Причина: {1}"
}
LogToFileEx(g_sLog, "[TRIED] to UN?kick against: %s", name);
PHP Code:
void StartVoteAccessCheck_UnKick(int clientchar[] sSteam)
{
    if( 
IsVoteInProgress() || g_bVoteInProgress ) {
        
CPrintToChat(client"%t""other_vote");
        
LogVoteAction(client"[DENY] Reason: another vote is in progress.");
        return;
    }

    if( !
IsVoteAllowed(client, -1) )
    {
        
char name[MAX_NAME_LENGTH];
        
hMapPlayerName.GetString(sSteamnamesizeof(name));
        
CPrintToChatAll("%t""no_access_specific_unkick"clientname); // "%s tried to use votekick against %s, but has no access."
        
LogVoteAction(client"[NO ACCESS]");
        
LogToFileEx(g_sLog"[TRIED] to kick against: %s"name);
        return;
    }

    
StartVoteUnKick(clientsSteam);

P.S. took a long time to understand why sm_pass bind didnt do anything, mb sm_votepass->sm_pass?
PHP Code:
RegConsoleCmd("sm_votepass",     Command_Votepass,     "Allow admin to bypass current vote."); 
glhf3000 is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 02-02-2024 , 11:01   Re: [L4D1 & L4D2] Votekick - no black screen (Coop & Versus)
Reply With Quote #58

@[ru]In1ernal Error, check is it work.
Attached Files
File Type: zip votekick_v3.zip (30.4 KB, 10 views)
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
alliedfront
Junior Member
Join Date: Jan 2024
Location: Germany
Old 02-03-2024 , 10:20   Re: [L4D1 & L4D2] Votekick - no black screen (Coop & Versus)
Reply With Quote #59

@Dragokas, I just found a small bug: with the first !vk remaining expired entries were found and deleted correctly, but since in such a case the for loop did not skip an iteration, the menu was still displayed with the expired time and a random name. At the next !vk there were finally only valid entries.

To fix this in version 3.3 of l4d_votekick.sp, a "continue;" should be added on line 533, so that the menu always is filled only with valid entries for un-kick:

PHP Code:
        for( int i 0hSnap.Lengthi++ )
        {
            
hSnap.GetKey(isSteamsizeof(sSteam));
            
hMapSteam.GetString(sSteamsTimesizeof(sTime));
            
iTime StringToInt(sTime);
            if( (
g_iCvarKickTime - (GetTime() - iTime)) < ) {    // leftover expired entries (negative time) of kicked players are deleted, for reasons of clarity
                                                                // (had 3 pages of expired entries after 2 days, which were displayed on each !vk to the client)
                
hMapSteam.Remove(sSteam);
                
hMapPlayerName.Remove(sSteam);
                
hMapPlayerTeam.Remove(sSteam);
                continue;
            }
            
hMapPlayerName.GetString(sSteamnamesizeof(name));
            
hMapPlayerTeam.GetValue(sSteamiPlayerTeam);
            
            
// add target to menu for unkick. active for both: co-op and versus (versus: only issuer team can unkick target)
            // Versus: don't allow opposite team to unkick a player who was kicked by issuer team (could be friend of the opposite team who acts destructive or just a mad anonymous tk)
            
if( !(g_bIsVersus && iIssuerTeam != iPlayerTeam) ) {    
                
Format(menuItemsizeof(menuItem), "%s %s %T"g_sCharKickedname"time_left"client, (g_iCvarKickTime - (GetTime() - iTime)) / 60);  
                
menu.AddItem(sSteammenuItem);
            }
        } 

Last edited by alliedfront; 02-03-2024 at 10:21.
alliedfront is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 02-03-2024 , 10:42   Re: [L4D1 & L4D2] Votekick - no black screen (Coop & Versus)
Reply With Quote #60

Right, make sense.
Waiting for answer from [ru]In1ernal Error.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas 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 09:02.


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