Raised This Month: $ Target: $400
 0% 

[SOLVED Think?] Is This Possible With Set_Task?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 06-14-2013 , 06:31   [SOLVED Think?] Is This Possible With Set_Task?
Reply With Quote #1

im trying to put certain players over to Spec team then split sec later set them back to the team they were on... attempting to force other team winning... but im not having much luck...

before you ask ive already looked at Force Team Win & Round Terminator
but i dont want to use them as the code in them for what i want is over kill.. im trying to do it with less amount of code possible

Code:
stock ForceTeamLose( CsTeams:team ) {     new player[ 32 ], num, player2[ 32 ], num2;     get_players( player, num, g_flags_ae, team == CS_TEAM_T ? g_team_t : g_team_ct );     get_players( player2, num2, g_flags_ae, team == CS_TEAM_CT ? g_team_t : g_team_ct );     if (!num ) // no alive players in team(s)         return PLUGIN_HANDLED;         for( new i = 0; i < num; ++i ) {         cs_set_user_team( player[ i ], CS_TEAM_SPECTATOR);     }             for( new i = 0; i < num; ++i )         set_task( 0.01, "ReturnPlayersTeam", player[ i ] + team );         return PLUGIN_CONTINUE; } stock ReturnPlayersTeam( id, CsTeams:team ) {     cs_set_user_team( id, team); }

my mind is stumped with this
__________________
Blizzard_87 is offline
alonelive
Senior Member
Join Date: Jan 2011
Location: Big snow country.. :)
Old 06-14-2013 , 08:57   Re: Is This Possible With Set_Task?
Reply With Quote #2

PHP Code:
stock ForceTeamLose( )
{
    new 
players32 ], numteam30 ]    // store team of each player
    
if (!num ) return PLUGIN_HANDLED;    // no alive players in team(s)
        
    
    
for( new 0num; ++)
    {
        
cs_set_user_teamplayers], team] );
    }
        
    for( new 
0num; ++)
    {
        
set_task0.01"ReturnPlayersTeam"player] + team]);
    }
    
    return 
PLUGIN_CONTINUE;
}

stock ReturnPlayersTeamidteam )
{
    
cs_set_user_teamidteam);

Mb this?
__________________
sorry my bad english...
alonelive is offline
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 06-14-2013 , 09:02   Re: Is This Possible With Set_Task?
Reply With Quote #3

Quote:
Originally Posted by alonelive View Post
PHP Code:
stock ForceTeamLose( )
{
    new 
players32 ], numteam30 ]    // store team of each player
    
if (!num ) return PLUGIN_HANDLED;    // no alive players in team(s)
        
    
    
for( new 0num; ++)
    {
        
cs_set_user_teamplayers], team] );
    }
        
    for( new 
0num; ++)
    {
        
set_task0.01"ReturnPlayersTeam"player] + team]);
    }
    
    return 
PLUGIN_CONTINUE;
}

stock ReturnPlayersTeamidteam )
{
    
cs_set_user_teamidteam);

Mb this?
nah tried something similar and as soon as round ended the forloop stoped and players stuck in spec.
__________________
Blizzard_87 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-14-2013 , 20:37   Re: Is This Possible With Set_Task?
Reply With Quote #4

FYI, minimum time for set_task() is 0.1
__________________
fysiks is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 06-14-2013 , 21:31   Re: Is This Possible With Set_Task?
Reply With Quote #5

How is using Round Terminator overkill? The amount of lines of code has nothing to do eith efficiency, its how you use those lines. Not to mention that in your plugin you only need to use the include and then after that its one line of code to end the round.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 06-14-2013 , 21:46   Re: Is This Possible With Set_Task?
Reply With Quote #6

I now use both round term and slay losers. Changable by cvar
__________________
Blizzard_87 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-15-2013 , 13:24   Re: Is This Possible With Set_Task?
Reply With Quote #7

