Respawn - 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: Respawn (
/showthread.php?tid=421999)
Respawn -
P3DRO - 11.03.2013
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
Re: Respawn -
Jstylezzz - 11.03.2013
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
}
Re: Respawn -
P3DRO - 11.03.2013
didnt work either, once i died it makes me spawn underground while falling (bugged).
Re: Respawn -
Jefff - 11.03.2013
You must use OnPlayerSpawn not OnPlayerRequestSpawn
Re: Respawn -
P3DRO - 11.03.2013
thanks, owrked like a charm. i used OnPlayerRequestSpawn cuz i saw it in another gm and worked. anyway big thanks