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

Solved Symbol is never used


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-17-2019 , 09:47   Symbol is never used
Reply With Quote #1

I get symbol is never used on iSize1 and iSize2, but the variables are already being used, is Pawn just, dumb?
Code:
public Function( ) {     if( containi_all( eRanks[ Rank_Flags ], charsmax( eRanks[ Rank_Flags ] ), szFlags, charsmax( szFlags ) ) )     {         j = i;     } } containi_all( szStringSrc[ ], iSize1, szStringCompare[ ], iSize2 ) {     new bool:bEqual;
    for( new i; i < sizeof( iSize1 ); i++ )
    {
        for( new j; j < sizeof( iSize2 ); j++ )
        {             if( szStringSrc[ i ] != szStringCompare[ j ] )             {                 bEqual = true;                 break;             }                         else             {                 bEqual = false;             }         }     }         return bEqual; }
__________________

Last edited by edon1337; 07-17-2019 at 17:58. Reason: Restore to previous version.
edon1337 is offline
AmXDusT
Member
Join Date: Feb 2019
Location: Italy / Albania
Old 07-17-2019 , 10:08   Re: &quot;Symbol is never used&quot;
Reply With Quote #2

Afaik you shouldn't be able to use sizeof for iSize as they're not arrays
AmXDusT is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-17-2019 , 10:37   Re: &quot;Symbol is never used&quot;
Reply With Quote #3

Quote:
Originally Posted by AmXDusT View Post
Afaik you shouldn't be able to use sizeof for iSize as they're not arrays
Yeah, I already saw the mistake, but the owner of the forum just restored my thread and warned me, oh well.
__________________
edon1337 is offline
JusTGo
Veteran Member
Join Date: Mar 2013
Old 07-17-2019 , 11:02   Re: &quot;Symbol is never used&quot;
Reply With Quote #4

change :

containi_all( szStringSrc[ ], iSize1, szStringCompare[ ], iSize2 )

to :

stock containi_all( szStringSrc[ ], iSize1, szStringCompare[ ], iSize2 )

or :

public containi_all( szStringSrc[ ], iSize1, szStringCompare[ ], iSize2 )
__________________
JusTGo is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-17-2019 , 11:03   Re: &quot;Symbol is never used&quot;
Reply With Quote #5

I already fixed everything, thanks anyways, here's the full solution:

Code:
public Function( ) {     if( containi_all( eRanks[ Rank_Flags ], charsmax( eRanks[ Rank_Flags ] ), szFlags, charsmax( szFlags ) ) )     {         j = i;     } } public containi_all( szStringSrc[ ], iSize1, szStringCompare[ ], iSize2 ) {     new bool:bEqual;     for( new i; i < iSize1; i++ )     {         for( new j; j < iSize2; j++ )         {             if( szStringSrc[ i ] == szStringCompare[ j ] )             {                 bEqual = true;                 break;             }                         else             {                 bEqual = false;             }         }                 if( ! bEqual )         break;     }         return bEqual; }
__________________

Last edited by edon1337; 07-17-2019 at 11:48.
edon1337 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-17-2019 , 12:42   Re: &quot;Symbol is never used&quot;
Reply With Quote #6

That what equal function does?

I don't see the reason of you using this function since its totally useless.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-17-2019 , 13:16   Re: &quot;Symbol is never used&quot;
Reply With Quote #7

Quote:
Originally Posted by Natsheh View Post
That what equal function does?

I don't see the reason of you using this function since its totally useless.
You can't call something useless if you don't understand what it does.

If you're interested what it does, it compares each character of both strings to see if string1 contains all the characters from string2, normal contain/i compares strings as whole, so if we have abcd and adcb it's going to return false, even though they both are the same, except for the order.

Normal contain:
PHP Code:
#include < amxmodx >

new const g_szString1[ ] = "abcd";
new const 
g_szString2[ ] = "adcb";

public 
plugin_init( )
{
    if( 
containg_szString1g_szString2 ) != -)
    {
        
log_to_file"Contain.txt""True" );
    }

    else
    {
        
log_to_file"Contain.txt""False" );
    }

Log:
Code:
L 07/17/2019 - 19:17:05: False
New contain:
PHP Code:
#include < amxmodx >

new g_szString1[ ] = "abcd";
new 
g_szString2[ ] = "adcb";

public 
plugin_init( )
{
    if( 
contain_allg_szString1charsmaxg_szString1 ), g_szString2charsmaxg_szString2 ) ) )
    {
        
log_to_file"Contain.txt""True" );
    }

    else
    {
        
log_to_file"Contain.txt""False" );
    }
}

public 
contain_allszStringSrc[ ], iSize1szStringCompare[ ], iSize2 )
{
    new 
bool:bEqual;

    for( new 
iiSize1i++ )
    {
        for( new 
jiSize2j++ )
        {
            if( 
szStringSrc] == szStringCompare] )
            {
                
bEqual true;
                break;
            }
            
            else
            {
                
bEqual false;
            }
        }
        
        if( ! 
bEqual )
        break;
    }
    
    return 
bEqual;

Log:
Code:
L 07/17/2019 - 19:20:00: True
__________________

Last edited by edon1337; 07-17-2019 at 13:21.
edon1337 is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 07-17-2019 , 14:08   Re: &quot;Symbol is never used&quot;
Reply With Quote #8

If they are flags, you can just use read_flags with some bit operations.
__________________

Last edited by <VeCo>; 07-17-2019 at 14:09.
<VeCo> is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-17-2019 , 14:09   Re: &quot;Symbol is never used&quot;
Reply With Quote #9

Quote:
Originally Posted by <VeCo> View Post
If they are flags, you can just use read_flags with some bit operations.
My method is more efficient,

* Convert to bits (twice)
* Use read_flags (twice)
* Compare using equal

vs

* Use a single stock
__________________

Last edited by edon1337; 07-17-2019 at 14:11.
edon1337 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-17-2019 , 15:35   Re: &quot;Symbol is never used&quot;
Reply With Quote #10

Quote:
Originally Posted by edon1337 View Post
My method is more efficient,

* Convert to bits (twice)
* Use read_flags (twice)
* Compare using equal

vs

* Use a single stock
You are wrong and this is the statistics


* Use read_flags (twice)
* Compare using == operator

Or you can just order them alphabetically and then use equal
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 07-17-2019 at 15:38.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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 09:51.


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