AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   New Plugin Submissions (https://forums.alliedmods.net/forumdisplay.php?f=26)
-   -   [RE] FASTCUP Tactical Timeout (Pause Plug-in) (https://forums.alliedmods.net/showthread.php?t=339686)

deprale 09-26-2022 02:07

[RE] FASTCUP Tactical Timeout (Pause Plug-in)
 
3 Attachment(s)
Requirements:

AMXModX 1.10 (maybe works with 1.9 too :?:)
ReHLDS & ReGameDLL
ReAPI 5.21
Note: THIS IS ONLY FOR CS 1.6 SERVER OWNERS WHO USE REHLDS/REGAMEDLL COMBO ->> REASON!

Plugin description:

It's basically the pause feature from CSGO but with slight changes, a player can call for a pause whenever and it will take effect on the next round or if the round is in freezetime, and anyone from the same team can call a vote for unpausing - mostly aimed @ 5v5 servers, but could be used in other instances as well I guess!

This is something that has been in "demand" lately, but the ones that were out were never quite similar to the one on FASTCUP which people wanted, so I decided to make it on my own and release it. And the other ones that I found were only working on the default HLDS packages, and still lacked some very basic logic to replicate the one from FASTCUP.

My plugin modifies the roundtimer directly rather than meddling with the mp_freezetime cvar, which is in theory a big advantage over whatever is floating around other forums.


Features:
  • Pause limits per team
  • Able to modify pause amounts per team (which take immediate effect)
  • Unpause Vote (can only be called from somebody from the same team that paused the game)
  • Instant pause (it takes effect the same exact round if the round didn't start)
  • Pause queue (it takes effect the next round if mid round)
  • Reset pauses per team via console command (can be used in PUG plugins via server_cmd)
  • Remove curent pause via console command (can be used in PUG plugins via server_cmd)
  • BuyTime logic (will make sure players can still buy while the artificial timeout is active)
  • Cvars for disabling features (useful for when your pug state is not live)


Cvars:
Server cvars:
  • amx_pause_enabled ->> default: 1
    !!! 0 | disable pause feature
    !!! 1 | enable pause feature
  • amx_pause_duration ->> default: 60
    !!! integer | amount of freezetime to be set (in seconds)!
  • amx_pause_amount ->> default:2
    !!! integer | the amount of times each team can call a pause for the match!
  • amx_pause_buytime ->> default:1
    !!! 0 | buytime not altered, not recommended!
    !!! 1 | buytime altered to allow people to buy during the pause.
  • amx_pause_set_notify ->> default:1
    !!! 0 | do not notify players when you modify their pause amounts
    !!! 1 | recommended, notify players of the amount of pauses they can use
  • amx_pause_allow_resume ->> default:1
    !!! 0 | do not allow players to start a vote for resuming the game (removing the "artificial pause")
    !!! 1 | allow players to start a vote
  • amx_pause_resume_votes ->> default:4
    !!! integer | the amount of people that need to vote "yes" to remove the current pause.

Server cmds:
  • amx_pause_resume ->>
    !!! No value, just removes all current pauses and resumes gameplay.
  • amx_pause_set ->>
    !!! 0 = CT, 1 = TT, 2 = ALL(CT+TT)
    !!! integer | amount of pauses to set.
    !!! example: amx_pause_set 0 0 will reset the CT Team pause counter, so if you have
    amx_pause_amount 1 then the CT's can call a pause again.
Note: You can use these in your plugins via server_cmd( ), or alternatively you can call them via client or server console with RCON access.

Usage:

In chat, type [!][/][.]pause or [!][/][.]p to request a pause!
In chat, type [!][/][.]unpause or [!][/][.]up to start a vote for resuming the game (unpause)

Examples:

Pausing:
  • /pause
  • .pause
  • !pause
  • /p
  • .p
  • !p

Unpausing:
  • /unpause
  • .unpause
  • !unpause
  • /up
  • .up
  • !up

Change Log:

  • 28/09/2022 - v0.1.1 released: coding style consistencies, removed global counter - now using proper way to check round time! Fixed mp_buytime not getting reverted (logic error)! Fixed lang file displaying wrong data type (%i -> %0.f)!
  • 26/09/2022 - v0.1 released.

Installation:
  • pause.txt ->> addons/amxmodx/data/lang/pause.txt
  • pause.amxx ->> addons/amxmodx/plugins/
  • IF GET PLUGIN BUTTON WILL NOT WORK FOR SOME REASON, DO THIS INSTEAD IF YOU DON'T KNOW HOW TO COMPILE THE PLUGIN! ALSO I ADVISE TO COMPILE IT YOURSELF BECAUSE THE WEB COMPILER SPITS OUT A WHOPPING 1,5 MB AMXX FILE INSTEAD OF A 9KB ONE!
  • pause.sma ->> addons/amxmodx/scripting/ then open compile.exe and grab pause.amxx from the folder named "compiled" and drop it into addons/amxmodx/plugins/
  • open plugins.ini located @ addons/amxmodx/configs/plugins.ini and type the plugin name at the very bottom (the plugin name is pause.amxx obviously unless you changed it)

Feedback is welcome as I'm still learning:3

theartemmaps 09-26-2022 03:12

Re: [RE] FASTCUP Tactical Timeout (Pause Plug-in)
 
very nice! :)

deprale 09-28-2022 00:11

Re: [RE] FASTCUP Tactical Timeout (Pause Plug-in)
 
For anyone that has already downloaded the plugin - please download the new update and replace the pause.txt file too, it fixes some critical things I haven't really paid attention to while coding the plugin!

Escap3d 03-19-2023 03:14

Re: [RE] FASTCUP Tactical Timeout (Pause Plug-in)
 
1 Attachment(s)
i suggestion all to remove under red line main mark in picture. this is a bottom side i want set this top center anyone fix this ?only timer is good for plugin sorry my bad english

IC3k1ng 03-19-2023 18:59

Re: [RE] FASTCUP Tactical Timeout (Pause Plug-in)
 
Quote:

Originally Posted by deprale (Post 2789845)
For anyone that has already downloaded the plugin - please download the new update and replace the pause.txt file too, it fixes some critical things I haven't really paid attention to while coding the plugin!

You can make a GitHub link that directs to the last release, like OciXCrom plugins. Also good job.

deprale 11-06-2023 07:37

Re: [RE] FASTCUP Tactical Timeout (Pause Plug-in)
 
Quote:

Originally Posted by IC3k1ng (Post 2801500)
You can make a GitHub link that directs to the last release, like OciXCrom plugins. Also good job.

Thank you - however I don't want to do this as this code is embarrassing, I've looked through it and there's so many things I could've done better lol, I was such a newbie back then it's not even funny. But unfortunately I also lost interest into scripting as a whole, as I find C/C++ more fun to dabble with, nowadays I'm more into kernel stuff and security researching as a whole and honestly I can not bring myself to come back and fix this mess.

Just a short list of what I could've done better:
implement it as a proper API, and only then offer a ready-made solution, just in case other devs want to take the functionality of pausing but rather handle the other things themselves.

this could have been done much MUCHHHHHH cleaner and better.
too many defines. // arguable, i didn't look thoroughly what i was doing
hardcoded task ids.
using old ways of creating cvars even though I was using ReApi (???).
half using amxx default stuff half using reapi... no idea what i was doing wtf, should have just went with registerhookchain for example, but like I said, I was very much a newbie back then
useless tasks... LOL.
players who join will never see the messages of the pause (? WTF I WAS DUMB)
I love how I mangled the team ids, since they differ in the ways I was checking them, printing for a team and getting a team id was differing somehow (I don't remember exactly what I was doing) so I had to do some spaghetti LOL, the more I read through the code the more I laugh!!!
I love how I was overusing the ternary operators just for the sake of it ( cause I just learnt about it back then and I was so happy I understood how it works... or not! ). The only commendable thing I can find is the way I used it in get_players I guess?
Love the fact that I could have cached so many times before running loops with funny comparisons in the print functions...
Could have encapsulated more stuff to be honest like initializing/resetting some common variables, could have even arguably used bit shifting but maybe it's overkill for the purpose of the plugin.
I see a couple of array sizes that have no deal being this big but maybe there's a reason behind them I don't remember.

Overall I would rate this code 3/10, but to be honest... at the time to me it looked like groundbreaking code so I was very proud of myself, so I might come back and fix this mess (eventually).


Also R.I.P goldSrc.

Quote:

Originally Posted by Escap3d (Post 2801442)
i suggestion all to remove under red line main mark in picture. this is a bottom side i want set this top center anyone fix this ?only timer is good for plugin sorry my bad english

remove/comment out lines 432-435 (the whole for loop) in DisplayPauseProgress().
and don't forget to remove/comment out lines 178-180 in CleanReinitialize().

mlibre 11-07-2023 11:33

Re: [RE] FASTCUP Tactical Timeout (Pause Plug-in)
 
In practice the master is born

Escap3d 11-12-2023 04:09

Re: [RE] FASTCUP Tactical Timeout (Pause Plug-in)
 
Quote:

Originally Posted by deprale (Post 2812511)
Thank you - however I don't want to do this as this code is embarrassing, I've looked through it and there's so many things I could've done better lol, I was such a newbie back then it's not even funny. But unfortunately I also lost interest into scripting as a whole, as I find C/C++ more fun to dabble with, nowadays I'm more into kernel stuff and security researching as a whole and honestly I can not bring myself to come back and fix this mess.

Just a short list of what I could've done better:
implement it as a proper API, and only then offer a ready-made solution, just in case other devs want to take the functionality of pausing but rather handle the other things themselves.

this could have been done much MUCHHHHHH cleaner and better.
too many defines. // arguable, i didn't look thoroughly what i was doing
hardcoded task ids.
using old ways of creating cvars even though I was using ReApi (???).
half using amxx default stuff half using reapi... no idea what i was doing wtf, should have just went with registerhookchain for example, but like I said, I was very much a newbie back then
useless tasks... LOL.
players who join will never see the messages of the pause (? WTF I WAS DUMB)
I love how I mangled the team ids, since they differ in the ways I was checking them, printing for a team and getting a team id was differing somehow (I don't remember exactly what I was doing) so I had to do some spaghetti LOL, the more I read through the code the more I laugh!!!
I love how I was overusing the ternary operators just for the sake of it ( cause I just learnt about it back then and I was so happy I understood how it works... or not! ). The only commendable thing I can find is the way I used it in get_players I guess?
Love the fact that I could have cached so many times before running loops with funny comparisons in the print functions...
Could have encapsulated more stuff to be honest like initializing/resetting some common variables, could have even arguably used bit shifting but maybe it's overkill for the purpose of the plugin.
I see a couple of array sizes that have no deal being this big but maybe there's a reason behind them I don't remember.

Overall I would rate this code 3/10, but to be honest... at the time to me it looked like groundbreaking code so I was very proud of myself, so I might come back and fix this mess (eventually).


Also R.I.P goldSrc.



remove/comment out lines 432-435 (the whole for loop) in DisplayPauseProgress().
and don't forget to remove/comment out lines 178-180 in CleanReinitialize().



pllz u edit me this code ??? i am not a expert coding


All times are GMT -4. The time now is 06:50.

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