Detect falling bike - 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: Detect falling bike (
/showthread.php?tid=629470)
Detect falling bike -
weex - 27.02.2017
Alguйm poderia me ajudar com uma coisa? Outras pessoas podem e deveria usar isso...
Estava querendo fazer como no GTA V dependendo de como vc bate e voa da moto, vc morre (como na vida real XD)
Entгo eu pensei em pegar o dano do splat + velocidade = dano real, mas nгo estб funcionando bem assim:
Someone could help me to a thing? It should make servers more realists...
I was trying to set realists damage when fall to bike
So i tried to take splat + player speed to get a real damage, but is not work well
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if(weaponid == 54) { // danoqueda
new speed = GetPlayerSpeedGambiarra(playerid);
new danoqueda = floatround(amount) + floatround(speed);
vida[playerid] -= danoqueda;
}
Код:
// caindo de moto
stock GetPlayerSpeedGambiarra(playerid)
{
if(playerid != INVALID_PLAYER_ID)
{
new Float:Pos[3],Float:PS;
GetPlayerVelocity(playerid, Pos[0], Pos[1], Pos[2]);
PS = floatsqroot(Pos[0]*Pos[0] + Pos[1]*Pos[1] + Pos[2]*Pos[2])*200;
return floatround(PS,floatround_round);
}
return INVALID_PLAYER_ID;
}
OnFoot damage is right, but when fall to bike damage return 2, only fucking 2
Why?
Re: Detect falling bike -
weex - 28.02.2017
up topic
Re: Detect falling bike -
DRIFT_HUNTER - 28.02.2017
Use OnPlayerUpdate and check for velocity, if that does not work than check for animation and previous state...