Welcome To Our Forum
 
HomeFAQRegisterLog in

Share | 
 

 Tired system

Go down 
AuthorMessage
David_Armano
Donator
Donator
avatar

Posts : 62
Join date : 2011-10-10

PostSubject: Tired system   Tue Oct 25, 2011 6:42 pm

here i made some scripting i hope you like it
Code:

enum pInfo
{
    Sleeping,
    Awake,
    Tired
}
new Info[MAX_PLAYERS][pInfo];

SetTimer("Motels",5000,1);
SetTimer("SleepTime",300000,1);

public SleepTime()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
      SendClientMessage(i,COLOR_GREY,"* You are starting to feel sleep *");
        SendClientMessage(i,COLOR_GREY,"* Go to the nearest /hotel and get a rest *");
        Info[i] [Tired] = 1;
        Info[i] [Awake] = 0;
        Info[i] [Sleeping] = 0;
    }
}

public Motels()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
      if(IsPlayerInCube(i,2236,-1076,1040,2245,-1066,1100))
      {
        if(Info[i][Tired] == 1)
        {
                GameTextForPlayer(i,"~w~Please wait while your energy is ~b~restored",3000,3);
                Info[i] [Tired] = 0;
                Info[i] [Sleeping] = 1;
                Info[i] [Awake] = 0;
                TogglePlayerControllable(i,0);
        }
        if(Info[i] [Awake] == 1)
        {
                GameTextForPlayer(i,"~w~You ~g~don't ~w~need to rest",2000,3);
        }
        if(Info[i] [Sleeping] == 1)
        {
                Info[i] [Awake] = 1;
                Info[i] [Tired] = 0;
                Info[i] [Sleeping] = 0;
                GameTextForPlayer(i,"~w~Rise and Shine",2000,3);
                TogglePlayerControllable(i,1);
        }
      }
      if(IsPlayerInCube(i,2202,-1070,1000,2211,-1078,1100))
      {
        if(Info[i][Tired] == 1)
        {
                GameTextForPlayer(i,"~w~Please wait while your energy is ~b~restored",3000,3);
                Info[i] [Tired] = 0;
                Info[i] [Sleeping] = 1;
                Info[i] [Awake] = 0;
                TogglePlayerControllable(i,0);
        }
        if(Info[i] [Awake] == 1)
        {
                GameTextForPlayer(i,"~w~You ~g~don't ~w~need to rest",2000,3);
        }
        if(Info[i] [Sleeping] == 1)
        {
                Info[i] [Awake] = 1;
                Info[i] [Tired] = 0;
                Info[i] [Sleeping] = 0;
                GameTextForPlayer(i,"~w~Rise and Shine",2000,3);
                TogglePlayerControllable(i,1);
        }
      }
    }
  return 1;
}


Back to top Go down
 
Tired system
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Redemption Roleplay :: Development :: Suggestions-
Jump to: