Raised This Month: $ Target: $400
 0% 

Get the names of a Team in a String?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 07-17-2010 , 14:51   Get the names of a Team in a String?
Reply With Quote #1

Hey AM,

can you help me abit? thats my code:

PHP Code:
new names[33][35

blabla(id)
{
    new 
players[32], pnumtempid;
    
get_players(playerspnum);
    
    for( new 
ii<pnumi++ )
    {
        
tempid players[i]
        
get_user_name(idnames[tempid], 34)
    }

so how can i convert the "names" variable to a string like: "name1 name2 name2 .. name32" ?
__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers
mottzi is offline
Send a message via MSN to mottzi
AngeIII
Senior Member
Join Date: Sep 2007
Location: Latvia
Old 07-17-2010 , 15:13   Re: Get the names of a Team in a String?
Reply With Quote #2

try this:
PHP Code:
new names[33][35]  

blabla(id

    new 
players[32], pnumtempid
    
get_players(playerspnum); 
     
    for( new 
ii<pnumi++ ) 
    { 
        
tempid players[i
        
get_user_name(tempidnames[i], 34
    } 

AngeIII is offline
Send a message via Skype™ to AngeIII
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 07-17-2010 , 15:17   Re: Get the names of a Team in a String?
Reply With Quote #3

thats exactly the same thing xD

Quote:
Originally Posted by mottzi
so how can i convert the "names" variable to a string like: "name1 name2 name2 .. name32" ?
__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers
mottzi is offline
Send a message via MSN to mottzi
AngeIII
Senior Member
Join Date: Sep 2007
Location: Latvia
Old 07-17-2010 , 15:29   Re: Get the names of a Team in a String?
Reply With Quote #4

get_user_name(tempid, names[i], 34)


this isn't same..


then if you want..

PHP Code:
public check()
{
   for(new 
ii<32;i++)
   {
     
server_print("name %d is %s",i,names[i]);
   }


Last edited by AngeIII; 07-17-2010 at 15:42.
AngeIII is offline
Send a message via Skype™ to AngeIII
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 07-17-2010 , 16:31   Re: Get the names of a Team in a String?
Reply With Quote #5

It's not what he wants, but what he wants is extremely inefficient and not plausible.

Mottzi, just use an array.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 07-17-2010 , 16:34   Re: Get the names of a Team in a String?
Reply With Quote #6

PHP Code:
new names[33][32]
new 
all_names[1024]

blabla(id)
{
    new 
players[32], pnumtempidpos;
    
get_players(playerspnum);

    for( new 
ii<pnumi++ )
    {
        
tempid players[i]
        
get_user_name(idnames[tempid], 31)
        
pos += formatex(all_names[pos], 1023-pos"%s "names[tempid])
    }

__________________
Impossible is Nothing
Sylwester is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 07-18-2010 , 02:56   Re: Get the names of a Team in a String?
Reply With Quote #7

thanks, thats what i search!

PHP Code:
client_print(idprint_chatall_names
this woud work? and also when there arent 32 players?

Quote:
Originally Posted by wrecked_
It's not what he wants, but what he wants is extremely inefficient and not plausible.

Mottzi, just use an array.
but how to print every item of an array in one string?
__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers

Last edited by mottzi; 07-18-2010 at 03:22.
mottzi is offline
Send a message via MSN to mottzi
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 07-18-2010 , 03:19   Re: Get the names of a Team in a String?
Reply With Quote #8

Quote:
Originally Posted by mottzi View Post
but how to print every item of an array in one string?
Use the example Sylwester posted.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 07-18-2010 , 08:25   Re: Get the names of a Team in a String?
Reply With Quote #9

PHP Code:
client_print(idprint_chatall_names
-->

PHP Code:
client_print(idprint_chat"%s"all_names
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 07-18-2010 , 09:49   Re: Get the names of a Team in a String?
Reply With Quote #10

There is no need to add "%s". In both cases, the effect will be the same.
__________________
Impossible is Nothing
Sylwester 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 07:11.


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