By the time the player enters sleep near the bed he lies down and continues normal (ie, the animation does not apply)
Code:
if(strcmp(cmd,"/dormir", true) == 0)
{
PreloadAnimLib(playerid,"BEACH");
if(jogador[dentrodecasa][playerid]) {
if(!jogador[dormindo][playerid]) {
if(IsPlayerInRangeOfPoint(playerid, 3.0, -681.7235,439.7814,3280.6643)) {
SetPlayerPos(playerid, -681.7235,439.7814,3280.6643);
SendClientMessage(playerid, cor_verde, "Agora vocк esta dormindo!");
Dormir(playerid, 1);
} else SendClientMessage(playerid, cor_vermelho,"Vocк esta longe da cama");
} else SendClientMessage(playerid, cor_vermelho, "Vocк ja esta dormindo");
}
return 1;
}
stock Dormir(playerid, tipo)
{
PreloadAnimLib(playerid,"BEACH");
new temp;
switch(tipo) {
case 1: {
temp = 4 * 30000;// 2 Minutos
}
case 2: {
temp = 4 * 60000;// 4 Minutos
}
}
LoopingAnim(playerid,"BEACH", "bather", 4.0, 1, 1, 1, 1, temp);
SetTimerEx("PDormir", temp, false, "d", playerid)
jogador[dormindo][playerid] = true;
return 1;
}
public PDormir(playerid)
{
ClearAnimations(playerid);
jogador[sono][playerid] = 0;
jogador[dormindo][playerid] = false;
SendClientMessage(playerid, cor_azul, "Vocк ja dormiu! Vocк esta sem sono agora!");
return 1;
}
stock LoopingAnim(playerid,animlib[],animname[], Float:Speed, looping, lockx, locky, lockz, lp)
{
ApplyAnimation(playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp);
}
stock PreloadAnimLib(playerid, animlib[])
{
ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
}
And he rarely throws.