AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   CS_TerminateRound not firing? (https://forums.alliedmods.net/showthread.php?t=292658)

sneaK 01-11-2017 01:55

CS_TerminateRound not firing?
 
Hey guys, I'm attempting to modify Mapchooser Extended lightly.

When an RTV is successful, instead of ForceChangeLevel being called and the map changing abruptly, I wish for the map change to be a bit more "graceful", meaning timelimit is lowered to expire the map, everyone gets slayed, round is ended, scoreboard pops up and map changes.

Currently this is what I have:

Code:
public Action:Timer_ChangeMap(Handle:hTimer, Handle:dp) {     g_ChangeMapInProgress = false;         new String:map[PLATFORM_MAX_PATH];         if (dp == INVALID_HANDLE)     {         if (!GetNextMap(map, PLATFORM_MAX_PATH))         {             //No passed map and no set nextmap. fail!             return Plugin_Stop;          }     }     else     {         ResetPack(dp);         ReadPackString(dp, map, PLATFORM_MAX_PATH);     }     //ForceChangeLevel(map, "Map Vote");     SetNextMap(map);     PrintToChatAll("Slaying all - end of map");     ServerCommand("mp_timelimit 1");     ServerCommand("mp_maxrounds 1");     ServerCommand("sm_slay @all");     CS_TerminateRound(1.0, CSRoundEnd_Draw);     ServerCommand("sm_slay @all");         return Plugin_Stop; }

It's a bit sloppy of a way of doing it, but should do the trick, right? Everything else works, except the round isn't ending. Any thoughts on why?

I tested making it even sloppier, changing the part in question to:

Code:
    SetNextMap(map);     PrintToChatAll("Slaying all - end of map");     ServerCommand("mp_timelimit 1");     ServerCommand("mp_maxrounds 1");     ServerCommand("sm_slay @all");     ServerCommand("sv_cheats 1");     ServerCommand("endround");     ServerCommand("sv_cheats 0");

and that works, but obviously I don't want cheats on at any point in time.

Mitchell 01-11-2017 02:25

Re: CS_TerminateRound not firing?
 
If terminate round isn't actually ending the round then that makes me think that the gamedata is bad.
Also terminate round will need a higher value for the map end time or it will wait only 1 second and then cut to the map change.
mp_match_restart_delay may be the value to set the CS_TerminateRound value to.
Edit: you are right about setting the timelimit and max rounds to a low value, as it will trigger the end-of-map checks.

Neuro Toxin 01-11-2017 03:11

Re: CS_TerminateRound not firing?
 
I dont think settings cheats on and off like that is an issue because nothing can can be processed inbetween the squential calls as SRCDS isnt threaded.

Slaying everyone is a bit harsh and would effect stats plugins like rankme. Calling endround wouldn't require you to slay the clients.

sneaK 01-11-2017 03:18

Re: CS_TerminateRound not firing?
 
Quote:

Originally Posted by Mitchell (Post 2485466)
If terminate round isn't actually ending the round then that makes me think that the gamedata is bad.
Also terminate round will need a higher value for the map end time or it will wait only 1 second and then cut to the map change.
mp_match_restart_delay may be the value to set the CS_TerminateRound value to.
Edit: you are right about setting the timelimit and max rounds to a low value, as it will trigger the end-of-map checks.

I'll try using a higher value, hopefully that will solve it! I was almost thinking I wasn't calling CS_TerminateRound correctly...

Quote:

Originally Posted by Neuro Toxin (Post 2485471)
I dont think settings cheats on and off like that is an issue because nothing can can be processed inbetween the squential calls as SRCDS isnt threaded.

Slaying everyone is a bit harsh and would effect stats plugins like rankme. Calling endround wouldn't require you to slay the clients.

I'm running SMAC, so sv_cheats is automatically set back to 0 before endround is called, so that's that doesn't work unfortunately, hence why I'm attempting to use CS_TerminateRound.

I'm not worried about stats since this is for movement servers (surf, bhop, etc), the slaying is just an added protection to ensure the round ends and the server changes to the next map. If I got the round to end properly then I could probably take out the slaying after testing, but that's what I'm stuck on. :(

Neuro Toxin 01-11-2017 04:34

Re: CS_TerminateRound not firing?
 
Maybe another plugin is blocking the terminate round call?

ThatOneGuy 01-11-2017 18:01

Re: CS_TerminateRound not firing?
 
Perhaps try using the third argument in the function:
PHP Code:

CS_TerminateRound(1.0CSRoundEnd_Drawtrue); 

I've always set that to true. Might stop other plugins from interfering, as Neuro noted could be happening. Also, consider changing the 1.0 to something higher for a slightly longer, more graceful delay/change.

Dr!fter 01-11-2017 22:05

Re: CS_TerminateRound not firing?
 
You can also try, creating a game_round_end entity and firing one of the inputs. Note, using the entity to end rounds will follow more steps than just calling the function (Like adding to the score iirc).


All times are GMT -4. The time now is 00:58.

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