SA-MP Forums Archive
Problem with death and OnPlayerRequestClass - 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: Problem with death and OnPlayerRequestClass (/showthread.php?tid=649179)



Problem with death and OnPlayerRequestClass - FelixAquero - 04.02.2018

Hi. If I press F4 and die in the vehicle (I use SetPlayerHealth (playerid, 0.0) there is a call of OnPlayerRequestClass occurs, even without the animation of death. I show it on new.pwn.
Код:
#include <a_samp>

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print(" Blank Gamemode by your name here");
	print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
	SetGameModeText("Blank Script");
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	AddStaticVehicle(411, 2977.9031,1295.5956,18.2517,259.4196, 1, 1);
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 2977.9031,1295.5956,18.2517);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/tp", cmdtext, true, 3) == 0)
	{
		SetPlayerPos(playerid, 2977.9031,1295.5956,18.2517);
		return 1;
	}
	if (strcmp("/kill", cmdtext, true, 5) == 0)
	{
		SetPlayerHealth(playerid, 0.0);
		return 1;
	}
	return 0;
}
Video: https://www.youtube.com/watch?v=2PkV...ature=*********


Re: Problem with death and OnPlayerRequestClass - PepsiCola23 - 04.02.2018

so what is the problem? not showing the dying animation?


Re: Problem with death and OnPlayerRequestClass - FelixAquero - 04.02.2018

Yes, because of this bug after the spawn of the player there is an even stranger bug


Re: Problem with death and OnPlayerRequestClass - Sew_Sumi - 04.02.2018

F4 forces you to Character Selection on the next death, as it says on the screen when you press F4...

You die, you'll be requesting a class... Hence why it's request class, as you are selecting your character again.


What is the issue?


Re: Problem with death and OnPlayerRequestClass - FelixAquero - 04.02.2018

Why does not show the death animation?


Re: Problem with death and OnPlayerRequestClass - Mobtiesgangsa - 04.02.2018

You first requested while pressing 'F4' class selection after death, am i correct?
then you typed command /kill and it opt you a class selection (<) (>) (spawn) after death
and you are wondering why didn't the script play's such an animation?


Re: Problem with death and OnPlayerRequestClass - Sew_Sumi - 04.02.2018

Quote:
Originally Posted by FelixAquero
Посмотреть сообщение
Why does not show the death animation?
Because even when it's pressed in normal state, it doesn't show the animation as it puts you in the class selection instantly.

This is something people were abusing at one point where they'd press F4, die, and not be back where they were to be put out of the death state for medics/execution on RP servers.

If you're looking at doing a death animation, with the EMS save situation, or anything like that you could check in OnPlayerRequestClass whether they did this, and simply respawn them, throw them back to where they were and set their health to 0 again.

Something anyway, I'd simply put a message up, count each time they do it and make it a 3 strike rule, and just jail them.


Re: Problem with death and OnPlayerRequestClass - FelixAquero - 04.02.2018

How to fix this? On the server on which I play does not have this problem


Re: Problem with death and OnPlayerRequestClass - FelixAquero - 04.02.2018

When spawning via OnPlayerRequestClass, the following occurs: https://*********/QTtDlrDPsio


Re: Problem with death and OnPlayerRequestClass - Sew_Sumi - 04.02.2018

Actually, you're missing most of new.pwn... That's highly likely as to why this is the case.

Some of those callbacks that you're simply 'removing' still need to be in the gamemode in many cases.