Raised This Month: $ Target: $400
 0% 

All player names to one string


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Hops
Junior Member
Join Date: Mar 2006
Old 04-15-2008 , 18:27   All player names to one string
Reply With Quote #1

Helow!
could someone show me how can I put all player names into one string. I get player names like this:
Code:
get_players(Players, playerCount); for (i=0; i<playerCount; i++) {         player = Players[i];         get_user_name(player,name,31) }

lets say there is 3 players playing (bot_1, bot_2, bot_3). so I need a string containing those 3 names. like:
Code:
format(data,127,"%s",string);
output would be -> bot_1,bot_2,bot_3

p.s. sorry for my english
Hops is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-15-2008 , 18:52   Re: All player names to one string
Reply With Quote #2

Code:
new sNames[1024], sName[32]; // 32 players X 32 characters = 1024 for(new id = 1; id <= g_iMaxPlayers; id++) {     if(!is_user_connected(id))         continue;         get_user_name(id, sName, 31);     if(strlen(sNames) > 0)         format(sNames, 1023, "%s,%s", sNames, sName);     else         copy(sNames, 1023, sName); }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Hops
Junior Member
Join Date: Mar 2006
Old 04-16-2008 , 02:57   Re: All player names to one string
Reply With Quote #3

thx, that helped!
+karma
Hops 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 10:20.


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