AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   round start give health (https://forums.alliedmods.net/showthread.php?t=206864)

RuRuRu612754 01-26-2013 20:28

round start give health
 
where is the problem?
compile is success.
however echo error by hlds.
[CSTRIKE] Player out og range (0)
[AMXX] Run time error 10 (plugin "round_start_give_health.amxx") "native "cs_get_user_team") - debug not enable!
what is this?

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

#define PLUGIN "Health Fix"
#define VERSION "1.0"
#define AUTHOR "AUTHOR"

#define T_ARMOR 155
#define T_HEALTH 155
#define CT_ARMOR 255
#define CT_HEALTH 255

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_logevent("RoundStart"2"1=Round_Start");
}

public 
RoundStart()
{
    new 
Players[32
    new 
playerCountiplayer 
    get_players
(PlayersplayerCount"b"
    for (
i=0i<playerCounti++) 
        
player Players[i
        
    if(
cs_get_user_team(player) == CS_TEAM_T) {
        
set_user_armor(playerT_ARMOR);
        
set_user_health(playerT_HEALTH);
    } else {
        
set_user_armor(playerCT_ARMOR);
        
set_user_health(playerCT_HEALTH);
    }
    return 
PLUGIN_HANDLED;



wickedd 01-26-2013 21:50

Re: round start give health
 
PHP Code:

get_players(PlayersplayerCount"b"

:arrow:

PHP Code:

get_players(PlayersplayerCount"a"


RuRuRu612754 01-26-2013 22:00

Re: round start give health
 
Quote:

Originally Posted by wickedd (Post 1881392)
PHP Code:

get_players(PlayersplayerCount"b"

:arrow:

PHP Code:

get_players(PlayersplayerCount"a"


thanks so much.

RuRuRu612754 01-26-2013 22:30

Re: round start give health
 
Quote:

Originally Posted by wickedd (Post 1881392)
PHP Code:

get_players(PlayersplayerCount"b"

:arrow:

PHP Code:

get_players(PlayersplayerCount"a"


PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

#define PLUGIN "HNS Fix"
#define VERSION "1.0"
#define AUTHOR "k725"

#define T_ARMOR 155
#define T_HEALTH 155
#define CT_ARMOR 255
#define CT_HEALTH 255

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_logevent("RoundStart"2"1=Round_Start");
}

public 
RoundStart()
{
    new 
Players[32
    new 
playerCountiplayer 
    get_players
(PlayersplayerCount"a"
    for (
i=0i<playerCounti++) 
        
player Players[i
        
    if(
cs_get_user_team(player) == CS_TEAM_T) {
        
set_user_armor(playerT_ARMOR);
        
set_user_health(playerT_HEALTH);
    } else {
        
set_user_armor(playerCT_ARMOR);
        
set_user_health(playerCT_HEALTH);
    }
    
    return 
PLUGIN_HANDLED;


hmm... some error.
i think does not worked cs_get_user_team.

wickedd 01-26-2013 23:03

Re: round start give health
 
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

#define PLUGIN "HNS Fix"
#define VERSION "1.0"
#define AUTHOR "k725"

#define T_ARMOR 155
#define T_HEALTH 155
#define CT_ARMOR 255
#define CT_HEALTH 255

public plugin_init( ) 
{
    
register_pluginPLUGINVERSIONAUTHOR );
    
    
register_logevent"RoundStart"2"1=Round_Start" );
}

public 
RoundStart( )
{
    new 
Players32 ], szNumi
    get_players
PlayersszNum"a" 
    
    for ( 
0szNumi++ ) 
    {    
        new 
player Players];
        
        if( 
cs_get_user_teamplayer ) == CS_TEAM_T 
        {
            
set_user_armorplayerT_ARMOR );
            
set_user_healthplayerT_HEALTH );
        } 
        else 
        {
            
set_user_armorplayerCT_ARMOR );
            
set_user_healthplayerCT_HEALTH );
        }
    }



RuRuRu612754 01-27-2013 02:24

Re: round start give health
 
Quote:

Originally Posted by wickedd (Post 1881432)
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

#define PLUGIN "HNS Fix"
#define VERSION "1.0"
#define AUTHOR "k725"

#define T_ARMOR 155
#define T_HEALTH 155
#define CT_ARMOR 255
#define CT_HEALTH 255

public plugin_init( ) 
{
    
register_pluginPLUGINVERSIONAUTHOR );
    
    
register_logevent"RoundStart"2"1=Round_Start" );
}

public 
RoundStart( )
{
    new 
Players32 ], szNumi
    get_players
PlayersszNum"a" 
    
    for ( 
0szNumi++ ) 
    {    
        new 
player Players];
        
        if( 
cs_get_user_teamplayer ) == CS_TEAM_T 
        {
            
set_user_armorplayerT_ARMOR );
            
set_user_healthplayerT_HEALTH );
        } 
        else 
        {
            
set_user_armorplayerCT_ARMOR );
            
set_user_healthplayerCT_HEALTH );
        }
    }



sorry><
i made ​​a miss simple.
thanks so much.

YamiKaitou 01-27-2013 04:01

Re: round start give health
 
Quote:

Originally Posted by michal123 (Post 1881528)
You must check, is player alive, because you give health and armor.

Using get_players with the 'a' flag will only return alive clients, no need to check if they are alive again.


All times are GMT -4. The time now is 20:36.

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