Freeze player but not make him invincible - 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: Freeze player but not make him invincible (
/showthread.php?tid=336750)
Freeze player but not make him invincible -
Prostilov - 23.04.2012
Код:
GetPlayerName(playerid, playerName);
TogglePlayerControllable(playerid, 0);
ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0, 1);
SendClientMessage(playerid, COLOR_LIGHTRED, "You have been seriously wounded and you aren't able to walk any further!");
if(PlayerInfo[playerid][pSex] = 1)
{
format(string,sizeof(string), "%s falls to the ground because of his wounds.", playerName);
}
else if(PlayerInfo[playerid][pSex] = 2)
{
format(string,sizeof(string), "%s falls to the ground because of her wounds.", playerName);
}
ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
The problem is I use TogglePlayerControllable but I want the player to still be vulnerable to damage, unfortunately TogglePlayerControllable makes him invincible. How would I be able to freeze a player without making him invincible?
Re: Freeze player but not make him invincible -
Claude - 23.04.2012
You can store the data when TogglePlayerControllable(...) is used.
Use
OnPlayerTakeDamage to make him vulnerable
Re: Freeze player but not make him invincible -
Prostilov - 23.04.2012
I don't exactly know what you mean, could you give an example?
And all of this is already under OnPlayerTakeDamage.
Re: Freeze player but not make him invincible -
Claude - 23.04.2012
Test it and tell me if it worked
pawn Код:
/// On top of your script
new bool:bFrozen[MAX_PLAYERS];
/// When TogglePlayerControllabe is used:
if(bFrozen[playerid] == true) {
bFrozen[playerid] = false;
} else {
bFrozen[playerid] = true;
}
/// Add this under OnPlayerTakeDamage
// other stuff
new Float:fHealth;
GetPlayerHealth(playerid, fHealth);
SetPlayerHealth(playerid, (fHealth - amount));