SA-MP Forums Archive
Insurance Points problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Insurance Points problem (/showthread.php?tid=566860)



Insurance Points problem - duteba - 08.03.2015

Hi,

I have a problem with buying insurance points.First when i start the server,i log in.And i type: "/cars" i select "Buy Insurance" and if i type "11"(points).I get a message that i can't get more then 10..all good.I get "10" points ,and when i try to buy again 1 point or more,i can't because i already have 10.After i destroy my vehicle,the vehicle points are now 9.Here is the problem,after i buy 10 points and destroy the car.I have 9 points,and if i try to buy 10 points.i can,10+10+10+10 how much times i want...
I tried to make it ,but i don't know how.I want that if you have example: "5"(points),you can't get more then 5 till the limit of 10/10.

Code: http://pastebin.com/gYUBfdJd


Re: Insurance Points problem - oliverrud - 08.03.2015

Instead of:
if(vehicleVariables[id][vVehicleInsurancePoints] == 10)
Do:
if(vehicleVariables[id][vVehicleInsurancePoints] >= 10)
Would be my guess.


Re: Insurance Points problem - duteba - 08.03.2015

No,still i can buy 10+10+10..etc After i destroy vehicle and have 9 points


Re: Insurance Points problem - finelaq - 08.03.2015

pawn Код:
new id = GetPlayerVehicleID(playerid);
                                        if(vehicleVariables[id][vVehicleInsurancePoints] == 10)
                                        {
                                                SendClientMessage(playerid,COLOR_GREY,"{FFB870}Nu mai poti cumpara puncte,deoarece ai deja 10.");
                                                return 1;
                                        }
                                        else
                                        {
                                               new da[500];
                                               format(da, 500, "Cate puncte de asigurare vrei sa cumperi? %d / insurance point     (%d/10)", vehicleVariables[playerid][vVehicleInsurancePrice],vehicleVariables[playerid][vVehicleInsurancePoints]);
                                               ShowPlayerDialog(playerid, 22521, DIALOG_STYLE_INPUT,"Insurance",da,"Ok","Cancel");
                                         }
Something like this?

And you have to do this also:

pawn Код:
else if(playerVariables[playerid][pCarSelected] == 2)
{
    if(points > 0)
    {
        new bani = vehicleVariables[playerid][vVehicleInsurancePrice2]*points;
        if(playerVariables[playerid][pMoney] > bani)
        {
            if(points + vehicleVariables[playerid][vVehicleInsurancePoints2] > 10) return SCM(playerid, -1,"text here");
            vehicleVariables[playerid][vVehicleInsurancePoints2] += points;
            playerVariables[playerid][pMoney] -= bani;
            format(szMessage,256,"Ai cumparat %d puncte de asigurare cu $%s.", points, NumberFormat(bani));
            SCM(playerid,COLOR_ATTACK, szMessage);
        }
        else SCM(playerid, -1,"You don't have enought money.");
    }
}



Respuesta: Insurance Points problem - duteba - 08.03.2015

Did you just copy it and paste?


Re: Respuesta: Insurance Points problem - finelaq - 08.03.2015

Quote:
Originally Posted by duteba
Посмотреть сообщение
Did you just copy it and paste?

No.. and look above.


Re: Insurance Points problem - duteba - 08.03.2015

No,now i can't buy.I type "1" or "5" "10" but nothing.No message,no points ..0/10

P.S: Sorry didn't see the other code


Re: Insurance Points problem - duteba - 09.03.2015

up! Someone else?maybe know help me pls?