how to add credit in call command
#1

how to add a someone to buy credit? Because i know how to make in 24/7 to buy a credit for his phone but i dont know this: if he buy a credit then call some number and how to remove the credit to can buy again? Can you make this and tell me please.

pawn Код:
if(strcmp(cmd, "/call", true) == 0)
    {
        TextDrawShowForPlayer(playerid, Tel0);
        TextDrawShowForPlayer(playerid, Tel1);
        TextDrawShowForPlayer(playerid, Tel2);
        TextDrawShowForPlayer(playerid, Tel3);
        TextDrawShowForPlayer(playerid, Tel4);
        TextDrawShowForPlayer(playerid, Tel5);
        TextDrawShowForPlayer(playerid, Tel6);
        TextDrawShowForPlayer(playerid, Tel7);
        TextDrawShowForPlayer(playerid, Tel8);
        TextDrawShowForPlayer(playerid, Tel9);
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "Koriscenje: /call [broj]");
                SendClientMessage(playerid, COLOR_GRAD2, "Koriscenje: /calllist (for a list for short numbers)");
                return 1;
            }
            if(PlayerInfo[playerid][pPnumber] == 0)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "  Nemate telefon!");
                return 1;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "* %s je uzeo telefon iz dzepa.", sendername);
            SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            new phonenumb = strval(tmp);
            /*if(phonenumb == list)
            {
                SendClientMessage(playerid, COLOR_GREEN, "________________Lista Sluzbi________________");
                SendClientMessage(playerid, COLOR_WHITE, "111 - picerija., 222 - bus sluzba");
                SendClientMessage(playerid, COLOR_WHITE, "103 - bolnicari, 444 - taxi, 555 - mehanicar");
                SendClientMessage(playerid, COLOR_GREEN, "____________________________________________");
                return 1;
            }*/

            if(phonenumb == 111)
            {
                new pizzaworkers = 0;
                foreach (Player, i)
                {
                    if(PlayerInfo[i][pJob] == 17 && JobDuty[i] == 1)
                    {
                        pizzaworkers++;
                    }
                }

                if(pizzaworkers < 1)
                {
                    SendClientMessage(playerid, COLOR_GREY, "   Javili su se.");
                    SendClientMessage(playerid, 0xF4E19FAA, "Radnik (telefon): Halo, Picerija ovdje.");
                    SendClientMessage(playerid, 0xF4E19FAA, "Radnik (telefon): Zao nam je, trenutno nemamo slobodnih raznosaca pica.");
                    SendClientMessage(playerid, COLOR_GREY, "   Prekinuli su.");
                    return 1;
                }
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "** %s je narucio picu. (koristite /accept Pizza da prihvatite narudzbu)", sendername);
                SendJobMessage(17, COLOR_WHITE, string);
                SendClientMessage(playerid, COLOR_GREY, "   Javili su se.");
                SendClientMessage(playerid, 0xF4E19DAA, "Radnik (telefon): Halo, Picerija ovdje.");
                if(pizzaworkers == 1) { format(string, sizeof(string), "Radnik (telefon): Gospodine, poslali smo jednog raznosaca da vam donese picu."); }
                else { format(string, sizeof(string), "Radnik (telefon): Trenutno imamo %d raznosaca pica na duznosti, svima je javljeno za vasu narudzbu !", pizzaworkers); }
                SendClientMessage(playerid, 0xF4E19DAA, string);
                SendClientMessage(playerid, COLOR_GREY, "   Prekinuli su.");
                PizzaCall = playerid;
                return 1;
            }
            if(phonenumb == 222)
            {
                new routezonecheck = IsInBusrouteZone(playerid);
                new drivercount = 0;
                if (routezonecheck == 0)
                {
                    for (new i=0; i<=MAX_PLAYERS; i++)
                    {
                        if (IsPlayerConnected(i) && BusrouteEast[i][0] != 0) drivercount++;
                    }
                    if (drivercount != 0)
                    {
                        format(string, sizeof(string), "Trenutno ima %d vozaca autobusa na istocnoj ruti. Sledeca stajanja:", drivercount);
                        SendClientMessage(playerid, COLOR_WHITE, string);
                        SendBusRoute(playerid, 0);
                    }
                    else SendClientMessage(playerid, COLOR_GREY, "Nema trenutno vozaca busa na istocnoj ruti.");
                }
                else if (routezonecheck == 1)
                {
                    for (new i=0; i<=MAX_PLAYERS; i++)
                    {
                        if (IsPlayerConnected(i) && BusrouteWest[i][0] != 0) drivercount++;
                    }
                    if (drivercount != 0)
                    {
                        format(string, sizeof(string), "Trenutno ima %d vozaca autobusa na zapadnoj ruti. Sledeca stajanja:", drivercount);
                        SendClientMessage(playerid, COLOR_WHITE, string);
                        SendBusRoute(playerid, 1);
                    }
                    else SendClientMessage(playerid, COLOR_GREY, "Nema vozaca na zapadnoj ruti.");
                }
                else SendClientMessage(playerid, COLOR_GREY, "Trenutno nema vozaca autobusa.");
                return 1;
            }
            /*if(phonenumb == 103)
            {
                if(Medics < 1)
                {
                    SendClientMessage(playerid, COLOR_GREY, "   There are no Medics On Duty at the moment, try again later !");
                    return 1;
                }
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "** %s is in need of a Medic. (use /accept medic to accept the call)", sendername);
                SendRadioMessage(4, TEAM_AZTECAS_COLOR, string);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have called for a Medic, wait for a reply.");
                MedicCall = playerid;
                return 1;
            }*/

            if(phonenumb == 444)
            {
                if(TaxiDrivers < 1)
                {
                    SendClientMessage(playerid, COLOR_GREY, "   Javili su se.");
                    SendClientMessage(playerid, 0xF4E19FAA, "Dispacer (telefon): Taxi Kompanija ovjde.Izvinite ali trenutno nemamo slobodnih vozaca.");
                    SendClientMessage(playerid, COLOR_GREY, "   Prekinuli su.");
                    return 1;
                }
                if(TransportDuty[playerid] > 0)
                {
                    SendClientMessage(playerid, COLOR_GREY, "   Ne mozete sada zvati taksi !");
                    return 1;
                }
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "** %s-u treba taksi. (kucajte /accept taxi da prihvatite poziv)", sendername);
                SendFamilyMessage(10, TEAM_AZTECAS_COLOR, string);
                SendClientMessage(playerid, COLOR_GREY, "   Prihvatili su poziv.");
                SendClientMessage(playerid, 0xF4E19FAA, "Dispacer (telefon): Svi taksisti su informisani o vasem pozivu.");
                SendClientMessage(playerid, COLOR_GREY, "   Prekinuli su.");
                TaxiCall = playerid;
                return 1;
            }
            if(phonenumb == 555)
            {
                new mechanicworkers = 0;
                foreach (Player, i)
                {
                    if(PlayerInfo[i][pJob] == 7 && JobDuty[i] == 1)
                    {
                        mechanicworkers++;
                    }
                }
                if(mechanicworkers < 1)
                {
                    SendClientMessage(playerid, COLOR_GREY, "   Javili su se.");
                    SendClientMessage(playerid, 0xBBE1F2AA, "Vlasnik (telefon): Zao nam je ali trenutno nemamo slobodnih automehanicara.");
                    SendClientMessage(playerid, COLOR_GREY, "   They hang up.");
                    return 1;
                }
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "** %s-u treba automehanicar. (kucajte /accept mechanic da prihvatite poziv)", sendername);
                SendJobMessage(7, COLOR_WHITE, string);
                SendClientMessage(playerid, COLOR_GREY, "   Prihvatili su poziv.");
                    SendClientMessage(playerid, 0xBBE1F2AA, "Vlasnik (telefon): Svim mehanicarima je javljeno o vasem pozivu.");
                    SendClientMessage(playerid, COLOR_GREY, "   Prekinuli su.");
                MechanicCall = playerid;
                return 1;
            }
            /*if(phonenumb == 1180)
            {
                if(PlayerInfo[playerid][pLevel] < 2)
                {
                    SendClientMessage(playerid, COLOR_GREEN, "Advertisement business: We're only advertising well known people's ads.");
                    SendClientMessage(playerid, COLOR_GRAD2, "  They hang up...");
                }
                else
                {
                    SendClientMessage(playerid, COLOR_WHITE, "Podsjetnik: You now use T to talk on your cellphone, type /hangup to hang up");
                    SendClientMessage(playerid, COLOR_GREEN, "Advertisement business: Welcome to the advertisement business, what would you like to advertise?");
                    SendClientMessage(playerid, COLOR_WHITE, "Podsjetnik: Type your ad here. Ex: Selling my Comet");
                    Mobile[playerid] = 1180;
                }
                return 1;
            }*/

            if(phonenumb == 3900)
            {
                SendClientMessage(playerid, COLOR_GREEN, "ABC Studio: Molimo vas ostavite poruku poslije zvuka **beep**!");
                SendClientMessage(playerid, COLOR_WHITE, "Beep!");
                Mobile[playerid] = 3900;
                return 1;
            }
            if(phonenumb == 911)
            {
                SendClientMessage(playerid, COLOR_WHITE, "Podjsetnik: Sada koristite ~ ili T da pricate preko telefona, kucajte /hangup ili /h da prekinete");
                SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: Koja vam sluzba treba, policija ili hitna_pomoc? (kucajte policija ili hitna_pomoc)?");
                Mobile[playerid] = 911;
                return 1;
            }
            if(phonenumb == PlayerInfo[playerid][pPnumber])
            {
                SendClientMessage(playerid, COLOR_GRAD2, "  Zauzeto je...");
                return 1;
            }
            if(Mobile[playerid] != 255)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "  Vec zovete nekog...");
                return 1;
            }
            foreach (Player, i)
            {
                    if(PlayerInfo[i][pPnumber] == phonenumb && phonenumb != 0)
                    {
                        giveplayerid = i;
                        Mobile[playerid] = giveplayerid; //caller connecting
                        if(IsPlayerConnected(giveplayerid))
                        {
                            if(giveplayerid != INVALID_PLAYER_ID)
                            {
                                if(PhoneOnline[giveplayerid] > 0)
                                {
                                    SendClientMessage(playerid, COLOR_GREY, "   Taj igrac je offline!");
                                    return 1;
                                }
                                if (Mobile[giveplayerid] == 255)
                                {
                                    format(string, sizeof(string), "Zvoni vam telefon, kucajte (/pickup) CallerID: %s", sendername);
                                    SendClientMessage(giveplayerid, COLOR_YELLOW, string);
                                    GetPlayerName(giveplayerid, sendername, sizeof(sendername));
                                    RingTone[giveplayerid] = 10;
                                    format(string, sizeof(string), "* %s-ov telefon zvoni.", sendername);
                                    SendClientMessage(playerid, COLOR_WHITE, "Podjsetnik: Sada koristite ~ ili T da pricate preko telefona, kucajte /hangup ili /h da prekinete");
                                    ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                                    CellTime[playerid] = 1;
                                    return 1;
                            }
                        }
                    }
                }
            }
            SendClientMessage(playerid, COLOR_GRAD2, "  Zauzeto je...");
        }
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)