21.03.2016, 14:47
Код:
CMD:sleep(playerid, params[]){
if(PlayerInfo[playerid][pEnergy] == 100) return SendClientMessage(playerid, COLOR_ORANGE, "You have 100 energy");
if(PlayerInfo[playerid][pSleeping] == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, 279.1717,1835.2167,17.6481))
{
ApplyAnimation(playerid, "BEACH", "Lay_Bac_Loop", 4.1, 1, 0, 0, 0, 60000, 1);
PlayerInfo[playerid][pSleeping] = 1;
sleeping_timer[playerid] = SetTimerEx("Sleeping",60000,false,"i",playerid);
SendClientMessage(playerid, COLOR_YELLOW, "You are sleeping now");
} else return SendClientMessage(playerid, COLOR_ORANGE, "You must be in the middle of your cell in order to get into the sleep.");
} // added this.
if(PlayerInfo[playerid][pSleeping] == 1)
{
ClearAnimations(playerid);
PlayerInfo[playerid][pSleeping] = 0;
KillTimer(sleeping_timer[playerid]);
SendClientMessage(playerid, COLOR_YELLOW, "You have woke up.");
}
return 1;
}
