Problem with phone system
#1

Hey guys,
so i have this problem that it generates the number fine. but it doesent save it .. heres the code:

pawn Код:
forward NumberExists(numb);
public NumberExists(numb)
{
    new value;
    new string[256];
    CheckMySQL();
    format(string, sizeof(string), "SELECT * FROM numbers WHERE number = '%d'",numb);
    mysql_query(string);
    mysql_store_result();
    if(mysql_num_rows())value = 0;
    else value = 1;
    return value;
}
forward MakePNumber(playerid,p);
public MakePNumber(playerid,p)
{
    new number2 = Random(56000000,78000000);
    if(NumberExists(number2) == 1)
    {
        MakePNumber(playerid,p);
        print("Number already exists");
    }
    else if(NumberExists(number2) == 2)
    {
        new s[255];
        UserStats[playerid][number] = number2;
        UserStats[playerid][phone] = p;
        CheckMySQL();
        format(s, sizeof(s), "INSERT INTO numbers (number) VALUES ('%d')",number2);
        mysql_query(s);
        SavePlayer(playerid);
        print("New number!");
    }
    return 1;
}
Thx for help
Reply


Messages In This Thread
Problem with phone system - by ViPGuy - 29.08.2011, 10:45
Re: Problem with phone system - by Pinguinn - 29.08.2011, 10:48
Re: Problem with phone system - by ViPGuy - 29.08.2011, 10:50
Re: Problem with phone system - by Pinguinn - 29.08.2011, 10:52
Re: Problem with phone system - by ViPGuy - 29.08.2011, 10:57
Re: Problem with phone system - by Pinguinn - 29.08.2011, 11:03
Re: Problem with phone system - by ViPGuy - 29.08.2011, 11:08
Re: Problem with phone system - by Pinguinn - 29.08.2011, 11:29
Re: Problem with phone system - by ViPGuy - 29.08.2011, 11:52
Re: Problem with phone system - by Pinguinn - 29.08.2011, 12:04

Forum Jump:


Users browsing this thread: 3 Guest(s)