[Include] actor_plus » Useful functions/callbacks for actors
#21

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

Код:
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.


Код:
IsActorPlayingAnimation(actorid);
Код:
ToggleActorAnimationLoop(actorid, bool:status);
reapply current animation with new loop status. good util.


TARGET AND TRIGGER ZONE

Код:
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);
Код:
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).


Код:
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 :

Код:
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 !
Reply
#22

@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
Посмотреть сообщение
Код:
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
Посмотреть сообщение
Код:
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).

Код:
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
Посмотреть сообщение
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
Посмотреть сообщение
Код:
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.
Reply
#23

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 код:
    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
Reply
#24

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.
Reply
#25

Код:
Pawn compiler 3.10.6                    Copyright © 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
Reply
#26

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 код:
    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_
Посмотреть сообщение
Код:
Pawn compiler 3.10.6                    Copyright © 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).
Reply
#27

Код:
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 © 1997-2006, ITB CompuPhase


7 Errors.
P.S: already updated my pawncc and .dll (...)
Reply
#28

instead update your includes?
Reply
#29

Quote:
Originally Posted by BiosMarcel
Посмотреть сообщение
instead update your includes?
Thanks!
Reply
#30

PHP код:
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.
Reply
#31

Quote:
Originally Posted by CantBeJohn
Посмотреть сообщение
PHP код:
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.
Thanks you!
Reply
#32

I get the following errors when trying to use this include:

Код:
C:\Pawno\include\actor.inc(153) : error 025: function heading differs from prototype
C:\Pawno\include\actor.inc(165) : error 025: function heading differs from prototype
C:\Pawno\include\actor.inc(169) : error 025: function heading differs from prototype
C:\Pawno\include\actor.inc(460) : error 004: function "OnActorDeath" is not implemented
C:\Pawno\include\actor.inc(763) : error 059: function argument may not have a default value (variable "isdynamic")
C:\Pawno\include\actor.inc(764) : error 021: symbol already defined: "RespawnActor"
C:\Pawno\include\actor.inc(997) : error 025: function heading differs from prototype
C:\Pawno\include\actor.inc(997) : error 025: function heading differs from prototype
C:\Pawno\include\actor.inc(1001) : error 021: symbol already defined: "Attach3DTextLabelToActor"
C:\Pawno\include\actor.inc(1040) : warning 213: tag mismatch: expected tag "Text3D", but found none ("_")
C:\Pawno\include\actor.inc(1070) : warning 213: tag mismatch: expected tag "Text3D", but found none ("_")
C:\Pawno\include\actor.inc(1079) : warning 213: tag mismatch: expected tag "Text3D", but found none ("_")
C:\Pawno\include\actor.inc(1232) : warning 213: tag mismatch: expected tag none ("_"), but found "Float"
C:\Pawno\include\actor.inc(1232) : error 017: undefined symbol "store_string"
C:\Pawno\include\actor.inc(1232) : warning 217: loose indentation
C:\Pawno\include\actor.inc(1232) : warning 215: expression has no effect
C:\Pawno\include\actor.inc(1232) : error 001: expected token: ";", but found ")"
C:\Pawno\include\actor.inc(1232) : error 029: invalid expression, assumed zero
C:\Pawno\include\actor.inc(1232) : fatal error 107: too many error messages on one line

Compilation aborted.

Pawn compiler 3.10.8	 	 	Copyright © 1997-2006, ITB CompuPhase


13 Errors.
[Finished in 1.8s]
Reply
#33

Quote:
Originally Posted by Mark009
Посмотреть сообщение
I get the following errors when trying to use this include:

Код:
C..
Compilation aborted.

Pawn compiler 3.10.8	 	 	Copyright © 1997-2006, ITB CompuPhase


13 Errors.
[Finished in 1.8s]
What's ur includes? Have you the latest versions of them all?
Reply
#34

You should update this include for the latest Streamer which changes it's tags.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)