Respawn
#1

I made a simple yet working DM GM, however i found a small problem that i thought i could fix on my own but i cant and its pissing me off cuz i think im on the right track xD

Anyway this is my problem. Once you die in a DM you should respawn on the DM, but i respawn in the lobby. This is my code, please tell me what im doing wrong.

Код:
public OnPlayerDeath(playerid, killerid, reason) {
	if (Players[playerid][DM]) Players[playerid][DMSpawn] = true;

        ...

	return 1; }


public OnPlayerRequestSpawn(playerid) {
	if (Players[playerid][DMSpawn]) {
                 Players[playerid][DMSpawn] = false;
                 DMs_Spawn (playerid, Players[playerid][DMid]);
                 return 1; }

        ...

	return 1; }
DMs_Spawn - Function that i use to send the players to the chosen DM id in te first place
Players[playerid][DM] - Bool that tells me if the player is in the dm
Players[playerid][DMSpawn] - "Flag" that will make the player respawn in the dm
Reply
#2

Set a timer on OnPlayerDeath, to a function which teleports you to the DM.
Example:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
SetTimerEx("RespawnInDM",1500,0,"i",playerid);
}
forward RespawnInDM(playerid);
public RespawnInDM(playerid)
{
SetPlayerPos(playerid,..,..,..);//insert spawn coordinates here, you might want to add SetPlayerInterior and SetPlayerVirtualWorld if needed
}
Reply
#3

didnt work either, once i died it makes me spawn underground while falling (bugged).
Reply
#4

You must use OnPlayerSpawn not OnPlayerRequestSpawn
Reply
#5

thanks, owrked like a charm. i used OnPlayerRequestSpawn cuz i saw it in another gm and worked. anyway big thanks
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)