Onplayerdeath problem -
virusa1 - 16.03.2013
Hello All!
I have a problem in my gm. When somebody dies it search to spawn, and when i click spawn it spawns me in 0,0 cords.
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerInfo[killerid][pKills]++;
PlayerInfo[playerid][pDeaths]++;
SetPlayerPos(playerid, 1237.1611,304.9076,24.7578);
SetPlayerCameraPos(playerid, 1251.0834,353.5869,26.5555);
SetPlayerCameraLookAt(playerid, 1247.0811,325.1535,24.7578);
SetTimerEx("HospitalRelease", 30000, 0, "i", playerid);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 0);
SetTimerEx("HosCam", 1000, 0, "i", playerid);
return 1;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
return 1;
}
I want that when somebody dies it spawns automatically in hospital.
Re: Onplayerdeath problem -
Colossus874 - 16.03.2013
Nevermind.
Re: Onplayerdeath problem -
Bicentric - 16.03.2013
pawn Код:
new bool:InHospital[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerInfo[killerid][pKills]++;
PlayerInfo[playerid][pDeaths]++;
InHospital[playerid] = true;
return 1;
}
public OnPlayerSpawn(playerid)
{
if(InHospital[playerid])
{
SetPlayerPos(playerid, 1237.1611,304.9076,24.7578);
SetPlayerCameraPos(playerid, 1251.0834,353.5869,26.5555);
SetPlayerCameraLookAt(playerid, 1247.0811,325.1535,24.7578);
SetTimerEx("HospitalRelease", 30000, 0, "i", playerid);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 0);
SetTimerEx("HosCam", 1000, 0, "i", playerid);
}
return 1;
}
Remember in the function 'HospitalRelease' to set 'InHospital' to false for that player using:
pawn Код:
InHospital[playerid] = false;
Re: Onplayerdeath problem -
virusa1 - 16.03.2013
1 sec i will test this
Re: Onplayerdeath problem -
Bicentric - 16.03.2013
Quote:
Originally Posted by virusa1
1 sec i will test this
|
Kk, I have update the code as I missed out a if statement, so make sure you're using the updated code I put in that post.
Re: Onplayerdeath problem -
virusa1 - 16.03.2013
hmm.. where i should put the InHospital[playerid] = false; sorry, i just woke up :P :P
Re: Onplayerdeath problem -
daddyblake - 16.03.2013
I used TogglePlayerControllable to make players uncontrollable whilst the hospital sequence is taking place.