SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 15/11/2017, 03:02 AM   #1
hoanduy
Big Clucker
 
Join Date: Oct 2016
Posts: 83
Reputation: 0
Post Actor Problem

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."
hoanduy is offline   Reply With Quote
Old 15/11/2017, 03:21 AM   #2
Jaxium
Little Clucker
 
Join Date: Nov 2017
Location: Egypt
Posts: 11
Reputation: 1
Default Re: Actor Problem

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.
Jaxium is offline   Reply With Quote
Old 15/11/2017, 03:29 AM   #3
hoanduy
Big Clucker
 
Join Date: Oct 2016
Posts: 83
Reputation: 0
Post Re: Actor Problem

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 ?
hoanduy is offline   Reply With Quote
Old 15/11/2017, 05:07 AM   #4
Ritzy2K
High-roller
 
Ritzy2K's Avatar
 
Join Date: Jun 2014
Location: India
Posts: 1,547
Reputation: 170
Default Re: Actor Problem

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
Ritzy2K is offline   Reply With Quote
Old 15/11/2017, 10:46 AM   #5
hoanduy
Big Clucker
 
Join Date: Oct 2016
Posts: 83
Reputation: 0
Wink Re: Actor Problem

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
hoanduy is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to stop actor's animation after the Player stops targetting actor? humayunaftabkhan02 Scripting Help 0 05/05/2016 08:12 PM
Actor Problem #2 eikzdej Scripting Help 4 29/03/2016 03:24 PM
Actor Problem eikzdej Scripting Help 3 28/03/2016 04:00 PM
Actor problem Sanady Scripting Help 10 14/01/2016 03:32 AM
actor problem Karolukas123 Scripting Help 6 07/07/2015 07:29 PM


All times are GMT. The time now is 12:53 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.