Raised This Month: $ Target: $400
 0% 

Elimination


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ratonel
Member
Join Date: Jul 2012
Location: Romania
Old 09-23-2012 , 13:53   Elimination
Reply With Quote #1

I want to make an elimination plugin. It's a respawning plugin that respawns a player only after his killer is dead.

I modified Wrecked's version (I haven't test it) to cover more situations. It doesn't work all the time and the messages apear too many times. I must admit that I didn't quite understood his method.


Sorry for any mistakes

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

#define ADVERTISE_TIME  30.0

new Killed[33][31]
new 
KillIndex[33// to keep count



public plugin_init()
{
    
register_plugin"Elimination""1.5, "whatever" )
    register_event( "
DeathMsg", "eDeathMsg", "a" );
    set_task( ADVERTISE_TIME, "
TaskAdvertise", .flags="b" )
}

public eDeathMsg()
{
    new iKiller = read_data(1);
    new iVictim = read_data(2);
    static sWeapon[16]; 
    read_data( 4, sWeapon, sizeof( sWeapon ) - 1 );
    
    if( iKiller == iVictim && equal( sWeapon, "
world", 5 ) ) //suicide
    {
        set_task( 3.0, "
TaskRespawn", iVictim )
        ChatColor( iVictim, "
!gVei fi respawnat in 3 secunde." )
    }
    
    if( !iKiller && equal( sWeapon, "
world", 5 ) )  //fall
    {
        set_task( 3.0, "
TaskRespawn", iVictim )
        ChatColor( iVictim, "
!gVei fi respawnat in 3 secunde." )
    }   
    
    if( !iKiller && equal( sWeapon, "
door", 4 ) )  //door
    {
        set_task( 3.0, "
TaskRespawn", iVictim )
        ChatColor( iVictim, "
!gVei fi respawnat in 3 secunde." )
    }   
    
    if( !iKiller && equal( sWeapon, "
trigger_hurt", 12 ) )  //trigger
    {
        set_task( 3.0, "
TaskRespawn", iVictim )
        ChatColor( iVictim, "
!gVei fi respawnat in 3 secunde." )
    }   
    if( cs_get_user_team( iKiller ) == cs_get_user_team( iVictim ) )
    {
        set_task( 3.0, "
TaskRespawn", iVictim )
        ChatColor( iVictim, "
!gVei fi respawnat in 3 secunde." )
    } 
    new i
    new vname[32]
    get_user_name( iVictim, vname, 31 )
    
    while( Killed[iVictim][++i] )
    {
        if( !is_user_alive( i ) )
        {
            ExecuteHamB( Ham_CS_RoundRespawn, i )
            ChatColor( i, "
!g%s A muritVei fi respawnat.", vname )
        }
    }
    
    arrayset( Killed[iVictim], 0, 31 )
    KillIndex[iVictim] = 0
    
    new kname[32]
    get_user_name( iKiller, kname, 31 )
    
    ChatColor( iVictim, "
!gVei fi respawnat cand %s moare.", kname )
    
    Killed[iKiller][KillIndex[iKiller]++] = iVictim
    
}

public TaskAdvertise()
{
    ChatColor( 0, "
!gJoci GunGame Elimination Vei fi respawnat doar atunci cand cel ce te-a ucis moare." )
}

public TaskRespawn( id )
{
    if( !is_user_alive( id ) )
    {
        ExecuteHamB( Ham_CS_RoundRespawn, id )
    }
}

ChatColor( id, const input[], any:... )
{
new count = 1;
new players[32];
static msg[191];
vformat(msg, 190, input, 3);

replace_all(msg, 190, "
!g", "^4"); // Green Color
replace_all(msg, 190, "
!y", "^1"); // Default Color

if (id)
    players[0] = id; 
    else
        get_players(players, count, "
ch");
    for (new i = 0; i < count; i++)
    {
        if (is_user_connected(players[i]))
        {
            message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("
SayText"), _, players[i]);
            write_byte(players[i]);
            write_string(msg);
            message_end();
        }
    }


Last edited by Ratonel; 09-23-2012 at 13:54.
Ratonel is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 09-23-2012 , 14:03   Re: Elimination
Reply With Quote #2

if you haven't tested it....how do you know it doesn't work?
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
Ratonel
Member
Join Date: Jul 2012
Location: Romania
Old 09-23-2012 , 14:07   Re: Elimination
Reply With Quote #3

Quote:
Originally Posted by Liverwiz View Post
if you haven't tested it....how do you know it doesn't work?
I haven't test Wrecked's original version. I just assume that is working. Like I said, I didn't understood his method.
Ratonel is offline
Ratonel
Member
Join Date: Jul 2012
Location: Romania
Old 10-16-2012 , 08:29   Re: Elimination
Reply With Quote #4

Anyone? I really need this plugin.
Ratonel is offline
vitorrossi
Senior Member
Join Date: Apr 2012
Location: NY, USA
Old 10-16-2012 , 21:58   Re: Elimination
Reply With Quote #5

Instead of making all these cases I think you should just check the teams. If iKiller's team is CT and iVictim's team is T (the other way around as well) then you save iKiller's and iVictim's ids in a matrix and compare iVictims with previously saved iKiller's ids. If iVictim had killed anyone then respawn them
vitorrossi is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 10-17-2012 , 14:10   Re: Elimination
Reply With Quote #6

PHP Code:
register_plugin"Elimination""1.5, "whatever" ) 
-->
PHP Code:
register_plugin"Elimination""1.5""whatever" 
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
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 08:21.


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