Cellphone Number command, greatly appreciated if helped.
#8

Quote:
Originally Posted by Ahrim
Посмотреть сообщение
basically, you removed the line, so how could it detect if they're buying less than 7 digit numbers or more than 10?
What I wanted was, I want, like, you need to buy phone number which has more than 7 digit numbers and less than 10, so they wont have nonrp numbers, like '1', '666', '1337', and stuffs.
pawn Код:
CMD:buysim(playerid, params[])
{
    new string[128], number, File:file = fopen("cellphones.cfg", io_read);
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!PlayerInfo[playerid][pHasCellphone]) return SendClientMessage(playerid, COLOR_GREY, "You don't own a cellphone yet.");
    if(!IsPlayerInRangeOfPoint(playerid, 2, 1154.1257,-1180.9600,32.8187)) return SendClientMessage(playerid, COLOR_GREY, "You are not at the Telecom Company.");
    if(sscanf(params, "i", number)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /buysim [desired number]");
    if(number <= 6 || number >= 11) return SendClientMessage(playerid, COLOR_GREY, "The number should be more then 6 Characters and less then 11");
    if(PlayerInfo[playerid][pCellphone] == number) return SendClientMessage(playerid, COLOR_GREY, "You already have this phone number.");
    new idx = 1;
    while(fread(file, string))
    {
        if(strval(string) == number) return SendClientMessage(playerid, COLOR_GREY, "This number is already registered.");
        if(strval(string) == PlayerInfo[playerid][pCellphone])
        {
            fdeleteline("cellphones.cfg", idx);
        }
        idx ++;
    }
    fclose(file);
    file = fopen("cellphones.cfg", io_append);
    format(string, sizeof(string), "%d | %s\r\n", number, RPN(playerid));
    fwrite(file, string);
    fclose(file);
    format(string, sizeof(string), "* %s has bought a new sim card.", RPN(playerid));
    ProxDetector(15.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
    if(!PlayerInfo[playerid][pCellphone])
    {
        SendClientMessage(playerid, COLOR_WHITE, " The company gave you the sim card for free as it's your first.");
        SendClientMessage(playerid, COLOR_WHITE, " You can use /call and /sms now.");
    }
    else
    {
        GiveZaiatMoney(playerid, -500);
        TaxMoney += 500;
        SendClientMessage(playerid, COLOR_WHITE, " The company has charged you $500 for changing your sim card.");
    }
    PlayerInfo[playerid][pCellphone] = number;
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)