Currently we can force player to sleep by setting player.Sleeping=true, ex in a timer based function to detect other players but I havent found any way to continue again. By modifying the exit condition of the while loop we can force player to sleep and wake it up again, both by modifying player.Sleeping.
Code: Select all
function CPlayer:sleep()
-- the bot will sleep but still fight back attackers
local sleep_start = os.time(); -- calculate the sleep time
self.Sleeping = true; -- we are sleeping
cprintf(cli.yellow, language[89], os.date(), getKeyName(getStartKey()) );
local hf_key = "";
while(self.Sleeping) do -- Originally "while(true) do"
local hf_key_pressed = false;
DX