Raised This Month: $ Target: $400
 0% 

auto team swap


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
XPERA
Member
Join Date: Nov 2022
Old 12-24-2022 , 16:03   auto team swap
Reply With Quote #1

Teams change every 10 minutes and the frags will be reset without changing the map, it will be on a fixed map

Sample: amx_team_swap_time 600 second

I want a plugin like this
XPERA is offline
sPed
Member
Join Date: May 2017
Location: Algeria
Old 12-24-2022 , 18:28   Re: auto team swap
Reply With Quote #2

https://forums.alliedmods.net/showthread.php?t=90898
sPed is offline
shayan123
BANNED
Join Date: Oct 2020
Location: GB
Old 01-13-2023 , 11:47   Re: auto team swap
Reply With Quote #3

Quote:
#include <amxmodx>
#include <cstrike>

new g_iSwapTime;

public plugin_init() {
register_plugin("Auto Team Swap", "1.0", "Author");

g_iSwapTime = register_cvar("amx_team_swap_time", "600");
set_task(get_pcvar_float(g_iSwapTime), "Task_SwapTeams", .flags = "b");
}

public Task_SwapTeams() {
swap_teams(); //function to swap teams
cs_reset_round_stats(); // function to reset frags
set_task(get_pcvar_float(g_iSwapTime), "Task_SwapTeams", .flags = "b");
}
This plugin uses the register_cvar() function to register a console variable, amx_team_swap_time, which allows you to set the time in seconds between team swaps. The plugin uses the set_task() function to create a task that swaps teams and resets frags every amx_team_swap_time seconds. This task calls the Task_SwapTeams() function which uses swap_teams() and cs_reset_round_stats() functions to swap teams and reset frags respectively.
Also, the task is set to repeat itself every amx_team_swap_time seconds so the teams will keep swapping and resetting frags every 10 minutes.

Please note that this is an example and you may need to modify the code to suit your needs, also, this plugin will only work on a fixed map.

Also, please note that this plugin is not tested and it may not work as expected, you may need to test it and make any necessary adjustments.
shayan123 is offline
Send a message via ICQ to shayan123 Send a message via AIM to shayan123 Send a message via Yahoo to shayan123 Send a message via Skype™ to shayan123
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 01:40.


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