OnVehicleDamageStatusUpdate
#1

I made a simple vehicle crashing system. If you go at a certain speed, a certain drunk level will affect you... It works great for every crash, but my problem is that it also happens when someone turns on sirens or uses his vehicle's lights.

Any idea on how it could "ignore" the damages or changes to the lights?
Reply
#2

Well for now I made a health change check. So if the vehicle's health doesn't change, the effect will not happen. But if you got any more effective ideas, thank you.
Reply
#3

Hmm, it worked for the first time, but not for the second time o_o.

This is a part of the code

pawn Код:
new Float:Speed, Float:vehealth, string[128], string2[128], oldhealth[256];
    GetVehicleSpeed(vehicleid, Speed);
    GetVehicleHealth(vehicleid, vehealth);

    format(string, sizeof(string), "%d", vehicleid);
    oldhealth = dini_Get("VehicularDamage.txt", string);

    format(string2, sizeof(string2), "Health ondamagestatus: %d", vehealth);
    printf(string2);
    format(string2, sizeof(string2), "Vehicular damage: %d", strval(oldhealth));
    printf(string2);
   
    if(AntiCrash[playerid]==0 && Speed > 20 && Speed < 40 && vehealth != strval(oldhealth)){
    SetPlayerDrunkLevel(playerid, 5000);
    SetTimerEx("StopCrashEffect", 3000,0,"i", playerid); // 3 secs
    AntiCrash[playerid]=1;
    format(string2, sizeof(string2), "%d", vehealth);
    dini_Set("VehicularDamage.txt",string,string2);
    return 1;
    }




public StopCrashEffect(playerid){
SetPlayerDrunkLevel(playerid, 0);
AntiCrash[playerid]=0;
return 1;
}
It seems to print well...

When I activate the lights, the health stays the same... Except the drunk effect still affects me.

Lights on:

[09:20:17] Health ondamagestatus: 1148558252
[09:20:17] Vehicular damage: 1148558252
[09:20:31] Health ondamagestatus: 1148558252
[09:20:31] Vehicular damage: 1148558252
[09:20:31] Health ondamagestatus: 1148558252
[09:20:31] Vehicular damage: 1148558252

After a crash:

[09:20:31] Health ondamagestatus: 1148336607
[09:20:31] Vehicular damage: 1148558252
[09:20:35] Health ondamagestatus: 1148227502
[09:20:35] Vehicular damage: 1148558252
Reply
#4

Use the edit button instead of bumping your post up to 2 times.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)