hlmod.hu
https://hlmod.hu/

Deathrun Respawn
https://hlmod.hu/viewtopic.php?f=9&t=3421
Oldal: 1 / 1

Szerző:  norbee.16 [2012.02.13. 06:38 ]
Hozzászólás témája:  Deathrun Respawn

Valaki tudna csinálni/adni egy linket vagy csatolmányba fel rakni? hogy ha valaki meg hal akor újra éled persze deathrun módhoz

Szerző:  CocaIne.^ [2012.02.13. 08:35 ]
Hozzászólás témája:  Re: Deathrun Respawn

Kód:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>

#define MAXPLAYERS 32
#define TASK_RESPAWN 7124

new g_iRespawns[MAXPLAYERS + 1] = {0, ...};

new g_pCvar_Time;
new g_pCvar_Respawns;

public plugin_init()
{
    register_plugin("DeathRunRespawn", "0.1", "Someone over the rainbow");
    
    register_event
("DeathMsg", "eventDeath", "a");
    register_event("HLTV", "eventNewRound", "a", "1=0", "2=0");
    
    RegisterHam
(Ham_Spawn, "player", "FwdPlayerSpawn_Post", true);
    
    g_pCvar_Time 
= register_cvar("spawn_delay", "3");
    g_pCvar_Respawns = register_cvar("spawn_times", "2");
}

public eventDeath()
{
    new iVictim = read_data(2);
    new Float:flTime = get_pcvar_float(g_pCvar_Time);

    if( g_iRespawns[iVictim] < get_pcvar_num(g_pCvar_Respawns) )
    {
        client_print(iVictim, print_chat, "You will respawn in %s seconds!", flTime);
        set_task(flTime, "Respawn", iVictim + TASK_RESPAWN);
    }
    else
    
{
        remove_task(iVictim + TASK_RESPAWN);
        
        client_print
(iVictim, print_chat, "You have respawned the maximum amount of times this round.");
    }
}

public eventNewRound()
{
    new iPlayers[32], iNum, id;
    get_players(iPlayers, iNum);
    
    for
( new i = 0; i < iNum; i++ )
    {
        id = iPlayers[i];
        
        if
( is_user_connected(id) )
        {
            g_iRespawns[id] = 0;
        }
    }
}

public FwdPlayerSpawn_Post(id)
{
    if( is_user_alive(id) ) 
    
{
        remove_task(id + TASK_RESPAWN);
    }
}

public client_disconnect(id)
{
    remove_task(id + TASK_RESPAWN);
}

public Respawn(id)
{
    id -= TASK_RESPAWN;
    ExecuteHamB(Ham_CS_RoundRespawn, id);
    g_iRespawns[id]++;
}

Oldal: 1 / 1 Minden időpont UTC+02:00 időzóna szerinti
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/