CheckPh
#9

Quote:
Originally Posted by Roel
Посмотреть сообщение
pawn Код:
stock CheckPh(nmbr[])
{
    new string[20];
    new File: file = fopen("phone.cfg", io_read);
    if(!fexist("phone.cfg")) { print("Couldn't find phone.cfg, created file."); fcreate("phone.cfg"); return 0; }
    while(fread(file, string))
    {
        if(strcmp(string,nmbr,true) == 0)// Help me on this please
        {
            return -1; // if Checkph returns false the number is already taken.
        }
    }
    fclose(file);
    return 0;
}
Won't work. You can't use strcmp with integers. You either need to convert all integers to strings and do a strcmp check, or convert all strings to integers and do a regular == check.
Reply


Messages In This Thread
CheckPh - by Why - 03.10.2012, 14:16
Re: CheckPh - by Roel - 03.10.2012, 14:19
Re: CheckPh - by Why - 03.10.2012, 14:23
Re: CheckPh - by Roel - 03.10.2012, 14:24
Re: CheckPh - by Why - 03.10.2012, 14:26
Re: CheckPh - by SuperViper - 03.10.2012, 14:27
Re: CheckPh - by Roel - 03.10.2012, 14:28
Re: CheckPh - by Why - 03.10.2012, 14:28
Re: CheckPh - by SuperViper - 03.10.2012, 14:29
Re: CheckPh - by Roel - 03.10.2012, 14:32

Forum Jump:


Users browsing this thread: 2 Guest(s)