[AMXX] Bad Spawn Preventer

Vaata eelmist teemat Vaata järgmist teemat Go down

Tonight
Tonight

[AMXX] Bad Spawn Preventer Vetera11
Liitus : 19/02/2012
Postitusi : 18000

PostitamineTonight 03.03.12 16:00

Autor: beast
Kirjeldus: Oled kindlasti kogenud seda, kui mapis on vähe spawn kohti ja laisk omanik pole viitsinud ise spawne juurde tekitada, siis saavad mõned inimesed surma roundi algul. Kui oled üks neist 'laiskadest serveriomanikest', siis kasuta seda plugini. See respawnib mängija kui ta peaks katkise spawni tõttu surema ja lisab ka logifaili, kus mapis õnnetus juhtus mis kella ajal jne.

Source:
Kood:
#include <amxmodx>
#include <hamsandwich>

#define PLUGIN "Bad spawn preventer"
#define AUTHOR "beast"
#define VERSION "1.1"

#define TASKID_FIXIT 256

new g_freezetime
new Float:g_flSpawned[ 33 ]
new Float:g_spawndelay = 2.0 // Should not be set lower. Higher values may reduce rare 'second spawn kills'.

public plugin_init()
{             
        register_plugin(PLUGIN, VERSION, AUTHOR)

        RegisterHam( Ham_Spawn,  "player", "FwdHamPlayerSpawn", 1 )
        RegisterHam( Ham_Killed, "player", "FwdHamPlayerKilled" )
       
        g_freezetime = get_cvar_pointer("mp_freezetime")
}

public FwdHamPlayerSpawn(id)
{
        if (is_user_alive(id))
                g_flSpawned[id] = get_gametime()
}

public FwdHamPlayerKilled( id, iAttacker, iShouldGib )
{
        // we don't want deathmatch
        if((get_gametime() - g_flSpawned[id]) < 0.01)
        {
                new Float:time1 = get_pcvar_num(g_freezetime) + g_spawndelay
                set_task(time1, "task_fixit", id + TASKID_FIXIT)
        }
        return HAM_IGNORED
}

public task_fixit(id)
{
        new map[32]
        get_mapname(map, 31)
       
        ExecuteHam(Ham_CS_RoundRespawn, id - TASKID_FIXIT)
       
        // we don't want to flood the log with the same msg
        if(CheckForString("logs", "bsp_log_file.log", map))
                return 1
        else
        {
                log_to_file("bsp_log_file.log", "[BSP] Check %s map, it may contain some bad spawn points.", map)
                return 0
        }
        return PLUGIN_CONTINUE
}

// thx Alka
stock CheckForString(const szDir[32], const szFile[32], const szString[32])
{
        new szLocalDir[32]
        get_localinfo("amx_basedir", szLocalDir, charsmax(szLocalDir))
        new szPath[64]
        formatex(szPath, charsmax(szPath), "%s/%s/%s", szLocalDir, szDir, szFile)
       
        new iFile = fopen(szPath, "rt")
        if(!iFile)
                return 0
               
        new szBuffer[128]
        while(!feof(iFile))
        {
                fgets(iFile, szBuffer, charsmax(szBuffer))
                if(!szBuffer[0])
                        continue
               
                if(containi(szBuffer, szString) != -1)
                {
                        fclose(iFile)
                        return 1
                }
        }
        fclose(iFile)
        return 0
}

DOWNLOAD:

Attachments
[AMXX] Bad Spawn Preventer Attachment
bsp.zip Siin .zip failis on .amxx fail :)You don't have permission to download attachments.(5 Kb) Downloaded 23 times

Vaata eelmist teemat Vaata järgmist teemat Tagasi üles

Soovid vestluses osaleda?

Selleks logi sisse või tee endale kasutaja.

Liitu foorumiga

Tee endale kasutaja ning osale aruteludes.


Tee uus kasutaja

Logi sisse

Omad foorumis juba kasutajat? Logi sisse.


Logi sisse

 
Permissions in this forum:
Sa ei saa vastata siinsetele teemadele