Event_DeathMsg if server
PHP Code:
|
Re: Event_DeathMsg if server
Add in register_event filter "1>0" so you won't collect when killer is 0
In callback, check killer against maxplayers value PHP Code:
|
Re: Event_DeathMsg if server
What if i use this?
PHP Code:
PHP Code:
|
Re: Event_DeathMsg if server
#define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )
we call it 预编译。 \(^o^)/ PreProcessor You can buy a book about C,then you'll konw these: #include #define #if、#else、#endif ...... Lexical preprocessors are the lowest-level of preprocessors, in so far as they only require lexical analysis, that is, they operate on the source text, prior to any parsing, by performing simple substitution of tokenized character sequences for other tokenized character sequences, according to user-defined rules. They typically perform macro substitution, textual inclusion of other files, and conditional compilation or inclusion. C preprocessor[edit] Main article: C preprocessor The most common example of this is the C preprocessor, which takes lines beginning with '#' as directives. Because it knows nothing about the underlying language, its use has been criticized and many of its features built directly into other languages. For example, macros replaced with aggressive inlining and templates, includes with compile-time imports (this requires the preservation of type information in the object code, making this feature impossible to retrofit into a language); conditional compilation is effectively accomplished with if-then-else and dead code elimination in some languages. |
Re: Event_DeathMsg if server
Code:
#define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )So, this function check if iKiller (id) is player and not something else (fall, world , etc). Than to write Code:
if( 1 <= iKiller <= g_iMaxPlayers )Code:
if( IsPlayer( iKiller ) )You understand :)? |
Re: Event_DeathMsg if server
Quote:
But, since we added filter 1>0 in register_event, we already know iKiller is >= 1, so we only need to check if iKiller <= g_iMaxPlayers |
Re: Event_DeathMsg if server
Ok i understand. Thanks guys.
|
| All times are GMT -4. The time now is 23:20. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.