Raised This Month: $51 Target: $400
 12% 

Using get_user_team in a loop, returns (-1)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HLM
Senior Member
Join Date: Apr 2008
Location: C:\WINDOWS\System32
Old 10-05-2010 , 19:35   Using get_user_team in a loop, returns (-1)
Reply With Quote #1

PHP Code:
new iPlayers[32], iNum
get_players
(iPlayersiNum)
for(new 
0iNumi++)
{
    
client_print(0print_chat"%d",  get_user_team(i))

what am I doing wrong? also: I tested this with and without bots, it reports correct team numbers for bots, but human players have a -1.
__________________
+|- KARMA Respectively

HLM is offline
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 10-05-2010 , 19:37   Re: Using get_user_team in a loop, returns (-1)
Reply With Quote #2

Try cs_get_user_team( )
__________________
alan_el_more is offline
Hx7r
Member
Join Date: Mar 2009
Old 10-05-2010 , 19:55   Re: Using get_user_team in a loop, returns (-1)
Reply With Quote #3

Try get_user_team(iPlayers[i])
Hx7r is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-05-2010 , 19:59   Re: Using get_user_team in a loop, returns (-1)
Reply With Quote #4

Quote:
Originally Posted by Hx7r View Post
Try get_user_team(iPlayers[i])
Yep, that should fix it.
__________________
fysiks is offline
HLM
Senior Member
Join Date: Apr 2008
Location: C:\WINDOWS\System32
Old 10-05-2010 , 20:57   Re: Using get_user_team in a loop, returns (-1)
Reply With Quote #5

Quote:
Originally Posted by alan_el_more View Post
Try cs_get_user_team( )
im not using CS, thanks though

Quote:
Originally Posted by fysiks View Post
Yep, that should fix it.
Okay.. but WHY should that fix it? I understand i=id in loop, so what is iplayers[i] is that the userid?
__________________
+|- KARMA Respectively

HLM is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-05-2010 , 21:04   Re: Using get_user_team in a loop, returns (-1)
Reply With Quote #6

i is the index of the array iPlayers which holds player ids.
i is not a player id.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 10-05-2010 , 21:20   Re: Using get_user_team in a loop, returns (-1)
Reply With Quote #7

PHP Code:
new iPlayers[32], iNumplr;
get_players(iPlayersiNum)

for(new 
0iNumi++) 
{
    
plr iPlayers[i]
    
client_print(0print_chat"%d",  get_user_team(plr)) 

__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-05-2010 , 22:31   Re: Using get_user_team in a loop, returns (-1)
Reply With Quote #8

Quote:
Originally Posted by GXLZPGX View Post
PHP Code:
new iPlayers[32], iNumplr;
get_players(iPlayersiNum)

for(new 
0iNumi++) 
{
    
plr iPlayers[i]
    
client_print(0print_chat"%d",  get_user_team(plr)) 

echo . . . echo . . . . . . echo . . . . . .
__________________
fysiks is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-05-2010 , 23:30   Re: Using get_user_team in a loop, returns (-1)
Reply With Quote #9

LOL fysiks I was thinking the same thing.
__________________
Bugsy is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-05-2010 , 23:33   Re: Using get_user_team in a loop, returns (-1)
Reply With Quote #10

Quote:
Originally Posted by Bugsy View Post
LOL fysiks I was thinking the same thing.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 12:35.


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