Logging current vehicle health?
#1

It's possible to set a timer of 10 seconds and log every change of the vehicle health?

Ex: Current vehiclehp of PLAYERNAME: 1000

After 10 seconds:

Current vehiclehp of PLAYERNAME: 990
Reply
#2

Yes of course it's possible, using the functions SetTimer and GetVehicleHealth. Is that all you needed to know? I mean you did only ask if it's possible
Reply
#3

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
Yes of course it's possible, using the functions SetTimer and GetVehicleHealth. Is that all you needed to know? I mean you did only ask if it's possible
As JaTochNietDan has already said, all you have to do is to use the functions mantioned above.
Here is a simple code whitch prints the curren't vehicle's health (Sorry if you do not use the Zcmd include, I just think its the best way to preform commands):
pawn Код:
command(timeron, playerid, params[])
{
    #pragma unused params
    SetTimerEx("GetVehicleHealth1",10000,false,"i",playerid); // The timer will be called each 10000/1000 (10) seconds
    return 1;
}

forward GetVehicleHealth1(playerid);
public GetVehicleHealth1(playerid)
{
    new
        Float:health,
        veh,
        string[128];
       
    veh = GetPlayerVehicleID(playerid);
    GetVehicleHealth(veh, health);
    format(string, sizeof(string), "Your current vehicle's health (Vehicle ID: %d): %f", veh, health);
    SendClientMessage(playerid, COLOR_WHITE, string);
    return 1;
}
Ofcourse you will have to kill the timer as soona as the player leaves the vehicle.

Feel free to ask any other questions.
Reply
#4

K,thanks,got it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)