Trigger a function on round change in L4d1/2
Hello, is there a way in Sourcemod for a plugin to notice a round change?
In L4d Versus, a team's team number (Survivor or Infected) changes with each round within a running map. I want to update the team number in a kicked player's record every round so that only the team that issued it can decide to revoke a ban. |
Re: Trigger a function on round change in L4d1/2
#include <sourcemod>
#include <sdktools> // Global variable to store the kicked player's Steam ID static uint64 g_KickedPlayerSteamID; // Callback function for on_player_disconnect event public Action on_player_disconnect(int client, int reason) { // Save the kicked player's Steam ID g_KickedPlayerSteamID = PlayerResource->GetSteamID(client); return Plugin::Continue; } // Callback function for on_round_end hook public Action on_round_end(int winning_team) { // Get the team number of the winning team int team_number = Team::GetTeam(winning_team); // Update the kicked player's team number in the database DB::StoreQuery("UPDATE player_bans SET team_number = %d WHERE steam_id = %llu", team_number, g_KickedPlayerSteamID); // Reset the global variable for the next round g_KickedPlayerSteamID = 0; return Plugin::Continue; } // Register the hooks and events public Plugin:init() { Plugin::RegisterHook("player_disconnect", on_player_disconnect); Plugin::RegisterHook("round_end", on_round_end); return Plugin::Continue; } |
Re: Trigger a function on round change in L4d1/2
@CAN2323, Thanks for your answer! However, I found a solution myself yesterday and came back today to update my previous post with it: To get a team number associated with each team during the game, I now use the logical team number:
PHP Code:
|
Re: Trigger a function on round change in L4d1/2
Quote:
|
All times are GMT -4. The time now is 17:56. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.