Raised This Month: $ Target: $400
 0% 

Get full player info


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 01-15-2009 , 11:44   Re: Get full player info
Reply With Quote #1

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)
}
SnoW is offline
Send a message via MSN to SnoW
AoD90
Senior Member
Join Date: Jul 2008
Location: Ugljevik/RS/BIH
Old 01-15-2009 , 11:58   Re: Get full player info
Reply With Quote #2

And later to sat that amoun of money to that player?
AoD90 is offline
Send a message via MSN to AoD90
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 01-15-2009 , 13:14   Re: Get full player info
Reply With Quote #3

@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.         }     } }

Last edited by Dores; 01-15-2009 at 13:18.
Dores is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 01-15-2009 , 13:38   Re: Get full player info
Reply With Quote #4

Quote:
Originally Posted by Dores View Post
@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.

Last edited by SnoW; 01-15-2009 at 13:43.
SnoW is offline
Send a message via MSN to SnoW
Old 01-15-2009, 13:49
AoD90
This message has been deleted by AoD90.
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 01-15-2009 , 13:51   Re: Get full player info
Reply With Quote #6

Quote:
Originally Posted by SnoW View Post
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.
If his going to get/set the player's info when the player spawns, he doesn't need both my and your codes since his doing an each-player method of setting the info.

Quote:
Originally Posted by anakin_cstrike View Post
Is enought to check if he's alive.
I know.

Quote:
Originally Posted by AoD90 View Post
@Dores
Can I replace it with SnoW's function money[i]?
I guess you can, but it's not such a good idea since the player's money might change without the money[] variable to be updated.

Last edited by Dores; 01-15-2009 at 14:00.
Dores is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 01-15-2009 , 14:39   Re: Get full player info
Reply With Quote #7

Quote:
Originally Posted by Dores View Post
If his going to get/set the player's info when the player spawns, he doesn't need both my and your codes since his doing an each-player method of setting the info.
Hmm... You are talking to me. I -don't know/wasn't talking- anything about attaching our codes together. If you was answering to him, just leave it like that
SnoW is offline
Send a message via MSN to SnoW
AoD90
Senior Member
Join Date: Jul 2008
Location: Ugljevik/RS/BIH
Old 01-15-2009 , 15:52   Re: Get full player info
Reply With Quote #8

I still don't know how to get player wepons and later to give that weapons to player...
AoD90 is offline
Send a message via MSN to AoD90
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 01-15-2009 , 15:57   Re: Get full player info
Reply With Quote #9

Quote:
Originally Posted by SnoW View Post
Hmm... You are talking to me. I -don't know/wasn't talking- anything about attaching our codes together. If you was answering to him, just leave it like that
Huh?
1) I was talking to you - I wrote that right below a quote of yours...
2) I didn't meant combining our codes together, I meant that no matter what code he uses, mine or yours, if AoD's going to change a player's info when the player spawns like you said AoD might do, he(AoD) won't need any of the codes we gave him(not together...).

Quote:
Originally Posted by AoD90
I still don't know how to get player wepons and later to give that weapons to player...
Do you want to save the player's weapons and give them to him back when he respawns?
Dores is offline
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 01-15-2009 , 13:48   Re: Get full player info
Reply With Quote #10

Quote:
Originally Posted by Dores View Post
@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. } } }
Is enought to check if he's alive.
__________________

anakin_cstrike 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 01:47.


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