AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Elimination (https://forums.alliedmods.net/showthread.php?t=196630)

Ratonel 09-23-2012 13:53

Elimination
 
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();
        }
    }



Liverwiz 09-23-2012 14:03

Re: Elimination
 
if you haven't tested it....how do you know it doesn't work?

Ratonel 09-23-2012 14:07

Re: Elimination
 
Quote:

Originally Posted by Liverwiz (Post 1804749)
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 10-16-2012 08:29

Re: Elimination
 
Anyone? I really need this plugin.

vitorrossi 10-16-2012 21:58

Re: Elimination
 
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

Neeeeeeeeeel.- 10-17-2012 14:10

Re: Elimination
 
PHP Code:

register_plugin"Elimination""1.5, "whatever" ) 

-->
PHP Code:

register_plugin"Elimination""1.5""whatever" 



All times are GMT -4. The time now is 08:21.

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