PHP Code:
ForceTeamLooseiTeam )
{
    new 
players[32], num;
    if( 
<= iTeam <= )
    {
        
get_players(playersnum"ae"iTeam == "CT" "TERRORIST");
        if( 
num )
        {
            new 
i;
            for(
i=num-1i>=0i--)
            {
                if( !
)
                {
                    new 
idiMsgBlock get_msg_block(gmsgDeathMsg);
                    
set_msg_block(gmsgDeathMsgBLOCK_SET);
                    
id players[i];
                    
entity_set_float(idEV_FL_fragsentity_get_float(idEV_FL_frags) + 1.0);
                    
set_pdata_int(idm_iDeathsget_pdata_int(idm_iDeaths) - 1);
                    
dllfunc(DLLFunc_ClientKillid);
                    
set_msg_block(gmsgDeathMsgiMsgBlock);
                }
                else
                {
                    
entity_set_int(players[i], EV_INT_deadflagDEAD_DEAD);
                }
            }
            for(
i=1i<numi++)
            {
                
entity_set_int(players[i], EV_INT_deadflagDEAD_NO);
            }
        }
    }

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 06-15-2013 at 13:29.
ConnorMcLeod is offline
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 06-15-2013 , 13:39   Re: Is This Possible With Set_Task?
Reply With Quote #8

Quote:
Originally Posted by ConnorMcLeod View Post
PHP Code:
ForceTeamLooseiTeam )
{
    new 
players[32], num;
    if( 
<= iTeam <= )
    {
        
get_players(playersnum"ae"iTeam == "CT" "TERRORIST");
        if( 
num )
        {
            new 
i;
            for(
i=num-1i>=0i--)
            {
                if( !
)
                {
                    new 
idiMsgBlock get_msg_block(gmsgDeathMsg);
                    
set_msg_block(gmsgDeathMsgBLOCK_SET);
                    
id players[i];
                    
entity_set_float(idEV_FL_fragsentity_get_float(idEV_FL_frags) + 1.0);
                    
set_pdata_int(idm_iDeathsget_pdata_int(idm_iDeaths) - 1);
                    
dllfunc(DLLFunc_ClientKillid);
                    
set_msg_block(gmsgDeathMsgiMsgBlock);
                }
                else
                {
                    
entity_set_int(players[i], EV_INT_deadflagDEAD_DEAD);
                }
            }
            for(
i=1i<numi++)
            {
                
entity_set_int(players[i], EV_INT_deadflagDEAD_NO);
            }
        }
    }

just amazing
EpicMonkey is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-15-2013 , 13:57   Re: Is This Possible With Set_Task?
Reply With Quote #9

Not really, and still 1 player has to be sacrificed.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 06-15-2013 , 17:45   Re: Is This Possible With Set_Task?
Reply With Quote #10

Quote:
Originally Posted by ConnorMcLeod View Post
PHP Code:
ForceTeamLooseiTeam )
{
    new 
players[32], num;
    if( 
<= iTeam <= )
    {
        
get_players(playersnum"ae"iTeam == "CT" "TERRORIST");
        if( 
num )
        {
            new 
i;
            for(
i=num-1i>=0i--)
            {
                if( !
)
                {
                    new 
idiMsgBlock get_msg_block(gmsgDeathMsg);
                    
set_msg_block(gmsgDeathMsgBLOCK_SET);
                    
id players[i];
                    
entity_set_float(idEV_FL_fragsentity_get_float(idEV_FL_frags) + 1.0);
                    
set_pdata_int(idm_iDeathsget_pdata_int(idm_iDeaths) - 1);
                    
dllfunc(DLLFunc_ClientKillid);
                    
set_msg_block(gmsgDeathMsgiMsgBlock);
                }
                else
                {
                    
entity_set_int(players[i], EV_INT_deadflagDEAD_DEAD);
                }
            }
            for(
i=1i<numi++)
            {
                
entity_set_int(players[i], EV_INT_deadflagDEAD_NO);
            }
        }
    }

this would only get executed after the VIP is killed. so would it still sacrifice a player?
__________________
Blizzard_87 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 12:47.


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