AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   equal Problem? (https://forums.alliedmods.net/showthread.php?t=156049)

ProIcons 04-30-2011 08:27

equal Problem?
 
Code:
            new send[256];             setc(send, 4, 0xff)             copy(send[4], 255, "challenge")             new szCommand[ 32 ];             strtok( g_HLTV_recv, szCommand, charsmax( szCommand ), g_HLTV_recv, charsmax( g_HLTV_recv ), ' ', 1 );             server_print("[HLTV] Command: %s (%d) - %s (%d)",szCommand,strlen(szCommand),send,strlen(send));             if (equali(szCommand,send))             {                 new temp[32];                 gettok(temp,g_HLTV_recv,2,32);                 replace(temp, 31, "^n", "")                 server_print("%s %d",temp,str_to_num(temp));                 g_HLTV_challenge=str_to_num(temp);                 g_HLTV_Busy=0;             }

Well in this
i am getting a result:
Quote:

[HLTV] ************************************challenge rcon 3031699845

[HLTV] Command: ************************************challenge (13) - ************************************challenge (13)
But it doesn't pass the "equal" check why?

ConnorMcLeod 04-30-2011 08:47

Re: equal Problem?
 
May be
Code:
 if (equali(szCommand[4],send[4]))

ProIcons 04-30-2011 09:02

Re: equal Problem?
 
Code:
                new temp[32];                 gettok(temp,g_HLTV_recv,2,32);                 replace(temp, 31, "^n", "")                 server_print("%s %d",temp,str_to_num(temp));
Quote:

[HLTV] Command: ************************************challenge (13) - ************************************challenge (13)
3000969614 2147483647
With str_to_num 2 different values? lol ?

SonicSonedit 04-30-2011 09:10

Re: equal Problem?
 
Try
PHP Code:

if (equali(szCommand,send,strlen(send))) 


ProIcons 04-30-2011 09:43

Re: equal Problem?
 
My if passed, there is other problem :/

ConnorMcLeod 04-30-2011 09:56

Re: equal Problem?
 
1. Have you tried what i asked you to try ?
2. Have you tried equal instead of equali ?
3. Try this to see where equal fails :
PHP Code:

Equal(const szA[], const szB[], iNum 0)
{
    static 
a0

    
if( iNum )
    {
        while( (
szA[i]) && == szB[i] && --iNum)
        {
            ++
i
        
}
        
server_print("Strings <%s> and <%s> are not equal, Chars #%d are different <%c> <%c>"szAszBiaszB[i])
        return !
iNum
    
}

    
szA[i]
    do
    {
        if( 
!= szB[i])
        {
            
server_print("Strings <%s> and <%s> are not equal, Chars #%d are different <%c> <%c>"szAszBiaszB[i])
            return 
0
        
}
    }
    while( (
szA[++i]) )

    return !
szB[i]




All times are GMT -4. The time now is 04:26.

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