Raised This Month: $ Target: $400
 0% 

Passing a string in function


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KiLLeR.
Senior Member
Join Date: Jul 2014
Location: Bulgaria
Old 03-10-2017 , 19:55   Re: Passing a string in function
Reply With Quote #1

Quote:
Originally Posted by Bugsy View Post
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;

The first code looks pretty same as mine.
And second code don't help me, because I need the string to use directly. And yes i can check with if and apply to string, but i wan't to know what's not good with mine code.
KiLLeR. 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 18:02.


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