SAMP Vehicles and MySQL
#1

SOLVED _
Reply
#2

First, how do you that the vehicle wasn't already destroyed? Do you track destroyed vehicles in OnVehicleDeath? Do you clear the CarID?

Second, is it possible to have multiple cars with the same id? If not, you should break your for loop when it finds the car id.

Now to assist you,

You're using
Код:
DestroyVehicle(id);
You're destroying the vehicle ID, you're recreating the vehicle without taking the new id...Then you're using functions for the "old id"..

One final note:
Код:
GetVehicleHealth(id, health);
DestroyVehicle(id);
etc...
Are you sure you didn't mean to use [i] instead of [id]?
Reply
#3

Quote:
Originally Posted by jwh
Посмотреть сообщение
First, how do you that the vehicle wasn't already destroyed? Do you track destroyed vehicles in OnVehicleDeath? Do you clear the CarID?

Second, is it possible to have multiple cars with the same id? If not, you should break your for loop when it finds the car id.

Now to assist you,

You're using
Код:
DestroyVehicle(id);
You're destroying the vehicle ID, you're recreating the vehicle without taking the new id...Then you're using functions for the "old id"..

One final note:
Код:
GetVehicleHealth(id, health);
DestroyVehicle(id);
etc...
Are you sure you didn't mean to use [i] instead of [id]?
"Are you sure you didn't mean to use [i] instead of [id]?"

That's why i'm using this:
Код:
if(VehicleSystem[i][CarID] == id)
So, [i] and [id] will be the same. Also it breaks the loop when find the same id typed (for commands) or GetPlayerVehicleID() if he's inside a car.

When I delete a car, I save on MySQL the Health, the Fuel, etc. Also the Stats (0 is spawned, 1 is saved/not spawned/destroyed). When I change the Stats to Respawn, it respawns but in another ingame id because there are newest cars. I can find the car using the MySQL ID I gave to the vehicle, but I cannot respawn a car in a used id because the old vars are there.

What I can do when I save the State of the car?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)