SA-MP Forums Archive
[ HELP ] Problem with the Player Death. - 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: [ HELP ] Problem with the Player Death. (/showthread.php?tid=577379)



[ HELP ] Problem with the Player Death. - SpikY_ - 11.06.2015

Hi,
I have problem with player death. when i type /kill my player get die its ok and then where he died. he spawn there where i typed /kill.
Here and are pictures and codess

when i was type /kill:



And then my player died:


and next he spawned at the same place where he died.


You can also see the timer at down.

Codes:
Код:
	if(strcmp(cmd, "/kill", true) == 0)
	{
		
		return SetPlayerHealth(playerid,0.0);
	}
and on player spawn
Код:
public OnPlayerSpawn(playerid)
{
    TextDrawShowForPlayer(playerid, Textdraw2);
   	TextDrawHideForPlayer(playerid, Textdraw4);
	TextDrawHideForPlayer(playerid, Textdraw5);
	TextDrawHideForPlayer(playerid, Textdraw6);
	TextDrawHideForPlayer(playerid, Textdraw7);
	TextDrawHideForPlayer(playerid, Textdraw8);
	TextDrawShowForPlayer(playerid, Timer);
	SetPlayerRaceCheckpoint(playerid, 0,-2264.8501,2312.7566,4.5473,-2271.4414,2351.0659,4.4289,10);
	Stats[playerid] = 1;
	SetPlayerColor(playerid, COLOR_YELLOW);
	SetPlayerTime(playerid,12,0);
	SetPlayerInterior(playerid,0);
	SetCameraBehindPlayer(playerid);
	SendClientMessage(playerid,0xFF0000FF,"{FF0000}» Usage: {FFFFFF}/re to repair your vehicle!");
	SendClientMessageToAll(-1,"{000DFF}» Serv: {0080FF}This Mission has been created by SpikY_ | On 10/6/2015 | Mission Name: The Marathon Race!");
	SetPlayerPos(playerid,-2263.6921,2284.1008,4.8202);
	SetPlayerHealth(playerid,100);
	SetPlayerArmour(playerid,0);
	PutPlayerInVehicle(playerid, car[playerid], 0);
	if(Free == 0)
	{
	TogglePlayerControllable(playerid, 0);
	}
	else if(Free == 1)
 	{
 	TogglePlayerControllable(playerid, 1);
 	}
	return 1;
}
please help me. Thank you


Re: [ HELP ] Problem with the Player Death. - SpikY_ - 11.06.2015

BUMP.
Anyone please?


Re: [ HELP ] Problem with the Player Death. - Ghazal - 11.06.2015

It is because you are setting the player pos to this position...
Quote:
Originally Posted by NGEN123
Посмотреть сообщение
SetPlayerPos(playerid,-2263.6921,2284.1008,4.8202);



Re: [ HELP ] Problem with the Player Death. - SpikY_ - 11.06.2015

should i remove it?


Re: [ HELP ] Problem with the Player Death. - SpikY_ - 11.06.2015

ok. i tried to remove it but the problem is still there.


Re: [ HELP ] Problem with the Player Death. - Huba - 11.06.2015

This: PutPlayerInVehicle(playerid, car[playerid], 0);

Here you are, fixed:

Код:
public OnPlayerSpawn(playerid)
{
    TextDrawShowForPlayer(playerid, Textdraw2);
   	TextDrawHideForPlayer(playerid, Textdraw4);
	TextDrawHideForPlayer(playerid, Textdraw5);
	TextDrawHideForPlayer(playerid, Textdraw6);
	TextDrawHideForPlayer(playerid, Textdraw7);
	TextDrawHideForPlayer(playerid, Textdraw8);
	TextDrawShowForPlayer(playerid, Timer);
	SetPlayerRaceCheckpoint(playerid, 0,-2264.8501,2312.7566,4.5473,-2271.4414,2351.0659,4.4289,10);
	Stats[playerid] = 1;
	SetPlayerColor(playerid, COLOR_YELLOW);
	SetPlayerTime(playerid,12,0);
	SetPlayerInterior(playerid,0);
	SetCameraBehindPlayer(playerid);
	SendClientMessage(playerid,0xFF0000FF,"{FF0000}» Usage: {FFFFFF}/re to repair your vehicle!");
	SendClientMessageToAll(-1,"{000DFF}» Serv: {0080FF}This Mission has been created by SpikY_ | On 10/6/2015 | Mission Name: The Marathon Race!");
	SetPlayerHealth(playerid,100);
	SetPlayerArmour(playerid,0);
	if(Free == 0)
	{
	TogglePlayerControllable(playerid, 0);
	}
	else if(Free == 1)
 	{
 	TogglePlayerControllable(playerid, 1);
 	}
	return 1;
}



Re: [ HELP ] Problem with the Player Death. - SpikY_ - 11.06.2015

You know what. there are many vehicle which are added in a row. its a race type mission.
onplayerspawn. they should be get into vehicle automatically. if i remove " PutPlayerInVehicle(playerid, car[playerid], 0); " then player will spawn at some other place.

Still its not fixed yet.
Anyone else please. :'[


Re: [ HELP ] Problem with the Player Death. - Huba - 11.06.2015

Now i can't understand you..
You want delete the saving position in OnPlayerSpawn. It's impossible, because in this callback you have PutPlayeInVehicle function, which auto teleporting the player to the vehicle. What you want to do?


Re: [ HELP ] Problem with the Player Death. - SpikY_ - 11.06.2015

I want to get the player at spawn again. you can see the 3rd picture. i want the player to get on those bmx automatically if they dieds.
and want to delete the vehicle which he left before dieing.


Re: [ HELP ] Problem with the Player Death. - Sawalha - 11.06.2015

do you mean this?
pawn Код:
PutPlayerInVehicle(playerid, car[playerid], 0);
DestroyVehicle(playerid, car[playerid]);
they are under OnPlayerSpawn