Key= death? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Key= death? (
/showthread.php?tid=331280)
Key= death? -
Gooday - 04.04.2012
pawn Код:
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!
Re: Key= death? -
aRoach - 04.04.2012
And without this snippet of code the player doesn't die ?
Re: Key= death? -
[HiC]TheKiller - 04.04.2012
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.
Re: Key= death? -
Gooday - 04.04.2012
Quote:
Originally Posted by aRoach
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...
Re: Key= death? -
aRoach - 04.04.2012
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...
Re: Key= death? -
Gooday - 04.04.2012
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 ...
Re: Key= death? -
Reklez - 04.04.2012
here is my code (get from my LS Reality Roleplay Script)
pawn Код:
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
Re: Key= death? -
aRoach - 04.04.2012
Quote:
Originally Posted by Gooday
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:
pawn Код:
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;
}
Re: Key= death? -
Gooday - 04.04.2012
Thank you