AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   change any players hp/ap/e.g. and how does i get player id (https://forums.alliedmods.net/showthread.php?t=94875)

timian 06-16-2009 16:24

change any players hp/ap/e.g. and how does i get player id
 
how do i change all players stats?


i know this code, but how did i get a players id!?
set_user_health(id, health)

AntiBots 06-16-2009 16:39

Re: change any players hp/ap/e.g. and how does i get player id
 
PHP Code:

public lala()
{
    for( new 
1<= 32i++ )
    {
        if( 
is_user_alive(i) )
        {
            
set_user_health(i250);
        }
    }



SnoW 06-16-2009 17:01

Re: change any players hp/ap/e.g. and how does i get player id
 
Quote:

Originally Posted by AntiBots (Post 850387)
PHP Code:

public lala()
{
    for( new 
1<= 32i++ )
    {
        if( 
is_user_alive(i) )
        {
            
set_user_health(i250);
        }
    }



You should use get_maxplayers() or get_players.

timian 06-16-2009 17:08

Re: change any players hp/ap/e.g. and how does i get player id
 
snow - does you mean that get_players() return players id?

and thanks for the code :D

AntiBots 06-16-2009 17:11

Re: change any players hp/ap/e.g. and how does i get player id
 
Quote:

Originally Posted by SnoW (Post 850398)
You should use get_maxplayers() or get_players.

Yes, I do on NoteBlock so I do very simple. Sorry

@timian to get a Specific player Id use get_player( ......... ) se amxmodx.inc

also if you use the loop put a variable = get_maxplayers() on plugin_init and then replace 32->The_Variable_Name

timian 06-16-2009 17:17

Re: change any players hp/ap/e.g. and how does i get player id
 
Code:

public set_stats {
    for(new i = 1; i <= 32; i++) {
        if(is_user_alive(i)) {
            set_user_health(i, 400)
            set_user_maxspeed(i, float:speed = 5.0)
        }
    }
}

does this work? and is it right that i just can complie it to get my answer?

AntiBots 06-16-2009 17:32

Re: change any players hp/ap/e.g. and how does i get player id
 
set_stats() <- void argument but you need tu put (), also if you only need to put set_user_maxspeed(i, 5.0) and replace the 32. with a variable with get_maxplayers()

timian 06-16-2009 17:42

Re: change any players hp/ap/e.g. and how does i get player id
 
don't understand!?

would this work!? xD

Code:

public set_stats {
    for(new i = 1; i <= get_max_player; i++) {
        if(is_user_alive(i)) {
            set_user_health(i, 400)
            set_user_maxspeed(i, float:speed = 5.0)
        }
    }
}


AntiBots 06-16-2009 17:59

Re: change any players hp/ap/e.g. and how does i get player id
 
PHP Code:

public set_stats()
{
    for(new 
1<= get_max_playeri++) 
    {
        if(
is_user_alive(i)) 
        {
            
set_user_health(i400)
            
set_user_maxspeed(i320.0)
        }
    }



timian 06-16-2009 18:21

Re: change any players hp/ap/e.g. and how does i get player id
 
ahh can think i forgot that! :P thanks alot!


All times are GMT -4. The time now is 13:55.

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