30.03.2011, 11:34
I got a vehicle system with insurances when it destroyes a car it loses a license and if the licenses are 0 the car will be deleted from the database and is working how its suposed.
Now im creating a command to buy insurances but im having problems increasing values
for exemple
new a = 500;
a = (a + 500);
here goes my code
how i can fix it?
Now im creating a command to buy insurances but im having problems increasing values
for exemple
new a = 500;
a = (a + 500);
here goes my code
pawn Код:
if(strcmp(x_v,"buyinsurance",true) == 0)
{
new carkey = playerinfo[playerid][vkey];
new xquery[256];
if(IsPlayerInAnyVehicle(playerid))
{
if(IsPlayerInVehicle(playerid, carkey))
{
GivePlayerCash(playerid,- vehicleinfo[carkey][Insurances]);
vehicleinfo[carkey][Insurances] = (vehicleinfo[carkey][Insurances] +1); // buged
vehicleinfo[carkey][InsurancePrice] = (vehicleinfo[carkey][InsurancePrice] +500); // buged
printf("insurances= %d InsurancePrice = %d",vehicleinfo[currentveh][Insurances],vehicleinfo[currentveh][InsurancePrice]);
format(xquery, sizeof(xquery),"UPDATE vehicles SET Insurances=%d,InsurancePrice=%d WHERE carid=%d",vehicleinfo[currentplayervehicle[playerid]][Insurances],vehicleinfo[currentplayervehicle[playerid]][InsurancePrice],currentplayervehicle[playerid]);
mysql_query(xquery);
new xstring[120];
format(xstring, sizeof(xstring),"%s you bought a new insurance for your vehicle.",playerinfo[playerid][Name]);
SendClientMessage(playerid, COLOR_GREEN, xstring);
}
else
{
SendClientMessage(playerid, COLOR_GREEN, " You are not inside your vehicle");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, " You are not inside a vehicle");
}
}