Raised This Month: $ Target: $400
 0% 

Solved [L4D1/2] Simple Round Restart Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TotalChaos SourcePawner
Senior Member
Join Date: Feb 2023
Location: IN PINEAPPLE, UNDER SEA
Old 04-08-2023 , 13:54   [L4D1/2] Simple Round Restart Plugin
Reply With Quote #1

Hi.
I'm trying to create a plugin which allows somebody to instantly restart a round in L4D1 and L4D2.
By restarting the round, I mean what happens at the end of Versus rounds, or when you lose during a Co-op game.
I can't seem to find an easy way to do this in L4D1, though.
Spoiler


I did find this in Left 4 DHooks:
Code:
L4D_RestartScenarioFromVote();
But I can't figure out a way to get the current map name for that.


I honestly thought this would be incredibly simple compared to the other things that I've tried to do, but I guess not.

Any and all help would be greatly appreciated.
Thanks,
TotalChaos.

Last edited by TotalChaos SourcePawner; 04-08-2023 at 21:38.
TotalChaos SourcePawner is offline
little_froy
Senior Member
Join Date: May 2021
Old 04-08-2023 , 15:02   Re: [L4D1/2] Simple Round Restart Plugin
Reply With Quote #2

GetCurrentMap
little_froy is offline
TotalChaos SourcePawner
Senior Member
Join Date: Feb 2023
Location: IN PINEAPPLE, UNDER SEA
Old 04-08-2023 , 15:31   Re: [L4D1/2] Simple Round Restart Plugin
Reply With Quote #3

Quote:
Originally Posted by little_froy View Post
Thank you little_froy, but I've already tried that.
I keep getting this error "error 022: must be lvalue (non-constant)", and other errors depending on what I do to the code.


I lost so many hours trying that method...and I can't even set it up properly because I couldn't find any examples for it and the L4DHooks thing.
So there's a really good chance that I didn't set it up properly.

Code:
Left 4 DHooks:
native int L4D_RestartScenarioFromVote(const char[] map);

Part of my code:
const char map = 'A'; - Removing "const" presents a slew of new errors.

char map1[64]; - I've also tried "decl String:map1[64]", which also presents a slew of new errors.
map = GetCurrentMap(map1, sizeof(map1));

L4D_RestartScenarioFromVote(map);

Last edited by TotalChaos SourcePawner; 04-08-2023 at 15:41.
TotalChaos SourcePawner is offline
little_froy
Senior Member
Join Date: May 2021
Old 04-08-2023 , 15:44   Re: [L4D1/2] Simple Round Restart Plugin
Reply With Quote #4

Quote:
Originally Posted by TotalChaos SourcePawner View Post
Thank you little_froy, but I've already tried that.
I keep getting this error "error 022: must be lvalue (non-constant)", and other errors depending on what I do to the code.


I lost so many hours trying that method...and I can't even set it up properly because I couldn't find any examples for it and the L4DHooks thing.
So there's a really good chance that I didn't set it up properly.

Code:
Left 4 DHooks:
native int L4D_RestartScenarioFromVote(const char[] map);

Part of my code:
const char map = 'A'; - Removing "const" presents a slew of new errors.

char map1[64]; - I've also tried "decl String:map1[64]", which also presents a slew of new errors.
map = GetCurrentMap(map1, sizeof(map1));

L4D_RestartScenarioFromVote(map);

normally it's not necessary to check the return value of GetCurrentMap.
it just should be

Code:
char map1[64];
GetCurrentMap(map1, sizeof(map1));
L4D_RestartScenarioFromVote(map1);

Last edited by little_froy; 04-08-2023 at 15:53.
little_froy is offline
TotalChaos SourcePawner
Senior Member
Join Date: Feb 2023
Location: IN PINEAPPLE, UNDER SEA
Old 04-08-2023 , 16:16   Re: [L4D1/2] Simple Round Restart Plugin
Reply With Quote #5

Quote:
Originally Posted by little_froy View Post
normally it's not necessary to check the return value of GetCurrentMap.
it just should be

Code:
char map1[64];
GetCurrentMap(map1, sizeof(map1));
L4D_RestartScenarioFromVote(map1);
Thank you so much little_froy... This worked perfectly...

I was actually working on a plugin that fixed a long-standing bug in L4D1 and L4D2 where L4D1's game over music gets cut off before playing out fully. And I got stuck trying to restart the round.
This was the final piece of the puzzle.

But, the plugin is still incomplete. It is heavily bloated with extra and unneeded code (including comments).
Not only that, but it was built off of this plugin: https://forums.alliedmods.net/showthread.php?p=1342820
"[L4D, L4D2] No Death Check Until Dead" by "chinagreenelvis"

I really want to release this fix to the public, but considering it was built on top of somebody else's plugin, I'm not sure how I can do that.

Last edited by TotalChaos SourcePawner; 04-08-2023 at 16:16.
TotalChaos SourcePawner is offline
TotalChaos SourcePawner
Senior Member
Join Date: Feb 2023
Location: IN PINEAPPLE, UNDER SEA
Old 04-08-2023 , 16:34   Re: [L4D1/2] Simple Round Restart Plugin
Reply With Quote #6

Wait, does anybody even care about the game over music being cut off in L4D1/L4D2?
I'm serious.
TotalChaos SourcePawner 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 17:44.


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