onplayerdeath bug
#1

hello, if I kill my enemy, the enemy's HP will go blink and on my screen, I can see the enemy dead but on enemy's POV, he's still alive. The enemy can shoot me, and kill me too. however, he will be invisible, and I can see his bullets going after me. the enemy can only be killed by killing himself (/kill doesnt work) by jumping off a cliff or damaging himself. I have added ClearAnimations(playerid); on OnPlayerDeath.

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	new string[128];
	SendDeathMessage(killerid, playerid, reason);
	ClearAnimations(playerid);
	if(killerid != INVALID_PLAYER_ID)
	{
		switch(random(2))
		{
		    case 0: format(string, sizeof(string), "You have eliminated %s (%d).", GetName(playerid), playerid);
		    case 1: format(string, sizeof(string), "You have killed %s (%d).", GetName(playerid), playerid);
		    case 2: format(string, sizeof(string), "%s (%d) has been finished off.", GetName(playerid), playerid);
		}
		SendClientMessage(killerid, -1, ""COL_GRAY"You have also received +$50 and +1 score.");
		GivePlayerMoney(killerid, 50);
		GivePlayerScore(killerid, 1);
		GameTextForPlayerEx(killerid, string, 2500);
		switch(random(2))
		{
		    case 0: format(string, sizeof(string), "You have been eliminated by %s (%d).", GetName(killerid), killerid);
		    case 1: format(string, sizeof(string), "You have been killed by %s (%d).", GetName(killerid), killerid);
		    case 2: format(string, sizeof(string), "You have been finished off by %s (%d).", GetName(killerid), killerid);
		}
		GameTextForPlayerEx(playerid, string, 2500);
		if(pInfo[playerid][Streak] >= 3)
		{
			switch(random(2))
			{
			    case 0: format(string, sizeof(string), ""COL_SERVER"%s (%d)"COL_WHITE" has broken "COL_SERVER"%s (%d)"COL_WHITE"'s killstreak of %d!", GetName(killerid), killerid, GetName(playerid), playerid, pInfo[playerid][Streak]);
				case 1: format(string, sizeof(string), ""COL_SERVER"%s (%d)"COL_WHITE" breaks the killstreak of "COL_SERVER"%s (%d)"COL_WHITE" of %d!", GetName(killerid),killerid,GetName(playerid),playerid, pInfo[playerid][Streak]);
				case 2: format(string, sizeof(string), ""COL_SERVER"%s (%d)"COL_WHITE" has crushed "COL_SERVER"%s (%d)"COL_WHITE"'s killstreak of %d!", GetName(killerid),killerid,GetName(playerid),playerid,pInfo[playerid][Streak]);
			}
			SendClientMessageToAll(-1, string);
			pInfo[playerid][Streak] = 0;
		}
		pInfo[killerid][Streak]++;
		if(pInfo[killerid][Streak] % 3 == 0)
		{
		    switch(random(2))
		    {
				case 0: format(string, sizeof(string), ""COL_SERVER"%s (%d)"COL_WHITE" is on killing spree of %d killstreaks!",GetName(killerid),killerid,pInfo[killerid][Streak]);
				case 1: format(string, sizeof(string), ""COL_SERVER"%s (%d)"COL_WHITE" has created a killstreak of %d!", GetName(killerid), killerid, pInfo[killerid][Streak]);
				case 2: format(string, sizeof(string), ""COL_SERVER"%s (%d)"COL_WHITE" is now creating a rampage of %d killstreaks!", GetName(killerid), killerid, pInfo[killerid][Streak]);
			}
			GivePlayerMoney(killerid, 50 * pInfo[killerid][Streak]);
			GivePlayerScore(killerid, 1 * pInfo[killerid][Streak]);
		}
	}
	return 1;
}
UPDATE: Enemy's POV
Reply
#2

PHP код:
ClearAnimations(playerid); 
I don't know why you add this if the player is already dying? The problem comes from this. (My sentence means nothing?)
You have to remove this and the player will die with a normal animation.
PHP код:
 pInfo[killerid][Streak] % == 
Hmm. I think 9 % 3 = 0 so.. 6 % 3 =0 too. 9/3 = 3
PHP код:
 pInfo[killerid][Streak] % == 0  && pInfo[killerid][Streak] <= 
No?
I hope I helped you!
Reply
#3

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
PHP код:
ClearAnimations(playerid); 
I don't know why you add this if the player is already dying? The problem comes from this. (My sentence means nothing?)
You have to remove this and the player will die with a normal animation.
PHP код:
 pInfo[killerid][Streak] % == 
Hmm. I think 9 % 3 = 0 so.. 6 % 3 =0 too. 9/3 = 3
PHP код:
 pInfo[killerid][Streak] % == 0  && pInfo[killerid][Streak] <= 
No?
I hope I helped you!
I was checking if the streak is divisible by 3
And before I added ClearAnimations(playerid);, it was already bugging
Reply
#4

Oh, apologizes, then. Your bug is solved?
Reply
#5

Not yet ((
Reply
#6

Even with removing ?
PHP код:
 ClearPlayerAnimations(playerid); 
Reply
#7

Yes. Before I added that, it was already bugging.
Reply
#8

So weird.. Try to create a command which kill yourself like /suicide. To check if it's not OnPlayerDeath is bugged ^^
Reply
#9

I have created a command called /kill and when bugged, it doesnt work but when I use it normally, it works.
Reply
#10

Put : SetPlayerHealth(playerid, 0); and SpawnPlayer(playerid); in that callback.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)