|
AMX Mod X Plugin Approver
|
10-02-2011
, 13:03
Re: Grenade explosion ( TIME ) v1.1
|
#16
|
The code seems correct.
To be approved : - The offset names have names. It would be appropriate to enforce a name, so it will be more readable and people would know what does the offset. Something like (of course use your own style) :
PHP Code:
stock fm_cs_get_grenade_type( const index, const bool:checkClassName = false ) { static const grenadeClassName[] = "grenade"; static className[ sizeof grenadeClassName ]; if( checkClassName ) { pev( index, pev_classname, className, charsmax( className ) ); if( !equal( className, grenadeClassName ) ) { return 0; } } const m_fBombStatus = 96; const m_usEvent = 114; const flagBombPlanted = 1<<8; const flagExploEvent = 1<<0; const flagSmokeEvent = 1<<1; if( get_pdata_int( index, m_fBombStatus ) & flagBombPlanted ) { return 0; } new bits = get_pdata_int( index, m_usEvent ); if ( bits & flagExploEvent ) { return HE; } else if( bits & flagSmokeEvent ) { return SK; } else if( !bits ) { return FL; }
return 0; }
- !get_pcvar_float( pCvar_Time[ SK ] ) , it would be more appropriate when you deal with float : <= 0.0
Extra notes (which is not required to be approved, I strongly recommend you do it) :
- I don't like much you cast an enum instead of learning to deal properly with the tag, which is easy. If you don't know, tell me.
- You should consider to not hook the forward Ham_Think if the cvar is <= 0. Something you can do dynamically actually. You could use Cvar Utilities module, then depending the value of cvars, registering or unregistering the forwards. Also, something you can do when plugin is pause/unpause. Unapproved for now. (Section needs to be cleaned up!)
__________________
Last edited by Arkshine; 10-05-2011 at 06:44.
|
|
|
|