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

Kills race


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
I found this plugin which is like a frag race to 50 kills.
is it possible to start the race only after there are 5 players on the server?
Thank you
Code:

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <engine>

#define PLUGIN "Frag Limit"
#define VERSION "1.0"
#define AUTHOR "Sh!nE*"

#define MAX_PLAYERS 32

new bool:g_restart_attempt[MAX_PLAYERS + 1]
new fraglimit_on, fraglimit
new bool:winnerfound=false

public plugin_init() {
        register_plugin(PLUGIN, VERSION, AUTHOR)
        fraglimit_on = register_cvar("fl_on","1")
        fraglimit = register_cvar("fl_fraglimit","50")
       
        register_event("DeathMsg","death_a","a")
       
        register_event("ResetHUD", "event_hud_reset", "be")
        register_clcmd("fullupdate", "clcmd_fullupdate")
        register_event("TextMsg", "event_restart_attempt", "a", "2=#Game_will_restart_in")
}

public clcmd_fullupdate() {
        return PLUGIN_HANDLED_MAIN
}

public event_restart_attempt() {
        new players[32], num
        get_players(players, num, "a")
        for (new i; i < num; ++i)
                g_restart_attempt[players] = true
}

public event_hud_reset(id) {
        if (g_restart_attempt[id]) {
                g_restart_attempt[id] = false
                return
        }
        event_player_spawn(id)
}

public event_player_spawn(id)
{
        ShowFragsLeft(id)
}

public death_a()
{   
        if(!get_pcvar_num(fraglimit_on) || winnerfound)
                return PLUGIN_HANDLED
       
        new players[32], num
        get_players(players, num)
        new Frags
       
        new killer=read_data(1)
        new victim=read_data(2)
       
        for (new i=0; i<num; i++)
        {
                Frags = get_user_frags(players)
               
                if(Frags >= get_pcvar_num(fraglimit))
                {
                        set_hudmessage(0, 255, 255, -1.0, 0.0, 0, 1.0, 7.0, 0.1, 0.2)
                        show_hudmessage(0, "%s Won the match!!!", killer)
                        set_dhudmessage(0, 255, 255, -1.0, -1.0, 0, 2.0, 3.0, 0.8, 0.8)
                        show_hudmessage(0, "And the last frag was %s", victim)
                       
                        winnerfound=true
                        set_task(5.0,"set_timelimit")
                        break
                }   
        }
        return PLUGIN_CONTINUE
}

public set_timelimit()
{
        new Float:time=halflife_time() + 60.0 ; set_cvar_num("mp_timelimit",floatround(time/60))
        set_hudmessage(255, 0, 0, -1.0, 0.20, 0, 6.0, 5.0)
        show_hudmessage(0, "Map change after 1 minute")
}

public ShowFragsLeft(id)
{   
        new Frags = get_user_frags(id)
        new Frags_left = get_pcvar_num(fraglimit) - Frags
       
        set_dhudmessage(0, 255, 255, -1.0, -1.0, 0, 2.0, 3.0, 0.8, 0.8)
        show_hudmessage(id, "%d Frags Remaining", Frags_left)
       
        set_task(1.0,"ShowFragsLeft", id)
}

Przeczytaj cały wpis

Odnośnik do komentarza
Udostępnij na innych stronach

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
 Udostępnij

×
×
  • Dodaj nową pozycję...