SA-MP Forums Archive
Problem with OnPlayerDeath - 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 OnPlayerDeath (/showthread.php?tid=606027)



Problem with OnPlayerDeath - Micko123 - 28.04.2016

Guys i made DM zone. Everything is nice but there is one problem. When player dies in DM zone i want him to respawn in DM zone but he respawns on start spawn. How to fix this??


Re: Problem with OnPlayerDeath - MBilal - 28.04.2016

Show codes

As an Example

OnPlayerSpawn
{
if(DM[playerid] == 1)
{// put dm cords here
SetPlayerPos(playerid,DMX,DMY,DMZ);
}
else
{

spawn him normally
}

}


Re: Problem with OnPlayerDeath - Micko123 - 28.04.2016

What you need?


Re: Problem with OnPlayerDeath - MBilal - 28.04.2016

Show me your DM cmd.


Re: Problem with OnPlayerDeath - Micko123 - 28.04.2016

Код:
CMD:dm(playerid, params[])
{
    PlayerJoinedDMZone[playerid] = 1;
    new randomcoords = random(sizeof(DMSpawn));
    SPP(playerid, DMSpawn[randomcoords][0],
				  DMSpawn[randomcoords][1],
	              DMSpawn[randomcoords][2]);
	GivePlayerWeapon(playerid, 26, 100);
	GivePlayerWeapon(playerid, 22, 100);
	GivePlayerWeapon(playerid, 25, 100);
	GivePlayerWeapon(playerid, 28, 500);
	GivePlayerWeapon(playerid, 30, 100);
	GivePlayerWeapon(playerid, 33, 50);
	SetPlayerArmour(playerid, 100);
	SPH(playerid, 100);
	return 1;
}

CMD:napustidm(playerid, params[])
{
	PlayerJoinedDMZone[playerid] = 0;
 	SCM(playerid, 0xF81414, "Napustili ste DM zonu");
 	SPP(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}
These are /dm and /leavedm (just on my language)
and this is currently OnPlayerDeath
Код:
if(PlayerJoinedDMZone[playerid] == 1)
	{
	    new randomcoords = random(sizeof(DMSpawn));
		SPP(playerid, DMSpawn[randomcoords][0], DMSpawn[randomcoords][1], DMSpawn[randomcoords][2]);
	}



Re: Problem with OnPlayerDeath - MBilal - 28.04.2016

Remove this from under OnPlayerDeath and put this under OnPlayer Spawn

OnPlayerSpawn(playerid)
{
if(PlayerJoinedDMZone[playerid] == 1)
{
new randomcoords = random(sizeof(DMSpawn));
SPP(playerid, DMSpawn[randomcoords][0], DMSpawn[randomcoords][1], DMSpawn[randomcoords][2]);
}
else
{
//Normal spawn codes

}
return 1;
}


Re: Problem with OnPlayerDeath - Micko123 - 28.04.2016

Quote:
Originally Posted by MBilal
Посмотреть сообщение
Remove this from under OnPlayerDeath and put this under OnPlayer Spawn
if(PlayerJoinedDMZone[playerid] == 1)
{
new randomcoords = random(sizeof(DMSpawn));
SPP(playerid, DMSpawn[randomcoords][0], DMSpawn[randomcoords][1], DMSpawn[randomcoords][2]);
}
okay thanks i will try it now