Veteran Member
Join Date: Jul 2006
Location: France (95)
|
02-05-2012
, 11:54
Re: [REQ] CS1.6 plugins based on Orpheu Module.
|
#4
|
2. Better to use fakemeta or engine.
PHP Code:
#include <amxmodx> #include <fakemeta_stocks>
#define VERSION "0.0.1" #define PLUGIN "Buy EveryWhere"
public plugin_init() { register_plugin(PLUGIN, VERSION, "ConnorMcLeod") }
public plugin_precache() { new ent = EF_CreateNamedEntity(EF_AllocString("func_buyzone")) DF_Spawn(ent) EF_SetSize(ent, Float:{-8192.0, -8192.0, -8192.0}, Float:{8192.0, 8192.0, 8192.0}) }
3.
PHP Code:
/* Formatright © 2010, ConnorMcLeod
This plugin is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this plugin; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
//#define AUTO_ENABLE_AXN
#include <amxmodx> #include <amxmisc> #include <orpheu> #include <orpheu_memory>
#define VERSION "0.0.1" #define PLUGIN ""
const OrpheuHook:OrpheuInvalidHook = OrpheuHook:0
new g_flJumpSlowDown, g_flBunnyJumpMaxSpeedFactor new OrpheuStruct:pmove new Float:g_flUseReduceSpeed
new bool:g_bIsCz
public plugin_init() { register_plugin(PLUGIN, VERSION, "ConnorMcLeod")
new szModName[7] get_modname(szModName, charsmax(szModName)) g_bIsCz = !!equal(szModName, "czero") #if defined AUTO_ENABLE_AXN SetJumpSlowDown( 0x00000000 ) // 0.0 SetBunnyJumpMaxSpeedFactor( 0x00000000 ) // 0.0 SetUseReduceSpeedFactor( 0.3 ) #endif
register_concmd("amx_set_jump_slowdown", "ConCmd_SetJumpSlowDown", ADMIN_CFG) register_concmd("amx_reset_jump_slowdown", "ConCmd_ResetJumpSlowDown", ADMIN_CFG)
register_concmd("amx_set_bj_maxspeed_factor", "ConCmd_SetBjMsFact", ADMIN_CFG) register_concmd("amx_reset_bj_maxspeed_factor", "ConCmd_ResetBjMsFact", ADMIN_CFG)
register_concmd("amx_set_use_reducespeed_factor", "ConCmd_SetUseRecuceFact", ADMIN_CFG) register_concmd("amx_reset_use_reducespeed_factor", "ConCmd_ResetUseRecuceFact", ADMIN_CFG) }
public ConCmd_SetJumpSlowDown(id, lvl, cid) { if( cmd_access(id, lvl, cid, 2) ) { new szValue[32] read_argv(1, szValue, charsmax(szValue)) SetJumpSlowDown( floatmax(0.0, str_to_float(szValue)) ) } return PLUGIN_HANDLED }
public ConCmd_ResetJumpSlowDown(id, lvl, cid) { if( cmd_access(id, lvl, cid, 0) ) { SetJumpSlowDown( 0x44A47943 ) } return PLUGIN_HANDLED }
public ConCmd_SetBjMsFact(id, lvl, cid) { if( cmd_access(id, lvl, cid, 2) ) { new szValue[32] read_argv(1, szValue, charsmax(szValue)) SetBunnyJumpMaxSpeedFactor( floatmax(0.0, str_to_float(szValue)) ) } return PLUGIN_HANDLED }
public ConCmd_ResetBjMsFact(id, lvl, cid) { if( cmd_access(id, lvl, cid, 0) ) { SetBunnyJumpMaxSpeedFactor( 0x3F99999A ) } return PLUGIN_HANDLED }
public ConCmd_SetUseRecuceFact(id, lvl, cid) { if( cmd_access(id, lvl, cid, 2) ) { new szValue[32] read_argv(1, szValue, charsmax(szValue)) SetUseReduceSpeedFactor( floatclamp(str_to_float(szValue), 0.0, 1.0) ) } return PLUGIN_HANDLED }
public ConCmd_ResetUseRecuceFact(id, lvl, cid) { if( cmd_access(id, lvl, cid, 0) ) { SetUseReduceSpeedFactor( 0.0 ) } return PLUGIN_HANDLED }
SetJumpSlowDown( {_,Float}:Value ) { server_print("Jump_SlowDown changed from %f to %f", OrpheuMemoryGet(g_bIsCz ? "Jump_SlowDown_CZ" : "Jump_SlowDown"), Value) OrpheuMemorySet(g_bIsCz ? "Jump_SlowDown_CZ" : "Jump_SlowDown", 1, Value) g_flJumpSlowDown = Value }
SetBunnyJumpMaxSpeedFactor( {_,Float}:Value ) { server_print("BUNNYJUMP_MAX_SPEED_FACTOR from %f to %f", OrpheuMemoryGet(g_bIsCz ? "BUNNYJUMP_MAX_SPEED_FACTOR_CZ" : "BUNNYJUMP_MAX_SPEED_FACTOR"), Value) OrpheuMemorySet(g_bIsCz ? "BUNNYJUMP_MAX_SPEED_FACTOR_CZ" : "BUNNYJUMP_MAX_SPEED_FACTOR", 1, Value) g_flBunnyJumpMaxSpeedFactor = Value }
SetUseReduceSpeedFactor( Float:flValue ) { static OrpheuFunction:oFnPM_Move = OrpheuInvalidFunction, OrpheuFunction:oFnPM_Duck = OrpheuInvalidFunction if( !oFnPM_Move || !oFnPM_Duck ) { oFnPM_Move = OrpheuGetFunction("PM_Move") oFnPM_Duck = OrpheuGetFunction("PM_Duck") }
static OrpheuHook:iOhPM_Move = OrpheuInvalidHook, OrpheuHook:iOhPM_Duck = OrpheuInvalidHook if( 0.0 < flValue < 1.0 ) { if( !iOhPM_Move ) { iOhPM_Move = OrpheuRegisterHook(oFnPM_Move, "OnPM_Move", OrpheuHookPre) } if( !iOhPM_Duck ) { iOhPM_Duck = OrpheuRegisterHook(OrpheuGetFunction("PM_Duck"), "OnPM_Duck_Post", OrpheuHookPost) } g_flUseReduceSpeed = flValue } else { if( iOhPM_Move ) { OrpheuUnregisterHook( iOhPM_Move ) iOhPM_Move = OrpheuInvalidHook } if( iOhPM_Duck ) { OrpheuUnregisterHook( iOhPM_Duck ) iOhPM_Duck = OrpheuInvalidHook } g_flUseReduceSpeed = 0.0 } }
public OnPM_Duck_Post() { const IN_USE = (1<<5)
if( OrpheuGetStructMember(OrpheuStruct:OrpheuGetStructMember( pmove, "cmd" ), "buttons" ) & IN_USE && OrpheuGetStructMember(pmove, "onground") != -1 ) { new Float:fVecVelocity[3] OrpheuGetStructMember(pmove, "velocity", fVecVelocity) fVecVelocity[0] *= g_flUseReduceSpeed fVecVelocity[1] *= g_flUseReduceSpeed fVecVelocity[2] *= g_flUseReduceSpeed OrpheuSetStructMember(pmove, "velocity", fVecVelocity) } }
public OnPM_Move( OrpheuStruct:ppmove /* , server */ ) { pmove = ppmove }
public plugin_unpause() { SetBunnyJumpMaxSpeedFactor( g_flJumpSlowDown ) // 0.0 SetJumpSlowDown( g_flBunnyJumpMaxSpeedFactor ) // 0.0 SetUseReduceSpeedFactor( g_flUseReduceSpeed ) }
public plugin_pause() { SetBunnyJumpMaxSpeedFactor( 0x3F99999A ) // 1.2 9A 99 99 3F SetJumpSlowDown( 0x44A47943 ) // 1315.7894287109375 SetUseReduceSpeedFactor( 0.0 ) }
public plugin_end() { SetBunnyJumpMaxSpeedFactor( 0x3F99999A ) // 1.2 SetJumpSlowDown( 0x44A47943 ) // 1315.7894287109375 }
__________________
Last edited by ConnorMcLeod; 02-05-2012 at 13:40.
|
|