SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 28/01/2018, 12:16 PM   #11
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Location: France
Posts: 1,769
Reputation: 230
Default Re: actor_plus Useful functions/callbacks for actors

Quote:
Originally Posted by Pottus View Post
I didn't realize you could do this.

Code:
enum _:E_TYPE_SEARCH(<<= 1)
{
	SEARCH_TYPE_DYNAMIC = 1,
	SEARCH_TYPE_STATIC,
	SEARCH_TYPE_ALL = SEARCH_TYPE_DYNAMIC | SEARCH_TYPE_STATIC
}
Code:
I was looking at a few things here and this doesn't make sense to me.

			if(type & SEARCH_TYPE_STATIC)
			{
				foreach(new i : Static_Actors)
				{
					if(!IsPlayerInRangeOfPoint(playerid, range, Static_Actors[i][eapPosX], Static_Actors[i][eapPosY], Static_Actors[i][eapPosZ]))
						continue;
					if(actorid != INVALID_ACTOR_ID)
						return MULTIPLE_TARGET_FOUND;
					actorid = i;
				}
			}
Why would you do that? That pretty much makes this function useless if there is two or more actors. It should at least have an optional parameter to do what you are doing otherwise update your code to find the closest actor and return it.
- What's the problem with SEARCH_TYPE_ALL ?
- That's right. I added a parameter which allow the player to return MULTIPLE_TARGET_FOUND or the first actor in range.
__________________
actor_plus - v4.1.2
I'm a goner, somebody catch my breath,
I'm a goner, somebody catch my breath
Dayrion is offline   Reply With Quote
Old 31/01/2018, 12:40 PM   #12
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Location: France
Posts: 1,769
Reputation: 230
Default Re: actor_plus Useful functions/callbacks for actors

Update! actor_plus - beta v1.2.0 to beta v3.0.1
  • Major code restructurations [removing/adding code in v2.0.0 and v3.0.0]
  • Added per-players functions (Pawn RakNet dependency)
  • Added callbacks
  • A lot of bug fix
  • Updated documentation
Please, check the documentation (README.md) if you have any doubt or you want to know what was updated. Every propositions are welcome.
Thanks to @Jelly23 and @Y_Less for the provided help! 😄
__________________
actor_plus - v4.1.2
I'm a goner, somebody catch my breath,
I'm a goner, somebody catch my breath
Dayrion is offline   Reply With Quote
Old 31/01/2018, 09:51 PM   #13
Pottus
Godfather
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 5,373
Reputation: 1208
Default Re: actor_plus Useful functions/callbacks for actors

Quote:
Originally Posted by Dayrion View Post
- What's the problem with SEARCH_TYPE_ALL ?
- That's right. I added a parameter which allow the player to return MULTIPLE_TARGET_FOUND or the first actor in range.
It just seems to me you are trying to return too many possibilities in one function. That kind of information would be better with checking if any actors are actually in range. There is no need for MULTIPLE_TARGET_FOUND it doesn't make sense when the truth is you are simply lacking a fundamental function.

Code:
GetActorCountForPlayer();
The first actor is not always the closest actor which breaks the naming of your function.
Pottus is offline   Reply With Quote
Old 01/02/2018, 09:07 PM   #14
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Location: France
Posts: 1,769
Reputation: 230
Default Re: actor_plus Useful functions/callbacks for actors

Quote:
Originally Posted by Pottus View Post
It just seems to me you are trying to return too many possibilities in one function. That kind of information would be better with checking if any actors are actually in range. There is no need for MULTIPLE_TARGET_FOUND it doesn't make sense when the truth is you are simply lacking a fundamental function.

Code:
GetActorCountForPlayer();
The first actor is not always the closest actor which breaks the naming of your function.
Well, that's why parameters are optional. I changed both functions by removing the range and changing its operation (the point where you was right ; my function has nothing to do with range). What do you think about it?
PHP Code:
native GetNearestActorForPlayer(playerid, &bool:isdynamic falsetype SEARCH_TYPE_ALLbool:return_multiple_target false);
native GetNearestActorByCoord(Float:xFloat:yFloat:z, &bool:isdynamic falsetype SEARCH_TYPE_ALLbool:return_multiple_target false); 
__________________
actor_plus - v4.1.2
I'm a goner, somebody catch my breath,
I'm a goner, somebody catch my breath
Dayrion is offline   Reply With Quote
Old 02/02/2018, 12:24 AM   #15
Pottus
Godfather
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 5,373
Reputation: 1208
Default Re: actor_plus Useful functions/callbacks for actors

