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

Count players in a team (respawn)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sudzone
Member
Join Date: Jan 2010
Location: Bucharest
Old 05-23-2012 , 18:36   Count players in a team (respawn)
Reply With Quote #1

Quote:
new const VERSION[] = "1.1"

#include <amxmodx>
#include <fun>
#include <cstrike>
#include <ChatColor>

public plugin_init(){

register_plugin("Respawn Forever", VERSION, "Pimp Daddy (OoTOAoO)")

register_event("DeathMsg","on_Death","a")

register_cvar("sv_respawn", "1")
register_cvar("mp_minplayers", "2")

register_cvar("respawn_forever_version", VERSION, FCVAR_SERVER)

register_clcmd("say","on_Chat")
register_clcmd("say_team","on_Chat")
}

public on_Chat(id)
{
if ( !get_cvar_num("sv_respawn") )
{
player_color(id, "!v*** !cRespawn Plugin is off !")
return PLUGIN_CONTINUE
}

new szSaid[32]
read_args(szSaid, 31)

if (equali(szSaid,"^"/respawn^"") || equali(szSaid,"^"respawn^""))
{
spawn_func(id)
}
return PLUGIN_CONTINUE
}

public spawn_func(id)
{
new parm[1]
parm[0]=id

/* Spawn the player twice to avoid the HL engine bug */
set_task(0.5,"player_spawn",72,parm,1)
//set_task(0.7,"player_spawn",72,parm,1)

/* Then give them a suit and a knife */
set_task(0.9,"player_giveitems",72,parm,1)
}

public on_Death()
{
if ( !get_cvar_num("sv_respawn") )
return PLUGIN_CONTINUE

new numplayers = get_playersnum()
new minplayers = get_cvar_num("mp_minplayers")
new victim_id = read_data(2)

if(cs_get_user_team(victim_id) == CS_TEAM_T && numplayers >= minplayers) {
spawn_func( victim_id )
}

if(cs_get_user_team(victim_id) == CS_TEAM_T && numplayers >= minplayers) {
spawn_func( victim_id )
}

return PLUGIN_CONTINUE
}

public player_giveitems(parm[1])
{
new id = parm[0]

give_item(id, "item_suit")
give_item(id, "weapon_knife")

return PLUGIN_CONTINUE
}

public player_spawn(parm[1])
{
spawn(parm[0])
}
Wrong format i want -> if in team T is min two players respawn players who dying and if in team CT is min two players respawn players who dying

Tks,

Last edited by sudzone; 05-23-2012 at 18:37.
sudzone is offline
Send a message via Yahoo to sudzone
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 05-23-2012 , 18:41   Re: Count players in a team (respawn)
Reply With Quote #2

Use tags [ php ] [ / php ] instead of [ code ] [ / code ].

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

enum
{
  
TEAM_UNASSIGNED,
  
TEAM_RED,
  
TEAM_BLUE,
  
TEAM_SPECTATOR
};

#define OFFSET_TEAM 114

get_player_pure_teamiPlayer )
  return 
get_pdata_intiPlayerOFFSET_TEAM );

GetPlayersCountiTeam )
{
  static 
iiCountiMaxClients;

  if( !
iMaxClients )
    
iMaxClients get_maxplayers( );

  
iCount 0;

  for( 
1iMaxClients 1i++ )
    if( 
is_user_connected) && get_player_pure_team) == iTeam )
      
iCount++;

  return 
iCount;
}

public 
MyFunction( )
{
  static 
iCTsiTs;

  
iCTs GetPlayersCountTEAM_BLUE );
  
iTs GetPlayersCountTEAM_RED );

__________________
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-23-2012 , 19:05   Re: Count players in a team (respawn)
Reply With Quote #3

You want to do that because you don't know how to block round end ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
sudzone
Member
Join Date: Jan 2010
Location: Bucharest
Old 05-24-2012 , 03:32   Re: Count players in a team (respawn)
Reply With Quote #4

Quote:
Originally Posted by ConnorMcLeod View Post
You want to do that because you don't know how to block round end ?
No, i don't want to block round end, if in team T is one player and is killed = new round, if is two players and one is killed = respawn :p

