Help SLEEP script
#1

Hi guys,

I found this old Sleep script by GoKkuU

And thought i would try playing around with it....


the concept is a great idea, but the script was bad only in the way
it teleported you to an a motel for "sleep" then re spawned you.

What i want to do is make it so on sleep it plays the /crack animation and freezes you for 3 minutes.


Quote:

if(SleepLevel[playerid] != 0)
{
TogglePlayerControllable(playerid, 0);
TextDrawShowForPlayer(playerid, SleepScreanTD);
ApplyAnimation(playerid,"CRACK","crckdeth2",4.0, 1, 0, 0, 180000, 0);
SetPlayerCameraPos(playerid, 2231.8608,-1161.0271,1031.3776);
SetPlayerCameraLookAt(playerid,2228.0371,-1161.6714,1029.1803);
GameTextForPlayer(playerid, "~w~Sleeping....", 5000, 1);
Sleeping[playerid] = 1;
SetTimerEx("Sleep2", 12000, false, "i", playerid);
}

this doesn't really work, so can someone please correct it for me.

all i have done is remove the lines that teleport the player and re spawn again
Reply
#2

First off, you can use [ pawn ] [ /pawn ] tags to make it easier for us to read your code.
And what is the problem exactly?
Reply
#3

the problem is it is not doing what i want it to do
Reply
#4

Well what is it doing then? Does any of the code get activated at all, or what is it that's not working?
Reply
#5

yeh iv got it so if you /sleep a message comes up and then a few moments later it says you wake up feeling refreshed but the anim is not playing with the pause
Reply
#6

You can try using this:
pawn Код:
ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.1, 1, 0, 0, 0, 0, 1);
And then use ClearAnimations when waking up to remove the animation.
Reply
#7

Ok i am a step closer, but still no animation the code below work okay

you type /sleep

and the screen fades out then for 10 seconds you cant control. you then wake up feeling refreshed!

just no anim






Quote:

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/sleep", cmdtext, true, 10) == 0)
{
if(SleepLevel[playerid] != 0)
{
TogglePlayerControllable(playerid, 0);
TextDrawShowForPlayer(playerid, SleepScreanTD);
TogglePlayerControllable(playerid, 0);
ApplyAnimation(playerid,"CRACK","crckdeth2",4.0, 1, 0, 0, 0, 0);
GameTextForPlayer(playerid, "~w~Sleeping z Z z Z z Z", 5000, 180000);
Sleeping[playerid] = 1;
SetTimerEx("Sleep2", 10000, false, "i", playerid);
}
else
{
SendClientMessage(playerid, 0xFFFFFF, "{FF0000}[{FFFFFF}SleepSystem{FF0000}]{808080} You have no desire to sleep!");
return 1;
}
return 1;
}
return 0;




Quote:

}

public Sleep2(playerid)
{
TextDrawHideForPlayer(playerid, SleepScreanTD);
SleepLevel[playerid] = 0;
SetProgressBarValue(SleepBar[playerid], SleepLevel[playerid]);
UpdateProgressBar(SleepBar[playerid], playerid);
TogglePlayerControllable(playerid, 1);
Sleeping[playerid] = 0;
SendClientMessage(playerid, 0xFFFFFF, "{00FF00}[{FFFFFF}SleepSystem{00FF00}]{808080} You just woke up, Is like you are born again!");
return 1;
}

Reply
#8

Try adding this:
pawn Код:
PreloadAnimLib(playerid, animlib[]) ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    PreloadAnimLib(playerid,"BOMBER"); PreloadAnimLib(playerid,"RAPPING"); PreloadAnimLib(playerid,"SHOP");
    PreloadAnimLib(playerid,"BEACH"); PreloadAnimLib(playerid,"SMOKING"); PreloadAnimLib(playerid,"FOOD");
    PreloadAnimLib(playerid,"ON_LOOKERS"); PreloadAnimLib(playerid,"DEALER"); PreloadAnimLib(playerid,"CRACK");
    PreloadAnimLib(playerid,"CARRY"); PreloadAnimLib(playerid,"COP_AMBIENT"); PreloadAnimLib(playerid,"PARK");
    PreloadAnimLib(playerid,"INT_HOUSE"); PreloadAnimLib(playerid,"PED"); PreloadAnimLib(playerid,"MISC");
    PreloadAnimLib(playerid,"OTB"); PreloadAnimLib(playerid,"BD_Fire"); PreloadAnimLib(playerid,"BENCHPRESS");
    PreloadAnimLib(playerid,"KISSING"); PreloadAnimLib(playerid,"BSKTBALL"); PreloadAnimLib(playerid,"MEDIC");
    PreloadAnimLib(playerid,"SWORD"); PreloadAnimLib(playerid,"POLICE"); PreloadAnimLib(playerid,"SUNBATHE");
    PreloadAnimLib(playerid,"FAT"); PreloadAnimLib(playerid,"WUZI"); PreloadAnimLib(playerid,"SWEET");
    PreloadAnimLib(playerid,"ROB_BANK"); PreloadAnimLib(playerid,"GANGS"); PreloadAnimLib(playerid,"RIOT");
    PreloadAnimLib(playerid,"GYMNASIUM"); PreloadAnimLib(playerid,"CAR"); PreloadAnimLib(playerid,"CAR_CHAT");
    PreloadAnimLib(playerid,"GRAVEYARD"); PreloadAnimLib(playerid,"POOL");
    return 1;
}
To be honest, im not sure what it does really, but it's needed when using animations.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)