UpdateVehicleDamageStatus not update
#1

Hello..

I have a small test code.
Код:
CMD:test(playerid, params[])
{
    new vehicleid = GetPlayerVehicleID(playerid);
	new panels, doors, lights, tires;
	GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
	
	new bonnet, boot, driver_door, passenger_door;
	decode_doors(doors, bonnet, boot, driver_door, passenger_door);
	doors = encode_doors(bonnet, boot, 0, passenger_door);
	UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
	
	return 1;
}
When I am in a vehicle and break a driver's door, and use this command, thets not doing anything until i respawn a vehicle? Why? How to do its working without I need to respawn the vehicle to see, the driver's door is now repaired and good?!
Reply
#2

If you want to repair the vehicle you can use the function RepairVehicle()

PHP код:
CMD:test(playeridparams[])
{
    new 
vehicleid GetPlayerVehicleID(playerid);
    
RepairVehicle(vehicleid);
    return 
1;

Ofcourse you need to do the checks to see if the player is in a vehicle and all.
Reply
#3

Here the code:-

PHP код:
CMD:test(playeridparmas[])
{
    new 
vehicleid GetPlayerVehicleID(playerid);
   if(
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1"You can only use this command when you are in a vehicle!");// Checks if the player is in a vehicle or not. If yes, it will show the player an error message.
   
RepairVehicle(playerid);//repairs the vehicle.
   
SendClientMessage(playerid, -1"Vehicle successfully repaired!");//Sends the clientmessage about the vehicle to be repaired.
return 1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)