public OnPlayerDeath(playerid, killerid, reason) { SetPlayerPos(playerid, 2563.9680,-1821.03295,1223.7919); SetPlayerInterior(playerid, 2); SetTimerEx("UnfreezePlayer", 10000, false, "i", playerid); //SetPlayerVirtualWorld(playerid, 0); return 1; }
if(strcmp(cmdtext, "/tele", true) == 0) { SetPlayerPos(playerid, 2563.9680,-1821.03295,1223.7919); SetPlayerInterior(playerid, 2); return 1; }
public UnfreezePlayer(playerid) { TogglePlayerControllable(playerid, true); return 1; }
new PlayerDied[MAX_PLAYERS]; public OnPlayerConnect(playerid) { PlayerDied[playerid] = false; return 1; } public OnPlayerDeath(playerid, killerid, reason) { PlayerDied[playerid] = true; return 1; } public OnPlayerSpawn(playerid) { if(PlayerDied[playerid] == true) { SetPlayerPos(playerid, 2563.9680,-1821.03295,1223.7919); SetPlayerInterior(playerid, 2); TogglePlayerControllable(playerid,0); SetTimerEx("UnfreezePlayer", 10000, false, "i", playerid); //SetPlayerVirtualWorld(playerid, 0); PlayerDied[playerid] = false; } else { // Spawn the player on the spawn pos } return 1; }
Does the player get freezed?
Try to set a variable after death and on the spawn freeze and set the player pos Код:
new PlayerDied[MAX_PLAYERS]; public OnPlayerConnect(playerid) { PlayerDied[playerid] = false; return 1; } public OnPlayerDeath(playerid, killerid, reason) { PlayerDied[playerid] = true; return 1; } public OnPlayerSpawn(playerid) { if(PlayerDied[playerid] == true) { SetPlayerPos(playerid, 2563.9680,-1821.03295,1223.7919); SetPlayerInterior(playerid, 2); TogglePlayerControllable(playerid,0); SetTimerEx("UnfreezePlayer", 10000, false, "i", playerid); //SetPlayerVirtualWorld(playerid, 0); PlayerDied[playerid] = false; } else { // Spawn the player on the spawn pos } return 1; } |
SetSpawnInfo(playerid, team, skin, Float:x, Float:y, Float:z, Float:Angle, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo);
//On top:
new bool:pDead[MAX_PLAYERS] = false;
// Callbacks:
public OnPlayerDeath(playerid, killerid, reason)
{
// Your code
pDead[playerid] = true;
return 1;
}
public OnPlayerSpawn(playerid)
{
if(pDead[playerid] == true)
{
SetPlayerInterior(playerid, 2);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerPos(playerid, 2563.9680, -1821.03295, 1223.7919);
TogglePlayerControllable(playerid, 0);
SetTimerEx("UnfreezePlayer", 10000, false, "i", playerid);
return 1;
}
// Put this code in the BEGINNING of the callback.
}
forward UnfreezePlayer(playerid);
public UnfreezePlayer(playerid)
{
TogglePlayerControllable(playerid, 1);
pDead[playerid] = false;
SpawnPlayer(playerid);
SendClientMessage(playerid, -1, "You are free!");
return 1;
}