RSSy MYGO.pl Opublikowano Październik 27, 2017 o 12:29 RSSy Udostępnij Opublikowano Październik 27, 2017 o 12:29 [TF2] End of Round Chaos Description: Respawns all players at the end of a round and (optionally) can give players a specified weapon with TF2Items Give Weapon.Installation: Code: 1. Drag and drop the plugin into addons/sourcemod/plugins. 2. Load the plugin using the command sm plugins load tf2_endroundchaos. 3. Edit the ConVars to your liking in the config file that is generated in cfg/sourcemod called plugin.tf2_endroundchaos.cfg. Bug Reporting: If anything is not functioning as intended, leave a post here and I will get back to you ASAP Rocky.Source Code... will upload .sp file later, can't right now :grrr: PHP Code: #pragma semicolon 1 #include <sourcemod> #include <tf2_stocks> #undef REQUIRE_PLUGIN #include <tf2items_giveweapon> #define PLUGIN_VERSION "1.0" ConVar hConVars[2]; bool cv_Enabled, bRoundEndActive; int cv_Weapon; public Plugin myinfo = { name = "[TF2] End of Round Chaos", author = "Sgt. Gremulock", description = "Respawns everybody at the end of a round and gives them a configurable weapon.", version = PLUGIN_VERSION, url = "sourcemod.net" }; public void OnPluginStart() { CreateConVar("tf2_end_round_chaos_version", PLUGIN_VERSION, "Plugin's version.", FCVAR_NOTIFY|FCVAR_REPLICATED); hConVars[0] = CreateConVar("tf2_end_round_chaos_enabled", "1", "Enable/disable the plugin.", _, true, 0.0, true, 1.0); hConVars[1] = CreateConVar("tf2_end_round_chaos_weapon", "8018", "Weapon to give to all players after they have been respawned (0 to disable).", _, true, 0.0); for (int i = 0; i < sizeof(hConVars); i++) { hConVars[i].AddChangeHook(UpdateCvars); } AutoExecConfig(true); HookEvent("teamplay_round_win", Event_RoundEnd); HookEvent("teamplay_round_start", Event_RoundStart); HookEvent("post_inventory_application", Event_PlayerItems); if (!LibraryExists("tf2items_giveweapon")) { hConVars[1].SetInt(0); } } public void OnLibraryRemoved(const char[] name) { if (StrEqual(name, "tf2items_giveweapon")) { hConVars[1].SetInt(0); } } public void UpdateCvars(ConVar cvar, const char[] oldValue, const char[] newValue) { OnConfigsExecuted(); } public void OnMapStart() { OnConfigsExecuted(); } public void OnConfigsExecuted() { cv_Enabled = hConVars[0].BoolValue; cv_Weapon = hConVars[1].IntValue; } public Action Event_RoundEnd(Event event, const char[] name, bool dontBroadcast) { if (cv_Enabled) { bRoundEndActive = true; for (int i = 1; i <= MaxClients; i++) { if (IsValidClient(i) && !IsPlayerAlive(i)) { TF2_RespawnPlayer(i); } } } } public Action Event_RoundStart(Event event, const char[] name, bool dontBroadcast) { if (cv_Enabled) { bRoundEndActive = false; } } public Action Event_PlayerItems(Event event, const char[] name, bool dontBroadcast) { if (cv_Enabled && bRoundEndActive && cv_Weapon > 0) { for (int i = 1; i <= MaxClients; i++) { if (IsValidClient(i)) { TF2Items_GiveWeapon(i, cv_Weapon); } } } } bool IsValidClient(int client) { if (client <= 0 || client > MaxClients || !IsClientConnected(client)) { return false; } return IsClientInGame(client); } Updates: Code: 1.0 - *Initial release Attached Files tf2_endroundchaos.smx (5.9 KB) Wyświetl pełny artykuł Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
Rekomendowane odpowiedzi
Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto
Jedynie zarejestrowani użytkownicy mogą komentować zawartość tej strony.
Zarejestruj nowe konto
Załóż nowe konto. To bardzo proste!
Zarejestruj sięZaloguj się
Posiadasz już konto? Zaloguj się poniżej.
Zaloguj się