PDA

View Full Version : Key= death?


Gooday
04/04/2012, 09:30 AM
public OnVehicleDamageStatusUpdate(vehicleid,playerid)
{
new Float:health;
GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, health-10);
return 1;
} Basicelly when u crash you loce health...But when i press F12 The player dies if in a vehicle! Why? +REP!

aRoach
04/04/2012, 10:02 AM
And without this snippet of code the player doesn't die ?

[HiC]TheKiller
04/04/2012, 10:07 AM
I'm pretty sure that OnVehicleDamageStatusUpdate doesn't work like that ;). OnVehicleDamageStatusUpdate is called once a body part of the car is damaged, if you damage multiple parts at once, I'm pretty sure that it will call multiple times.

Gooday
04/04/2012, 10:10 AM
And without this snippet of code the player doesn't die ?

No it doesnt just when you press f12 :|

Althought is there a function to give -10 HP to the player when crashes? More RP...That what i was trying to do...

aRoach
04/04/2012, 10:11 AM
Yes you're right, but I've asked if without that snippet it works fine.
It shouldn't because OnVehicleDamageStatusUpdate have nothing to do with the keys...

Gooday
04/04/2012, 10:20 AM
Oh, Yes Without the snippet all works fine, Could u post a example if you know about "Lose health when crash" I mean I would like to synch the VehicleHealth with the PlayerHealth ...

Reklez
04/04/2012, 10:22 AM
here is my code (get from my LS Reality Roleplay Script)


public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
new Float:health;
GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, health - 2.2);
return 1;
}


didn't affects my game even i press F12. all works fine ;D

aRoach
04/04/2012, 10:30 AM
Oh, Yes Without the snippet all works fine, Could u post a example if you know about "Lose health when crash" I mean I would like to synch the VehicleHealth with the PlayerHealth ...

You want the player to have the same health value as the car ?

If yes:
public OnGameModeInit( )
{
SetTimer( "vSync", 1000, true );
return 1;
}

forward vSync( );
public vSync( )
{
for( new i; i < MAX_PLAYERS; i ++ )
{
new Float:HP;
GetVehicleHealth( GetPlayerVehicleID( i ), HP );
SetPlayerHealth( i, HP / 10 );
}

return 1;
}

Gooday
04/04/2012, 10:47 AM
Thank you :)