SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 11/02/2018, 08:20 PM   #21
Giacky
Little Clucker
 
Giacky's Avatar
 
Join Date: Jul 2015
Location: France
Posts: 11
Reputation: 54
Default Re: actor_plus Useful functions/callbacks for actors

It seems to be a good suggestion, a pottus-like script named actor studio.

I read your code it looks robust. some new functions:



ANIM

Code:
GetActorAnimation(actorid, animlib[], animname[], maxanimlib = sizeof animlib, maxanimname = sizeof animname);
GetActorAnimationEx(actorid, animlib[], animname[], &Float:fdelta, &loop, &lockx, &locky, &freeze, &time, maxanimlib = sizeof animlib, maxanimname = sizeof animname);
doesnt exists in samp actor library, just for dynamic actors from incognito streamer. You already store these informations, let people get access to them.


Code:
IsActorPlayingAnimation(actorid);

Code:
ToggleActorAnimationLoop(actorid, bool:status);
reapply current animation with new loop status. good util.


TARGET AND TRIGGER ZONE

Code:
OnPlayerStopTargetActor(playerid, actorid, weaponid);
// #define DONT_DETECT_OPTA can be defined if you won't detect use any timer for OnPlayerTargetActor(playerid, actorid, weaponid); & OnPlayerStopTargetActor(playerid, actorid, weaponid);

Code:
SetActorArea(actorid, range=ACTOR_MAX_TRIGGER_AREA);
how it works internally : maybe creating a dynamic area linked to actor. type cylindric, max range 8.
no trigger zone when actor created.
if range 0.0, no trigger zone (destroy area if exists).


Code:
GetActorAreaState(actorid, &bool:state);


OnPlayerEnterActorArea(playerid, actorid);
OnPlayerExitActorArea(playerid, actorid);

PlayActorSoundForPlayer(actorid, soundid, duration=0.0);
sound played at actor pos.
if playerpos > range of 20, no sound played.
duration: duration before stopsound (some soundid are looped)


samp-fixes.inc fixes two bugs for actor animations :

Code:
ApplyActorAnimation 	:
- Passing an invalid animation library in ApplyAnimation causes a client crash for streamed in players. 	
FIX: Block ApplyActorAnimation when an invalid library is passed.
-First time a library is used, it does nothing. 	
FIX:Apply animations twice when first using a library.
If you did fixe them yourself, check if samp-fixes is not defined to be sure to not apply same fixes twice.

Good work dude !
Giacky is offline   Reply With Quote
Old 13/02/2018, 03:38 AM   #22
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Location: France
Posts: 1,915
Reputation: 256
Default Re: actor_plus Useful functions/callbacks for actors

@Pottus ; That's a great idea (again). I will think about it.
@Giacky ;
Hey, thanks for giving a lot of suggestions but I have few questions:
Quote:
Originally Posted by Giacky View Post
Code:
ToggleActorAnimationLoop(actorid, bool:status);
reapply current animation with new loop status. good util.
Can you explain further your idea about this?


Quote:
Originally Posted by Giacky View Post
Code:
SetActorArea(actorid, range=ACTOR_MAX_TRIGGER_AREA);
how it works internally : maybe creating a dynamic area linked to actor. type cylindric, max range 8.
no trigger zone when actor created.
if range 0.0, no trigger zone (destroy area if exists).

Code:
GetActorAreaState(actorid, &bool:state);
OnPlayerEnterActorArea(playerid, actorid);
OnPlayerExitActorArea(playerid, actorid);
That one too, I don't understand at all what do you mean.


Quote:
Originally Posted by Giacky View Post
PlayActorSoundForPlayer(actorid, soundid, duration=0.0);[/CODE]
sound played at actor pos.
if playerpos > range of 20, no sound played.
duration: duration before stopsound (some soundid are looped)
What I actually made is a sound can be played near (depends of codes) an actor's positions.


Quote:
Originally Posted by Giacky View Post
Code:
ApplyActorAnimation 	:
- Passing an invalid animation library in ApplyAnimation causes a client crash for streamed in players. 	
FIX: Block ApplyActorAnimation when an invalid library is passed.
-First time a library is used, it does nothing. 	
FIX:Apply animations twice when first using a library.
If you did fixe them yourself, check if samp-fixes is not defined to be sure to not apply same fixes twice.
- I will add an option to fix this bug/avoiding crash when invalid animation library is provided.
- That's not an actor related issue. Before stream-in an actor, you need to apply the animation on the player. This issue is exactly the same as ApplyAnimation.
__________________
actor_plus - v5.0.2
I'm a goner, somebody catch my breath,
I'm a goner, somebody catch my breath
Dayrion is offline   Reply With Quote
Old 15/02/2018, 11:41 PM   #23
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Location: France
Posts: 1,915
Reputation: 256
Default Re: actor_plus Useful functions/callbacks for actors

Bug fix, majors changements - 4.1.2


