29.03.2011, 13:54
(
Последний раз редактировалось Hornet600; 29.03.2011 в 14:00.
Причина: wrong word :(
)
I made one vehicle system and now i added a new feature that is vehicle insurances, when a vehicle blows up the vehicle gets removed from the database and this works alright.
But now I'm trying to make a subtraction when a vehicle destroys example i got three insurances them the car blows up,
them the car goes to two insurances etc, but my code to do it got a bug and i need help to fix this out.
Here goes the code
But now I'm trying to make a subtraction when a vehicle destroys example i got three insurances them the car blows up,
them the car goes to two insurances etc, but my code to do it got a bug and i need help to fix this out.
Here goes the code
pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
if(vehicleinfo[currentplayervehicle[killerid]][Insurances] == 0) //working
{
new query[256];
new currentveh = GetPlayerVehicleID(killerid);
DestroyVehicle(currentveh);
format(query, sizeof(query),"DELETE FROM vehicles WHERE carid=%d",vehicleinfo[currentveh][id]);
mysql_query(query);
LoadPlayerKeys(vehicleinfo[currentveh][Owner]);
SendClientMessage(vehicleinfo[currentveh][Owner],COLOR_RED, " Your vehicle as been destroyed\n (deleted)");
}
else // bug
{ // the script of currentveh is working
new currentveh = GetPlayerVehicleID(killerid);
vehicleinfo[currentveh][Insurances]--; // this line is used to make one Subtraction of the insurances variable with "1"
SaveVehicle(vehicleinfo[currentveh][id]); // saves the vehicle insurances
DestroyVehicle(currentveh); // destroys the vehicle
SendClientMessage(vehicleinfo[currentveh][Owner], COLOR_RED, " Your vehicle as destroyed \n one of the licenses is gone now"); //this is working how its supused :p
}
return 1;
}