View Single Post
Author Message
Hoto Cocoa
Senior Member
Join Date: Jun 2018
Location: Somewhere
Old 02-04-2020 , 09:13   Restore boss plugin trouble
Reply With Quote #1

Hi. I am making a plugin that allow player with the o flag can respawn themselves and restore the boss with the damage they dealt. But the boss will become 0 after 1 use respawn. Can anyone would like to help me? I am bad at coding.

Code:
public Action Command_spawn (int client, int args)
{			
	new Selfhealth = FF2_GetBossHealth();
	new Selfmaxhealth = FF2_GetBossMaxHealth();
	//new Selflive = FF2_GetBossLives();
	//new Selfmaxlive = FF2_GetBossMaxLives();
	new playerdamage = FF2_GetClientDamage(client);
	
	if (IsPlayerAlive(client))
	{
		CPrintToChat(client,"{white}[{purple}FF2{white}]You are still alive~",client);
		return Plugin_Handled;
	}
	if (respawn[client] == 1)
	{
			CPrintToChat(client,"{white}[{purple}FF2{white}]You have already used your respawn chance.",client);
			return Plugin_Handled;
	}
	TF2_RespawnPlayer(client);
	Selfhealth = RoundToCeil(Selfhealth + playerdamage);
	if(Selfhealth > Selfmaxhealth)
	{
			Selfhealth = Selfmaxhealth;
	}
	FF2_SetBossHealth(0,Selfhealth);
	//FF2_SetBossLives(bossindex,Selflive);
	CPrintToChat(client,"{white}[{purple}FF2{white}]You have respawned~",client);
	CPrintToChatAll("{white}[{purple}FF2{white}]%N has respawn and restore boss with %d HP!", client, playerdamage);
    respawn[client] = 1;
    return Plugin_Handled;
}
Another thing is if the boss has 2 or more lives their health will be set to 0 when one use the respawn.
Attached Files
File Type: sp Get Plugin or Get Source (respawnvip2.sp - 65 views - 3.2 KB)

Last edited by Hoto Cocoa; 02-04-2020 at 09:15.
Hoto Cocoa is offline