A lot of improvement has been made here. Here is a non-exhaustive list list of what changed.
  • You can use the iterator Dynamic_Actor for looping through dynamic actors (require y_iterate)
  • Major fix on label (and associate things) + Now colors on name and text are separated (see functions below)
  • Removed internal dynamics actors id
  • Fixed bugs on player flags
  • Fixed a bug where actors where shot even if a player miss his shot
  • A lot of other fixs (majors & minors)
  • Added callback: `OnPlayerStopTargetActor`
  • Added functions:

    PHP Code:
    native DestroyAllDynamicActors(serverwide);
    native CountDynamicActors(serverwide);
    native UpdateDynamicActorForPlayer(playerid);
    native CountStreamedActorForPlayer(playeridserverwide);
    native STREAMER_TAG_AREA GetDynamicActorArea(actorid);
    native SetDynamicActorArea(actoridSTREAMER_TAG_AREA areaid);
    native GetDynamicActorPriority(actorid);
    native SetDynamicActorPriority(actoridpriority);
    native GetInternalActorIdForPlayer(forplayeridactorid); // renamed from GetRealActorID
    native ActorPlaySound(actoridsoundidFloat:xFloat:yFloat:zFloat:max_rangebool:isdynamic DEFAULT_IS_DYNAMIC_PARAMETER);
    native IsPlayerAimingActor(playeridactorid); 

Source code: https://github.com/Dayrion/actor_plu...actor_plus.inc
Documentation: https://github.com/Dayrion/actor_plu...ster/README.md
__________________
actor_plus - v5.0.2
I'm a goner, somebody catch my breath,
I'm a goner, somebody catch my breath
Dayrion is offline   Reply With Quote
Old 28/03/2018, 02:04 PM   #24
CantBeJohn
Big Clucker
 
CantBeJohn's Avatar
 
Join Date: Oct 2016
Posts: 71
Reputation: 15
Default Re: actor_plus Useful functions/callbacks for actors

Looks good, although I’m still waiting for the function to set a dynamic actor’s facing angle for a specific player. Otherwise, it renders setting an actor’s position for a player useless if he’s got to be facing a different way than the global facing angle.
CantBeJohn is offline   Reply With Quote
Old 29/04/2018, 02:31 AM   #25
Dice_
Huge Clucker
 
Dice_'s Avatar
 
Join Date: Sep 2015
Location: Indonesia
Posts: 489
Reputation: 56
Default Re: actor_plus Useful functions/callbacks for actors

Code:
Pawn compiler 3.10.6                    Copyright (c) 1997-2006, ITB CompuPhase

pawno\include\actor_plus.inc(422) : warning 213: tag mismatch
pawno\include\actor_plus.inc(424) : warning 213: tag mismatch
pawno\include\actor_plus.inc(609) : warning 213: tag mismatch
pawno\include\actor_plus.inc(617) : warning 213: tag mismatch
pawno\include\actor_plus.inc(618) : warning 213: tag mismatch
pawno\include\actor_plus.inc(619) : warning 213: tag mismatch
pawno\include\actor_plus.inc(620) : warning 213: tag mismatch
pawno\include\actor_plus.inc(621) : warning 213: tag mismatch
pawno\include\actor_plus.inc(973) : warning 213: tag mismatch
pawno\include\actor_plus.inc(974) : warning 213: tag mismatch
pawno\include\actor_plus.inc(1001 -- 1004) : warning 213: tag mismatch
pawno\include\actor_plus.inc(1001 -- 1004) : warning 213: tag mismatch
pawno\include\actor_plus.inc(1192) : warning 213: tag mismatch
pawno\include\actor_plus.inc(1193) : warning 213: tag mismatch
pawno\include\actor_plus.inc(2218) : warning 213: tag mismatch
Header size:          71704 bytes
Code size:          3527696 bytes
Data size:         28946136 bytes
Stack/heap size:   17039360 bytes; estimated max. usage=4039 cells (16156 bytes)
Total requirements:49584896 bytes
Also,is this include really that big? my .amx file before I use this was 4~mb and it went up to 9~mb after I used this include
__________________
Dice_ is offline   Reply With Quote
Old 28/06/2018, 01:29 AM   #26
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Location: France
Posts: 1,915
Reputation: 256
Default Re: actor_plus Useful functions/callbacks for actors

actor_plus - 5.0.0

  • Added some usefull functions
  • All callbacks can be hooked (except `OnPlayerMakeDamageToActor`)
  • Fixed some mistakes
  • Huge changements for OnPlayerStopTargetActor & OnPlayerTargetActor
  • Integration of 'angle' for SetActorPosForPlayer
    PHP Code:
    native CountStaticActors();
    native GetActorSpawnInfo(actorid, &skinid, &Float:fX, &Float:fY, &Float:fZ, &Float:fAnglebool:isdynamic DEFAULT_IS_DYNAMIC_PARAMETER);
    native GetActorAnimationName(actoridanimlib[], size_animlib sizeof(animlib), animname[], size_animname sizeof(animname)); // Static actors only
    native GetActorAnimation(actoridanimlib[], size_animlib sizeof(animlib), animname[], size_animname sizeof(animname), &Float:fDelta, &loop, &lockx, &locky, &freeze, &time); // Static actors only
    native ToggleActorAnimationLoop(actoridbool:toggle); // Static actors only
    native bool:IsActorPlayingAnimation(actoridbool:isdynamic DEFAULT_IS_DYNAMIC_PARAMETER);

    native CountAllActors();
    native SetActorPosForPlayer(forplayeridactoridfake_position_typeFloat:xFloat:yFloat:zFloat:anglebool:isdynamic DEFAULT_IS_DYNAMIC_PARAMETER); 

