Skocz do zawartości

Nowy szablon forum

mygo.pl

Stworzyliśmy dla Was nowy wygląd forum. Z pewnością znajdziesz rzeczy, które wg Ciebie mogą zostać zmienione - wspomnij o tym w specjalnym wątku.

Czytaj więcej

Jak założyć własną sieć

serwerów CS

Zastanawiasz się nad prowadzeniem własnej sieci serwerów? Przeczytaj podstawowe informacje, na które należy zwrócić uwagę, przy takim projekcie.

Czytaj więcej

Tworzymy spis sieci

dodaj swoją

Dodaj sieć do której należysz, pozwoli to na promocję i budowę ogólnopolskiej bazy sieci CS.

Czytaj więcej

[TF2] End of Round Chaos


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
[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_EnabledbRoundEndActive;
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."_true0.0true1.0);
    
hConVars[1] = CreateConVar("tf2_end_round_chaos_weapon""8018""Weapon to give to all players after they have been respawned (0 to disable)."_true0.0);
    
    for (
int i 0sizeof(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[] namebool dontBroadcast)
{
    if (
cv_Enabled)
    {
        
bRoundEndActive true;

        for (
int i 1<= MaxClientsi++)
        {
            if (
IsValidClient(i) && !IsPlayerAlive(i))
            {
                
TF2_RespawnPlayer(i);
            }
        }
    }
}

public 
Action Event_RoundStart(Event event, const char[] namebool dontBroadcast)
{
    if (
cv_Enabled)
    {
        
bRoundEndActive false;
    }
}

public 
Action Event_PlayerItems(Event event, const char[] namebool dontBroadcast)
{
    if (
cv_Enabled && bRoundEndActive && cv_Weapon 0)
    {
        for (
int i 1<= MaxClientsi++)
        {
            if (
IsValidClient(i))
            {
                
TF2Items_GiveWeapon(icv_Weapon);
            }
        }
    }
}

bool IsValidClient(int client)
{
    if (
client <= || client MaxClients || !IsClientConnected(client))
    {
        return 
false;
    }

    return 
IsClientInGame(client);


Updates:
Code:

1.0 - *Initial release

Attached Files
File Type: smx tf2_endroundchaos.smx (5.9 KB)

Wyświetl pełny artykuł

Odnośnik do komentarza
Udostępnij na innych stronach

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ę
 Udostępnij

  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...