claudiuhks please you can modify ?
Min 3 players for respawn in team Ts
Min 2 players for respawn in team CTs

PHP Code:
new const VERSION[] =    "1.1"

#include <amxmodx>
#include <fun>
#include <cstrike>
#include <fakemeta>
#include <ChatColor>

enum
{
  
TEAM_UNASSIGNED,
  
TEAM_RED,
  
TEAM_BLUE,
  
TEAM_SPECTATOR
};

#define OFFSET_TEAM 114 

public plugin_init(){

    
register_plugin("Respawn Forever"VERSION"Pimp Daddy (OoTOAoO)")

    
register_event("DeathMsg","on_Death","a")

    
register_cvar("sv_respawn""1")

    
register_cvar("respawn_forever_version"VERSIONFCVAR_SERVER)

    
register_clcmd("say","on_Chat")
    
register_clcmd("say_team","on_Chat")
}

public 
on_Chat(id)
{
    if ( !
get_cvar_num("sv_respawn") )
    {
        
player_color(id"!v*** !cRespawn Plugin is off!")
        return 
PLUGIN_CONTINUE
    
}

    new 
szSaid[32]
    
read_args(szSaid31

    if (
equali(szSaid,"^"/respawn^"") || equali(szSaid,"^"respawn^""))
    {
        
spawn_func(id)
    }
    return 
PLUGIN_CONTINUE
}

public 
spawn_func(id)
{
    new 
parm[1]
    
parm[0]=id
    
    
/* Spawn the player twice to avoid the HL engine bug */
    
set_task(0.5,"player_spawn",72,parm,1)
    
//set_task(0.7,"player_spawn",72,parm,1)

    /* Then give them a suit and a knife */
    
set_task(0.9,"player_giveitems",72,parm,1)
}

get_player_pure_teamiPlayer )
  return 
get_pdata_intiPlayerOFFSET_TEAM );

GetPlayersCountiTeam )
{
  static 
iiCountiMaxClients;

  if( !
iMaxClients )
    
iMaxClients get_maxplayers( );

  
iCount 0;

  for( 
1iMaxClients 1i++ )
    if( !
is_user_bot(i) && is_user_connected) && get_player_pure_team) == iTeam )
      
iCount++;

  return 
iCount;
}

public 
on_Death()
{
    if ( !
get_cvar_num("sv_respawn") )
        return 
PLUGIN_CONTINUE
    
    
new victim_id read_data(2)
    static 
iCTsiTs;

    
iCTs GetPlayersCountTEAM_BLUE );
    
iTs GetPlayersCountTEAM_RED );

    if(
iCTs) {
        
spawn_funcvictim_id )
    } 

    if(
iTs) {
        
spawn_funcvictim_id )
    }

    return 
PLUGIN_CONTINUE
}

public 
player_giveitems(parm[1])
{
    new 
id parm[0]

    
give_item(id"item_suit")
    
give_item(id"weapon_knife")

    return 
PLUGIN_CONTINUE
}

public 
player_spawn(parm[1])
{
    
spawn(parm[0])


Last edited by sudzone; 05-24-2012 at 06:25.
sudzone is offline
Send a message via Yahoo to sudzone
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 05-24-2012 , 07:51   Re: Count players in a team (respawn)
Reply With Quote #5

I don't understand what do you want to do.
Please be more explicit.
__________________
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
sudzone
Member
Join Date: Jan 2010
Location: Bucharest
Old 05-24-2012 , 09:50   Re: Count players in a team (respawn)
Reply With Quote #6

Quote:
Originally Posted by claudiuhks View Post
I don't understand what do you want to do.
Please be more explicit.
I want to do modification to plugin posted of me... like this

To T team Respawn players only if in team is three players except bots
To CT team Respawn players only if in team is two players except bots

Example:
Quote:
in team T is only one player = don't respawn player when dying
in team Ct is only one player = don't respawn player when dying

If in team Ct is two players or more = respawn player when dying
If in team T is two players or more = respawn player when dying
sudzone is offline
Send a message via Yahoo to sudzone
Old 05-24-2012, 09:50
Santaaa
This message has been deleted by Santaaa.
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 09:36.


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