Freeze player but not make him invincible
#1

Код:
	    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?
Reply
#2

You can store the data when TogglePlayerControllable(...) is used.
Use OnPlayerTakeDamage to make him vulnerable
Reply
#3

I don't exactly know what you mean, could you give an example?
And all of this is already under OnPlayerTakeDamage.
Reply
#4

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));
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)