Raised This Month: $ Target: $400
 0% 

Passing a string in function


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-10-2017 , 19:16   Re: Passing a string in function
Reply With Quote #6

Quote:
Originally Posted by OciXCrom View Post
team[] => team[16]
Why?

PHP Code:
new szTeam10 ];
get_opposite_teamid szTeam charsmaxszTeam ) );
    
stock get_opposite_teamindex szTeam[] , maxchars )
{
    return 
copyszTeam maxchars cs_get_user_teamindex ) == CS_TEAM_T "CT" "TERRORIST" );

Instead of getting the team name string, why not get the CsTeams team value? If the specified player is unassigned or spec, it will return the same.

PHP Code:
new CsTeams:ctOppositeTeam get_opposite_teamid );

stock CsTeams:get_opposite_teamid )
{
    new 
CsTeams:ctTeam cs_get_user_teamid );
    
    if ( 
CS_TEAM_T <= ctTeam <= CS_TEAM_CT 
        
ctTeam = ( ctTeam == CS_TEAM_T ) ? CS_TEAM_CT CS_TEAM_T;
        
    return 
ctTeam;

__________________

Last edited by Bugsy; 03-10-2017 at 19:18.
Bugsy is offline
 



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 18:02.


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