Problem with OnPlayerDeath
#1

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??
Reply
#2

Show codes

As an Example

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

spawn him normally
}

}
Reply
#3

What you need?
Reply
#4

Show me your DM cmd.
Reply
#5

Код:
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]);
	}
Reply
#6

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;
}
Reply
#7

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)