Actor Problem
#1

How to know if the Actor is having an animation will say "Actor is serving another person."
Example: Actor is a shoemaker.
- When Actor does not serve anyone else, I will interact with Actor and SetAnim for Actor.
- When the Actor is serving someone, when I interact with the Actor it will say "Actor is serving other people."
Reply
#2

You simply create a global variable as [MAX_ACTORS] and when you SetAnim for an actor, you set that variable for that actorid to true, or to 1. When the actor finishes serving someone, you set it back to false, or to 0. And when someone interacts with an actor, you check if that actorid's variable is false or true, 0 or 1. If it's false, then for example the actor is not busy, and allows the interaction. If it's 1 or true, then the actor is busy and send that message to him.
Reply
#3

Quote:
Originally Posted by Jaxium
View Post
You simply create a global variable as [MAX_ACTORS] and when you SetAnim for an actor, you set that variable for that actorid to true, or to 1. When the actor finishes serving someone, you set it back to false, or to 0. And when someone interacts with an actor, you check if that actorid's variable is false or true, 0 or 1. If it's false, then for example the actor is not busy, and allows the interaction. If it's 1 or true, then the actor is busy and send that message to him.
Can you give me some illustrative code ?
Reply
#4

He pretty much explained it anyway but I'll try. (Sorry for any typos I'm on tab.)
Code:
new actorbusy[MAX_ACTORS]; // at top of your script with other variables
CMD:shoemaker(playerid, params[])
{
    if(actorbusy[playerid] == 1) return SendClientMessage(playerid, -1, "Actor Is Busy.");
      // do your stuff here, applying anim and whatever. While doing that make sure to set this variable to 1
        actorbusy[playerid] = 1;

// When your actor finishes the job you can set it back to 0.
If someone wants to correct me please feel free to do so. I'm back after pretty long so I'm rusty
Reply
#5

Quote:
Originally Posted by Jaxium
View Post
You simply create a global variable as [MAX_ACTORS] and when you SetAnim for an actor, you set that variable for that actorid to true, or to 1. When the actor finishes serving someone, you set it back to false, or to 0. And when someone interacts with an actor, you check if that actorid's variable is false or true, 0 or 1. If it's false, then for example the actor is not busy, and allows the interaction. If it's 1 or true, then the actor is busy and send that message to him.
Quote:
Originally Posted by Ritzy
View Post
He pretty much explained it anyway but I'll try. (Sorry for any typos I'm on tab.)
Code:
new actorbusy[MAX_ACTORS]; // at top of your script with other variables
CMD:shoemaker(playerid, params[])
{
    if(actorbusy[playerid] == 1) return SendClientMessage(playerid, -1, "Actor Is Busy.");
      // do your stuff here, applying anim and whatever. While doing that make sure to set this variable to 1
        actorbusy[playerid] = 1;

// When your actor finishes the job you can set it back to 0.
If someone wants to correct me please feel free to do so. I'm back after pretty long so I'm rusty
Thank all, I have succeeded my system: D
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)