AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved strfind error ? (https://forums.alliedmods.net/showthread.php?t=319951)

karaulov 11-28-2019 08:39

strfind error ?
 
Check for IP:PORT server in nickname:

Code:

public xfindip( const szIPPort[] )
{
        if (strfind(szIPPort,"27015") > 9) // 192.168.1.1:27015 not found!!!
        {
                return 1;
        }
       
        if (strfind(szIPPort,":27") > 8) // 192.168.1.1:27015 not found!!!
        {
                return 1;
        }
        return 0;
}

not works! Why ?

LearninG 11-28-2019 08:49

Re: strfind error ?
 
try contain , containi

EDIT :

if (strfind(szIPPort,"27015") != -1)

georgik57 11-28-2019 08:49

Re: strfind error ?
 
just use containi

Bugsy 11-28-2019 15:33

Re: strfind error ?
 
containi() does the same as strfind() except it's case insensitive, which doesn't matter for numbers.

They both return -1 when the string isn't found so Learnings recommendation will work.

Natsheh 11-28-2019 15:42

Re: strfind error ?
 
Better solution don't allow using more than 2 digits in the names also deny non alphabet characters...


All times are GMT -4. The time now is 02:52.

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