Raised This Month: $13 Target: $400
 3% 

Solved team name


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tepegoz
Senior Member
Join Date: Apr 2019
Old 05-06-2020 , 14:17   team name
Reply With Quote #1

I want to show team names as T,CT,SPEC but it is showing 1,2,3. How to change 1,2,3 to T,CT,SPEC ?


PHP Code:
new team get_user_team(z)
new 
lFirstSaid[64];

   
format(lFirstSaid63"%s - %i: %i: %i - %i -",anameg_s[z][TIME_MINUTES], g_s[z][TIME_SECONDS], g_s[z][TIME_MSECONDS],team

Last edited by tepegoz; 05-08-2020 at 09:14.
tepegoz is offline
MagNNusS
Member
Join Date: May 2018
Location: World of Bushi
Old 05-06-2020 , 15:26   Re: team name
Reply With Quote #2

PHP Code:
new TeamNames[MAX_TEAMS][] =
{
    
"Spectator",
    
"Terrorist",
    
"Counter-Terrorist"

Then:

PHP Code:
new team get_user_team(z)
new 
lFirstSaid[64];

   
format(lFirstSaid63"%s - %i: %i: %i - %s -",anameg_s[z][TIME_MINUTES], g_s[z][TIME_SECONDS], g_s[z][TIME_MSECONDS], TeamNames[team]) 
__________________
Just an impractical signature
nothing to see here.
MagNNusS is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-06-2020 , 15:26   Re: team name
Reply With Quote #3

Quote:
Originally Posted by tepegoz View Post
I want to show team names as T,CT,SPEC but it is showing 1,2,3. How to change 1,2,3 to T,CT,SPEC ?


PHP Code:
new team get_user_team(z)
new 
lFirstSaid[64];

   
format(lFirstSaid63"%s - %i: %i: %i - %i -",anameg_s[z][TIME_MINUTES], g_s[z][TIME_SECONDS], g_s[z][TIME_MSECONDS],team
In your code, 'team' is the integer representation/index of the team.
0 = unassigned
1 = T
2 = CT
3 = Spec

You also need to use %s, not %i to format a string value

Add #include <cstrike>
PHP Code:
new CsTeams:team cs_get_user_team(z)
new 
lFirstSaid[64];
new const 
szTeamsCsTeams ][] = { "UNASSIGNED" "T" "CT" "SPEC" };

formatex(lFirstSaidcharsmax(lFirstSaid), "%s - %i: %i: %i - %s -",anameg_s[z][TIME_MINUTES], g_s[z][TIME_SECONDS], g_s[z][TIME_MSECONDS],szTeamsteam ] ) 
__________________
Bugsy is offline
tepegoz
Senior Member
Join Date: Apr 2019
Old 05-08-2020 , 09:13   Re: team name
Reply With Quote #4

thanks
tepegoz is offline
OnePL
Senior Member
Join Date: May 2012
Location: Kwidzyn, Poland
Old 05-09-2020 , 18:36   Re: team name
Reply With Quote #5

PHP Code:
new szTeam[16], lFirstSaid[64];
get_user_team(zszTeamcharsmax(szTeam));

format(lFirstSaid63"%s - %i: %i: %i - %s -",anameg_s[z][TIME_MINUTES], g_s[z][TIME_SECONDS], g_s[z][TIME_MSECONDS], szTeam); 

Last edited by OnePL; 05-09-2020 at 18:36.
OnePL is offline
Send a message via Skype™ to OnePL
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 05-09-2020 , 18:41   Re: team name
Reply With Quote #6

Quote:
Originally Posted by OnePL View Post
PHP Code:
new szTeam[16], lFirstSaid[64];
get_user_team(zszTeamcharsmax(szTeam));

format(lFirstSaid63"%s - %i: %i: %i - %s -",anameg_s[z][TIME_MINUTES], g_s[z][TIME_SECONDS], g_s[z][TIME_MSECONDS], szTeam); 
If you're trying to be smarter than bugsy, please be correct. As bugsy mentioned before, that code will output integers 0, 1, 2 or 3. And why are you hardcoding array lengths?
__________________

Last edited by Napoleon_be; 05-09-2020 at 18:41.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-09-2020 , 19:05   Re: team name
Reply With Quote #7

get_user_team() can retrieve the team name into a string, but I remember there being issues with get_user_team() sometimes returning incorrect values so I always use cs_get_user_team().
__________________
Bugsy is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Location: Muslim and proud!
Old 05-10-2020 , 07:33   Re: team name
Reply With Quote #8

Yes bugsy it return false values depending on the player last team when he was alive it doesn't follow the offset until he get respawned basically it get updated to the offset when the player get respawned.

I think get_user_team gets player team from the scoreboard info
__________________
@Jailbreak MOD [Alot of features + API] 100% done !
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Last edited by Natsheh; 05-10-2020 at 07:36.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
OnePL
Senior Member
Join Date: May 2012
Location: Kwidzyn, Poland
Old 05-10-2020 , 12:40   Re: team name
Reply With Quote #9

Only teamId is gets from ScoreInfo
OnePL is offline
Send a message via Skype™ to OnePL
Reply


Thread Tools
Display Modes

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 05:06.


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