Raised This Month: $51 Target: $400
 12% 

Respawn plugin edit


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kp3t3h
Senior Member
Join Date: Feb 2011
Old 12-18-2012 , 10:57   Respawn plugin edit
Reply With Quote #1

I have this respawn plugin.
What I want to be added is a cvar for defining which teams the respawn to work on. ( BOTH / T / CT )

PHP Code:
#include <amxmodx>
#include <hamsandwich>


new g_iCountdown[33]
new 
g_pCvarRespawnDelay

enum _
:PlayersTasksOffsets (+=33) {
    
TASK_PLAYER_RESPAWN,
// id %= 33 in task callback


public plugin_init()
{
    
register_plugin("Respawn""1.0""01")
    
g_pCvarRespawnDelay register_cvar("amx_respawn_delay""20")
    
RegisterHam(Ham_Killed"player""CBasePlayer_Killed_Post"true)
}

public 
CBasePlayer_Killed_Post(id)
{
    
g_iCountdown[id] = get_pcvar_num(g_pCvarRespawnDelay)

    
remove_task(id TASK_PLAYER_RESPAWN)
    
set_task(1.0"fin"id TASK_PLAYER_RESPAWN, .flags="b")
    
ShowPlayerRespawnTimeid )
    --
g_iCountdown[id]
}

ShowPlayerRespawnTimeid )
{
    
set_hudmessage(02550, -1.00.406.01.0, .channel = -1)
    
show_hudmessage(id"Respawn za : %d"g_iCountdown[id]) 
}

public 
fin(task_id)
{
    new 
id task_id 33

    
if( !is_user_connected(id) || is_user_alive(id) )
    {
        
remove_tasktask_id )
        return
    }

    if(
g_iCountdown[id] <= 0)
    {
        
remove_task(task_id)
        
ExecuteHam(Ham_CS_RoundRespawnid)
        return
    }

    
ShowPlayerRespawnTimeid )

    --
g_iCountdown[id]

__________________
need help with the following
no.1, no.2, no.3, no.4 no.5
kp3t3h is offline
Mrki_Drakula
Senior Member
Join Date: Jun 2011
Location: Serbia
Old 12-18-2012 , 11:44   Re: Respawn plugin edit
Reply With Quote #2

This would work:

PHP Code:
#include <amxmodx>
#include <hamsandwich>


new g_iCountdown[33]
new 
g_pCvarRespawnDelay
new g_pCvarRespawnTeam

enum _
:PlayersTasksOffsets (+=33) {
    
TASK_PLAYER_RESPAWN,
// id %= 33 in task callback


public plugin_init()
{
    
register_plugin("Respawn""1.0""01")
    
g_pCvarRespawnDelay register_cvar("amx_respawn_delay""20")
    
g_pCvarRespawnTeam register_cvar("amx_respawn_team""1")
    
RegisterHam(Ham_Killed"player""CBasePlayer_Killed_Post"true)
}

public 
CBasePlayer_Killed_Post(id)
{
    if(
get_pcvar_num(g_pCvarRespawnTeam) == 0)
        return 
PLUGIN_HANDLED;

    else if(
get_pcvar_num(g_pCvarRespawnTeam) == 1)
    {
        
g_iCountdown[id] = get_pcvar_num(g_pCvarRespawnDelay)
    
remove_task(id TASK_PLAYER_RESPAWN)
    
set_task(1.0"fin"id TASK_PLAYER_RESPAWN, .flags="b")
    
ShowPlayerRespawnTimeid )
    --
g_iCountdown[id]
    }
    else if(
get_pcvar_num(g_pCvarRespawnTeam) == 2)
    {
        if(
get_user_team(id) == 1)
    {
        
g_iCountdown[id] = get_pcvar_num(g_pCvarRespawnDelay)
        
remove_task(id TASK_PLAYER_RESPAWN)
        
set_task(1.0"fin"id TASK_PLAYER_RESPAWN, .flags="b")
        
ShowPlayerRespawnTimeid )
        --
g_iCountdown[id]
    }
    else
    {
        return 
PLUGIN_HANDLED;
    }
    }
    else if(
get_pcvar_num(g_pCvarRespawnTeam) == 3)
    {
        if(
get_user_team(id) == 2)
    {
        
g_iCountdown[id] = get_pcvar_num(g_pCvarRespawnDelay)
        
remove_task(id TASK_PLAYER_RESPAWN)
        
set_task(1.0"fin"id TASK_PLAYER_RESPAWN, .flags="b")
        
ShowPlayerRespawnTimeid )
        --
g_iCountdown[id]
    }
    else
    {
        return 
PLUGIN_HANDLED;
    }
    } 
}

ShowPlayerRespawnTimeid )
{
    
set_hudmessage(02550, -1.00.406.01.0, .channel = -1)
    
show_hudmessage(id"Respawn za : %d"g_iCountdown[id]) 
}

public 
fin(task_id)
{
    new 
id task_id 33

    
if( !is_user_connected(id) || is_user_alive(id) )
    {
        
remove_tasktask_id )
        return
    }

    if(
g_iCountdown[id] <= 0)
    {
        
remove_task(task_id)
        
ExecuteHam(Ham_CS_RoundRespawnid)
        return
    }

    
ShowPlayerRespawnTimeid )

    --
g_iCountdown[id]

Cvar: amx_respawn_team ( 0 - off / 1 - both / 2 - t team / 3 - ct team )
Hope it does the job
__________________
-----------------------------------------------
Best regards,
David Snajder (aka Crysis)

Last edited by Mrki_Drakula; 12-18-2012 at 11:45.
Mrki_Drakula is offline
Send a message via MSN to Mrki_Drakula Send a message via Skype™ to Mrki_Drakula
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-19-2012 , 01:20   Re: Respawn plugin edit
Reply With Quote #3

@drakula
HORRIBLE CODE


@kp3t3h

amx_respawn_team 0 disabled, 1 Ts, 2 CTs, 3 both teams

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

const m_iTeam 114

new g_iCountdown[33]
new 
g_pCvarRespawnDelay
new g_pCvarRespawnTeam

enum _
:PlayersTasksOffsets (+=33) {
    
TASK_PLAYER_RESPAWN,
// id %= 33 in task callback


public plugin_init()
{
    
register_plugin("Respawn""1.0""01")
    
g_pCvarRespawnDelay register_cvar("amx_respawn_delay""20")
    
g_pCvarRespawnTeam register_cvar("amx_respawn_team""3")
    
RegisterHam(Ham_Killed"player""CBasePlayer_Killed_Post"true)
}

public 
CBasePlayer_Killed_Post(id)
{
    
remove_task(id TASK_PLAYER_RESPAWN)
    if( 
get_pcvar_num(g_pCvarRespawnTeam) & get_pdata_int(idm_iTeam) )
    {
        
g_iCountdown[id] = get_pcvar_num(g_pCvarRespawnDelay)

        
set_task(1.0"fin"id TASK_PLAYER_RESPAWN, .flags="b")
        
fin(id TASK_PLAYER_RESPAWN)
    }
}

public 
fin(task_id)
{
    new 
id task_id 33

    
if( !is_user_connected(id) || is_user_alive(id) )
    {
        
remove_tasktask_id )
        return
    }

    new 
iCountDown g_iCountdown[id]
    if(
iCountDown <= 0)
    {
        
remove_task(task_id)
        
ExecuteHam(Ham_CS_RoundRespawnid)
        return
    }

    
set_hudmessage(02550, -1.00.406.01.0, .channel = -1)
    
show_hudmessage(id"Respawn za : %d"iCountDown

    --
g_iCountdown[id]

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:52.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode