AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [ Solved ] Optimization or not. (https://forums.alliedmods.net/showthread.php?t=186239)

Aooka 05-27-2012 09:53

[ Solved ] Optimization or not.
 
Hello :)
I do a code :

Code:
#include < amxmodx > public plugin_init( ) {     register_plugin( "Score information" , "1.0" , "Aooka" ); } public ScoreMsg( victim , attacker ) {     if( is_user_alive( attacker ) || !is_user_alive( attacker ) && !is_user_alive( victim ) )     {         new szPseudoVictim[ 32 ] , szPseudoAttacker[ 32 ];                 get_user_name( victim , szPseudoVictim , charsmax( szPseudoVictim ) );         get_user_name( attacker , szPseudoAttacker , charsmax( szPseudoAttacker ) );                 client_print( victim , print_center , "You were killed by %s" , szPseudoAttacker );         client_print( attacker , print_center , "You killed %s" , szPseudoVictim );     } }

I wanted to know if it was correct and well optimized. :D

Thanks^^

<VeCo> 05-27-2012 10:00

Re: [REQ] Optimization or not.
 
What is "ScoreMsg"?

Aooka 05-27-2012 10:01

Re: [REQ] Optimization or not.
 
It's just the name of my function. I did not know what to choose ^^ Why ?

Arkshine 05-27-2012 11:23

Re: [REQ] Optimization or not.
 
ScoreMsg comes from where ? You don't provide the full code.

Aooka 05-27-2012 11:33

Re: [REQ] Optimization or not.
 
No it's really the complete code. I assure you.
I took a random function name

Aooka 05-27-2012 19:33

Re: [REQ] Optimization or not.
 
So ... I just change the function name but ...
Code:
#include < amxmodx > public plugin_init( ) {     register_plugin( "Score information" , "1.0" , "Aooka" ); } public ScoreInfo( victim , attacker ) {     if( is_user_alive( attacker ) || !is_user_alive( attacker ) && !is_user_alive( victim ) )     {         new szPseudoVictim[ 32 ] , szPseudoAttacker[ 32 ];                 get_user_name( victim , szPseudoVictim , charsmax( szPseudoVictim ) );         get_user_name( attacker , szPseudoAttacker , charsmax( szPseudoAttacker ) );                 client_print( victim , print_center , "You were killed by %s" , szPseudoAttacker );         client_print( attacker , print_center , "You killed %s" , szPseudoVictim );     } }

hornet 05-27-2012 19:44

Re: [REQ] Optimization or not.
 
So what's the question here?

Your function needs to be executed to actually do something.

kramesa 05-27-2012 20:26

Re: [REQ] Optimization or not.
 
Post the full code man.

Edit: Well, try this:

Code:
#include < amxmodx > #include < csx > public client_death( attacker , victim ) {     new szPseudoVictim[ 32 ] , szPseudoAttacker[ 32 ];         get_user_name( victim , szPseudoVictim , charsmax( szPseudoVictim ) );     get_user_name( attacker , szPseudoAttacker , charsmax( szPseudoAttacker ) );         client_print( victim , print_center , "You were killed by %s" , szPseudoAttacker );     client_print( attacker , print_center , "You killed %s" , szPseudoVictim ); }

Kreation 05-27-2012 22:40

Re: [REQ] Optimization or not.
 
Quote:

Originally Posted by Aooka (Post 1717581)
No it's really the complete code. I assure you.
I took a random function name

It's the correct code, up until the function is called, because it's never called so it will never execute. Thus, it will never do anything.

Aooka 05-28-2012 04:37

Re: [REQ] Optimization or not.
 
I forgot my register_event ( lol ) :
Code:
#include < amxmodx > public plugin_init( ) {     register_plugin( "Score information" , "1.0" , "Aooka" );         register_event( "DeathMsg" , "HookDeath" , "d" ); } public HookDeath( victim , attacker ) {     if( is_user_alive( attacker ) || !is_user_alive( attacker ) && !is_user_alive( victim ) )     {         new szPseudoVictim[ 32 ] , szPseudoAttacker[ 32 ];                 get_user_name( victim , szPseudoVictim , charsmax( szPseudoVictim ) );         get_user_name( attacker , szPseudoAttacker , charsmax( szPseudoAttacker ) );                 client_print( victim , print_center , "You were killed by %s" , szPseudoAttacker );         client_print( attacker , print_center , "You killed %s" , szPseudoVictim );     } }

So I think the code is now good ( sorry ^^ ).

And I think it's the same with this code :
Code:
#include < amxmodx > #include < csx > public client_death( attacker , victim ) {     new szPseudoVictim[ 32 ] , szPseudoAttacker[ 32 ];         get_user_name( victim , szPseudoVictim , charsmax( szPseudoVictim ) );     get_user_name( attacker , szPseudoAttacker , charsmax( szPseudoAttacker ) );         client_print( victim , print_center , "You were killed by %s" , szPseudoAttacker );     client_print( attacker , print_center , "You killed %s" , szPseudoVictim ); }


All times are GMT -4. The time now is 21:39.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.