anti collision - 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: anti collision (
/showthread.php?tid=623943)
anti collision -
wallen - 08.12.2016
Can someone help me on scripting an anti collision? i mean if I fall my health reloads to 100, but if i get a hit it will no reload.
EDIT: i mean if you fall from a high place like from a house roof, your health will demote from 100 to 50 just to make things clear. But No i dont want this, i want a costantly health reload, if you fall and you have 50 (by accident fail) you will get back ur 100 hp.
Re: anti collision -
CoZmiNeXe - 19.07.2017
Check this page out, it might help you:
https://sampwiki.blast.hk/wiki/DisableRe...icleCollisions
If you want to give a radius for it check this page and do some logic with 'If's:
https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint
Re: anti collision -
Ebisu - 19.07.2017
Here you go, Just an example.
Edit it for youself.
PHP код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if (Logged[playerid]==1 && issuerid == INVALID_PLAYER_ID)
{
new Float:hp;
if(weaponid == 54) GetPlayerHealth(playerid, hp), hp+=amount, SetPlayerHealth(playerid, hp);
}
return 1;
}
Re: anti collision -
Paulice - 19.07.2017
Quote:
Originally Posted by Ebisu
Here you go, Just an example.
Edit it for youself.
PHP код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if (Logged[playerid]==1 && issuerid == INVALID_PLAYER_ID)
{
new Float:hp;
if(weaponid == 54) GetPlayerHealth(playerid, hp), hp+=amount, SetPlayerHealth(playerid, hp);
}
return 1;
}
|
OnPlayerTakeDamage is called after damage has been taken. What you have to actually do is check if the player is falling (there are various methods) and if so, set the player's health to 99999 (or blinking).
Re: anti collision -
Ebisu - 19.07.2017
Quote:
Originally Posted by Paulice
OnPlayerTakeDamage is called after damage has been taken. What you have to actually do is check if the player is falling (there are various methods) and if so, set the player's health to 99999 (or blinking).
|
Test the code before posting please.
Re: anti collision -
Paulice - 19.07.2017
Quote:
Originally Posted by Ebisu
Test the code before posting please.
|
If you fall from a high height (enough to take all your health away) you will die.