AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Get full player info (https://forums.alliedmods.net/showthread.php?t=83774)

AoD90 01-15-2009 01:07

Get full player info
 
Hey all,

How can I get full player info(current frags,deaths,weapon,ammo,armor,money) to set it later from those values.

IneedHelp 01-15-2009 01:23

Re: Get full player info
 
http://amxmodx.org/funcwiki.php?search=frags&go=search
http://amxmodx.org/funcwiki.php?search=deaths&go=search

http://amxmodx.org/funcwiki.php?sear...apon&go=search
http://amxmodx.org/funcwiki.php?sear...name&go=search

http://amxmodx.org/funcwiki.php?search=armor&go=search

http://amxmodx.org/funcwiki.php?search=money&go=search

<3 FuncWiki.

AoD90 01-15-2009 01:46

Re: Get full player info
 
Thanks.

Now this. How to get info of ALL players and later how to set their info.
I tried smt like this:
Code:

    new players[32],num,i
    get_players(players,num)
    for(i = 0; i <= num; i++)
    {
        if (is_user_connected(i))
        {
          cs_get_user_money(i)
        }
    }

but it doesn't working.

@EDITED

Dores 01-15-2009 07:59

Re: Get full player info
 
Show full code.

AoD90 01-15-2009 11:36

Re: Get full player info
 
EDITED

SnoW 01-15-2009 11:44

Re: Get full player info
 
Don't know how you want it to be used later, but it can be done with global variables. Here's an example:
Code:

new money[33];
public plugin_init()
  //...
 
public function()
{
  new max_players = get_maxplayers();
  for(new i = 1; i <= max_players; i++)
                money[i] = cs_get_user_money(i)
}


AoD90 01-15-2009 11:58

Re: Get full player info
 
And later to sat that amoun of money to that player?

Dores 01-15-2009 13:14

Re: Get full player info
 
@SnoW: You forgot to check if the player is connected, which will cause issues.

@AoD: cs_set_user_money(id, amount).
If you want all of the players:
Code:
new g_iMaxPlayers; public plugin_init() {     g_iMaxPlayers = get_maxplayers(); } public AoDs_Function() {     for(new i = 1 ; i <= g_iMaxPlayers ; i++)     {         if(is_user_connected(i) && is_user_alive(i))         {             cs_set_user_money(i, amount); // Replace 'amount' with whatever.         }     } }

YamiKaitou 01-15-2009 13:16

Re: Get full player info
 
@ AoD90: Please search next time. All of your questions so far have been answered on the Function Wiki

SnoW 01-15-2009 13:38

Re: Get full player info
 
Quote:

Originally Posted by Dores (Post 744713)
@SnoW: You forgot to check if the player is connected, which will cause issues.

Actually I didn't. It was an example function that wasn't ever called(the code was in function because it would look weird without with the init and global variable).

It was just a code part, if he adds it to spawn event, then he first checks if the user is alive, if somewhere is needed only connect-check then he checks that.

And because it was for all those information, if he wants to get healths, also shouldn't use connect-check.


All times are GMT -4. The time now is 01:47.

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