Looks more sensible now.
Pottus is offline   Reply With Quote
Old 02/02/2018, 12:33 AM   #16
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Location: France
Posts: 1,769
Reputation: 230
Default Re: actor_plus Useful functions/callbacks for actors

Updating to 3.1.0

+ Added callbacks (OnPlayerTextNearActor - OnActorVirtualWorldChange - OnDynamicActorInteriorChange)
+ Major structuration code change
+ GetNearestActorForPlayer & GetNearestActorByCoord modifications
- Removing codes/comments

Include available here: https://github.com/Dayrion/actor_plu...actor_plus.inc
__________________
actor_plus - v4.1.2
I'm a goner, somebody catch my breath,
I'm a goner, somebody catch my breath

Last edited by Dayrion; 02/02/2018 at 06:19 PM.
Dayrion is offline   Reply With Quote
Old 02/02/2018, 12:47 AM   #17
Pottus
Godfather
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 5,373
Reputation: 1208
Default Re: actor_plus Useful functions/callbacks for actors

OnActorVirtualWorldChange - OnDynamicActorInteriorChange

These callbacks seem a bit redundant because it is known when these functions are actually are used it would be silly to need to use a callback. What you should do is use CallRemoteFunction() instead so that other scripts are aware of the change.

Over all this is a 100 percent solid system.

Last edited by Pottus; 02/02/2018 at 01:20 AM.
Pottus is offline   Reply With Quote
Old 02/02/2018, 06:17 PM   #18
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Location: France
Posts: 1,769
Reputation: 230
Default Re: actor_plus Useful functions/callbacks for actors

Quote:
Originally Posted by Pottus View Post
OnActorVirtualWorldChange - OnDynamicActorInteriorChange

These callbacks seem a bit redundant because it is known when these functions are actually are used it would be silly to need to use a callback. What you should do is use CallRemoteFunction() instead so that other scripts are aware of the change.

Over all this is a 100 percent solid system.
I knew it is redundant but who knows, someone can have a good idea ad make a good usage of this. Anyway, the CallRemoteFunction is a better idea which make this usefull.

Thanks you for your precious contribitious!
__________________
actor_plus - v4.1.2
I'm a goner, somebody catch my breath,
I'm a goner, somebody catch my breath
Dayrion is offline   Reply With Quote
Old 06/02/2018, 03:35 PM   #19
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Location: France
Posts: 1,769
Reputation: 230
Default Re: actor_plus Useful functions/callbacks for actors

Version 3.3.0 realesed. This is the first stable version. Any useful comments are still appreciated.
- https://github.com/Dayrion/actor_plu...actor_plus.inc

Quote:
Originally Posted by Spmn View Post
https://github.com/Dayrion/actor_plu...r_plus.inc#L24
this will trigger an error while compiling with default pawncc since #warning is a zeex compiler directive
The basic compiler is supported in this version. Thanks for your bug report.
__________________
actor_plus - v4.1.2
I'm a goner, somebody catch my breath,
I'm a goner, somebody catch my breath
Dayrion is offline   Reply With Quote
Old 06/02/2018, 10:58 PM   #20
Pottus
Godfather
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 5,373
Reputation: 1208
Default Re: actor_plus Useful functions/callbacks for actors

I have an excellent suggestion. Now that you have created this system you should create an actor builder filterscript using your own include as a base. This will lead to further development of not only a complementary filterscript but I am sure you will find new functions to aid in the development of a tool.
Pottus 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
[Tutorial] How to hook Functions and Callbacks. Lordzy Tutorials 22 11/11/2017 09:57 PM
[Include] [INC]Area functions and callbacks. Backwardsman97 Includes 8 04/11/2011 07:09 AM
[Tutorial] How to hook FUNCTIONS (not callbacks) Luka P. Tutorials 19 13/06/2011 05:35 PM
Useful Functions and Callbacks Re-release Larcius Filterscripts 12 24/06/2010 03:34 PM


All times are GMT. The time now is 05:53 AM.


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