04.10.2013, 20:53
Olб, eu tenho um sistema de hospital o seguinte: Quando o player morre, ele fica na mesma posiзгo e aparece uma mensagem pergunta se ele deseja pedir uma ambulвncia ou se deseja "morrer", mas quando o player morre, nгo esta aparecendo nada!
Alguns cуdigos estгo mal organizados por que montei eles aqui no new post
pawn Код:
public SetPlayerSpawn(playerid)
{
if(IsPlayerConnected(playerid))
{
if(FixBug[playerid] == 0 && PlayerIsDead[playerid] == 1 && Hospital[playerid] == 1)
{
MorreDeita = SetTimerEx("MorreDeitaTimer", 100, 0, "i", playerid);
return 1;
}
}
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
GetPlayerPos(playerid, mortex[playerid], mortey[playerid], mortez[playerid]);
World[playerid] = GetPlayerVirtualWorld(playerid);
Interior[playerid] = GetPlayerInterior(playerid);
PlayerIsDead[playerid] = 1;
Hospital[playerid] = 1;
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(ApertarFnaMorte[playerid] == 1)
{
HospitalCountdown(playerid);
PlayerIsDead[playerid] = 0;
}
return 1;
}
public Ambu(playerid)
{
SetPlayerPos(playerid, 2003.3408,2288.1384,1011.1256);
SetPlayerInterior(playerid, 1);
SetPlayerFacingAngle(playerid, 180.0);
ApplyAnimation(playerid, "CRACK", "Crckidle2", 4.0, 1, 0, 0, 0, 0);
TogglePlayerControllable( playerid, 1);
SetPlayerCameraPos(playerid,2002.6595,2284.1914,1012.5668);
SetPlayerCameraLookAt(playerid,2003.4644,2288.8337,1011.1256);
ResetPlayerWeapons(playerid);
GameTextForPlayer(playerid, "~r~Curando...", 30000, 5);
Irhosp2 = SetTimerEx("HospitalCountdown", 30000, 0, "i", playerid);
return 0;
}
public MorreDeitaTimer(playerid)
{
SetPlayerPos(playerid, mortex[playerid], mortey[playerid], mortez[playerid]);
SetPlayerVirtualWorld(playerid, World[playerid]);
SetPlayerInterior(playerid, Interior[playerid]);
ApplyAnimation(playerid,"CRACK", "crckdeth2", 4.0, 0, 1, 1, 1, 0);
SetPlayerHealth(playerid, 10);
SendClientMessage(playerid, COLOR_ALLDEPT, "[BNP] Vocк se feriu e precisa de esperar a ambulвncia. Para aceitar morrer /aceitarmorrer");
SendClientMessage(playerid, COLOR_ALLDEPT, "[BNP] Para chamar a ambulвncia /serviзo mйdico");
ApertarFnaMorte[playerid] = 1;
return 0;
}
public HospitalCountdown(playerid)
{
ApertarFnaMorte[playerid] = 0;
Hospital[playerid] = 0;
if(PlayerInfo[playerid][pDonateRank] == 1)
{
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 30);
PlayerInfo[playerid][pDeaths] += 1;
ClearAnimations(playerid);
TogglePlayerControllable( playerid, 1);
SetPlayerInterior(playerid, 0);
SafeGivePlayerWeapon(playerid, 22, 100);
SafeGivePlayerWeapon(playerid, 29, 250);
SafeGivePlayerWeapon(playerid, 31, 250);
new rand;
rand = random(sizeof(HospSpawns));
SetPlayerPos(playerid, HospSpawns[rand][0], HospSpawns[rand][1], HospSpawns[rand][2]);
SendClientMessage(playerid, TEAM_CYAN_COLOR, "[Enfermeira]Vocк estб melhor, jб pode ir para casa!");
SetCameraBehindPlayer(playerid);
return 1;
}
if(PlayerInfo[playerid][pDonateRank] == 2)
{
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 60);
PlayerInfo[playerid][pDeaths] += 1;
ClearAnimations(playerid);
TogglePlayerControllable( playerid, 1);
SetPlayerInterior(playerid, 0);
SafeGivePlayerWeapon(playerid, 24, 200);
SafeGivePlayerWeapon(playerid, 29, 550);
SafeGivePlayerWeapon(playerid, 31, 550);
new rand;
rand = random(sizeof(HospSpawns));
SetPlayerPos(playerid, HospSpawns[rand][0], HospSpawns[rand][1], HospSpawns[rand][2]);
SendClientMessage(playerid, TEAM_CYAN_COLOR, "[Enfermeira]Vocк estб melhor, jб pode ir para casa!");
SetCameraBehindPlayer(playerid);
return 1;
}
if(PlayerInfo[playerid][pDonateRank] == 3)
{
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 90);
PlayerInfo[playerid][pDeaths] += 1;
ClearAnimations(playerid);
TogglePlayerControllable( playerid, 1);
SetPlayerInterior(playerid, 0);
SafeGivePlayerWeapon(playerid, 24, 9999);
SafeGivePlayerWeapon(playerid, 29, 9999);
SafeGivePlayerWeapon(playerid, 31, 9999);
new rand;
rand = random(sizeof(HospSpawns));
SetPlayerPos(playerid, HospSpawns[rand][0], HospSpawns[rand][1], HospSpawns[rand][2]);
SendClientMessage(playerid, TEAM_CYAN_COLOR, "[Enfermeira]Vocк estб melhor, jб pode ir para casa!");
SetCameraBehindPlayer(playerid);
return 1;
}
else
SetPlayerHealth(playerid, 100);
PlayerInfo[playerid][pDeaths] += 1;
ClearAnimations(playerid);
TogglePlayerControllable( playerid, 1);
SetPlayerInterior(playerid, 0);
new rand;
rand = random(sizeof(HospSpawns));
SetPlayerPos(playerid, HospSpawns[rand][0], HospSpawns[rand][1], HospSpawns[rand][2]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "[Enfermeira]Vocк estб, melhor jб pode ir para casa!");
ResetPlayerWeapons(playerid);
SetCameraBehindPlayer(playerid);
return 0;
}