I need a little help on this :)
#1

Hi, this /buyinsurance command is like this, "/buyinsurance [amount]" and then i will get the amount of Insurances that i type.. But, i want it to be like this "/buyinsurance [amount]" and then it will say like, "are you sure you want to buy X Insurances, then type "/buyinsurance [amount] confirm" I hope that anyone will help me, rep+

pawn Код:
if(strcmp(cmd, "/buyinsurance", true) == 0 || strcmp(cmd, "/buyinsurances", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(!IsPlayerInRangeOfPoint(playerid,3.0,956.7999, -53.7001, 1001.5))
            {
                SendClientMessage(playerid, COLOR_GREY, "You can not buy insurance here.");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, ""COL_SZR"Usage:"COL_WHITE" /buyinsurance [number of policies], insurances cost $10,000 each.");
                return 1;
            }
            new amount = strval(tmp);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, ""COL_SZR"Usage:"COL_WHITE" /buyinsurance [number of policies], insurances cost $10,000 each.");
                return 1;
            }
            if(amount < 1 || amount > 20)
                return SendClientMessage(playerid, COLOR_GREY, "The company will not go below 1 and above 20.");
            //for(new i=0; i<MAX_VEHICLES; i++)
            for(new i = 0; i < sizeof(CarInfo); i++)
            {
                new key2;
                if(ForwardOwnCar(1,playerid)) { key2 = PlayerInfo[playerid][pCarkey]; }
                else if(ForwardOwnCar(2,playerid)) { key2 = PlayerInfo[playerid][pCarkey2]; }
                else if(ForwardOwnCar(3,playerid)) { key2 = PlayerInfo[playerid][pCarkey3]; }
                else if(ForwardOwnCar(4,playerid)) { key2 = PlayerInfo[playerid][pCarkey4]; }
                else if(ForwardOwnCar(5,playerid)) { key2 = PlayerInfo[playerid][pCarkey5]; }
                else { SendClientMessage(playerid, COLOR_GREY, "You don't have a vehicle out."); return 1; }
                if(CarInfo[key2][cDestroys] != 0)
                {
                    SendClientMessage(playerid, 0xAFAFAFAA, "The vehicle has been destroyed without insurance, and can no longer be covered");
                    return 1;
                }
                new price = amount * CarInfo[key2][cInsurePrice];
                if(GetMoney(playerid) <= price)
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "You can not afford this insurance. There is an ATM to your right.");
                    return 1;
                }
                if(CarInfo[key2][cInsure] > 19)
                {
                    format(string,sizeof(string),"your %s already has %d policies, the company will only let you have 20.",CarInfo[key2][cDescription],CarInfo[key2][cInsure]);
                    SendClientMessage(playerid,COLOR_GRAD2, string);
                    return 1;
                }
                CarInfo[key2][cInsure] += amount;
                GiveMoney(playerid, -price);
                format(string, sizeof(string), "%s enters their details into the terminal and pays $%d for %d insurances",RemoveUnderScore(playerid),price,amount);
                ProxDetector(25.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                SaveCars();
                UpdateAccount(playerid);
                return 1;
            }
        }
        return 1;
    }
Reply
#2

Anyone?
Reply
#3

1) Make a variable
2) Add it to you code above, when he have entered the cmd.
3) Create a new cmd, and check if the variable is greater than the standard.
if it is, give him the insurance else return 1.

A simple patch.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)