Source code: https://github.com/Dayrion/actor_plu...actor_plus.inc
Documentation: https://github.com/Dayrion/actor_plu...ster/README.md



Quote:
Originally Posted by Dice_ View Post
Code:
Pawn compiler 3.10.6                    Copyright (c) 1997-2006, ITB CompuPhase

pawno\include\actor_plus.inc(422) : warning 213: tag mismatch
pawno\include\actor_plus.inc(424) : warning 213: tag mismatch
pawno\include\actor_plus.inc(609) : warning 213: tag mismatch
pawno\include\actor_plus.inc(617) : warning 213: tag mismatch
pawno\include\actor_plus.inc(618) : warning 213: tag mismatch
pawno\include\actor_plus.inc(619) : warning 213: tag mismatch
pawno\include\actor_plus.inc(620) : warning 213: tag mismatch
pawno\include\actor_plus.inc(621) : warning 213: tag mismatch
pawno\include\actor_plus.inc(973) : warning 213: tag mismatch
pawno\include\actor_plus.inc(974) : warning 213: tag mismatch
pawno\include\actor_plus.inc(1001 -- 1004) : warning 213: tag mismatch
pawno\include\actor_plus.inc(1001 -- 1004) : warning 213: tag mismatch
pawno\include\actor_plus.inc(1192) : warning 213: tag mismatch
pawno\include\actor_plus.inc(1193) : warning 213: tag mismatch
pawno\include\actor_plus.inc(2218) : warning 213: tag mismatch
Header size:          71704 bytes
Code size:          3527696 bytes
Data size:         28946136 bytes
Stack/heap size:   17039360 bytes; estimated max. usage=4039 cells (16156 bytes)
Total requirements:49584896 bytes
Also,is this include really that big? my .amx file before I use this was 4~mb and it went up to 9~mb after I used this include
Is it still relevant ?
Yes, that include is using a lot of 3D/4D arrays because of the difference between static and dynamic actors. A plugin with this code should be better but I know nothing in C/C++ (or at least, no enough to write a plugin).
__________________
actor_plus - v5.0.2
I'm a goner, somebody catch my breath,
I'm a goner, somebody catch my breath
Dayrion is offline   Reply With Quote
Old 19/08/2018, 03:39 PM   #27
Alteh
Little Clucker
 
Alteh's Avatar
 
Join Date: Aug 2018
Posts: 23
Reputation: 3
Default Re: actor_plus Useful functions/callbacks for actors

Code:
actor_plus.inc(1657) : warning 203: symbol is never used: "isdynamic"
actor_plus.inc(1795) : error 021: symbol already defined: "GetActorAnimation"
actor_plus.inc(1797) : error 010: invalid function or declaration
actor_plus.inc(1798) : error 010: invalid function or declaration
actor_plus.inc(1800) : error 010: invalid function or declaration
actor_plus.inc(1801) : error 010: invalid function or declaration
actor_plus.inc(1803) : error 021: symbol already defined: "strcat"
actor_plus.inc(1811) : error 010: invalid function or declaration
Pawn compiler 3.10.8	 	 	Copyright (c) 1997-2006, ITB CompuPhase


7 Errors.
P.S: already updated my pawncc and .dll (...)
Alteh is offline   Reply With Quote
Old 19/08/2018, 03:44 PM   #28
BiosMarcel
High-roller
 
BiosMarcel's Avatar
 
Join Date: Jul 2012
Location: Germany
Posts: 1,230
Reputation: 225
Default Re: actor_plus Useful functions/callbacks for actors

instead update your includes?
BiosMarcel is offline   Reply With Quote
Old 19/08/2018, 03:56 PM   #29
Alteh
Little Clucker
 
Alteh's Avatar
 
Join Date: Aug 2018
Posts: 23
Reputation: 3
Default Re: actor_plus Useful functions/callbacks for actors

Quote:
Originally Posted by BiosMarcel View Post
instead update your includes?
Thanks!

Last edited by Alteh; 20/08/2018 at 07:52 PM.
Alteh is offline   Reply With Quote
Old 30/08/2018, 04:54 AM   #30
CantBeJohn
Big Clucker
 
CantBeJohn's Avatar
 
Join Date: Oct 2016
Posts: 71
Reputation: 15
Default Re: actor_plus Useful functions/callbacks for actors

PHP Code:
CountAllActors();
CountStaticActors(); 
Both these functions try getting information from an Iterator that doesn't exist (Static_Actor) and result in an error when they're used.
CantBeJohn 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 12:15 AM.


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