You can use velocity setting. For example,
PHP Code:
#include <amxmodx>
#include <fakemeta>
// Uncomment to use the controlled player's direction.
#define VELOCITY_BY_CONTROLLER
// I think? Adjust this.
#define RUN_SPEED 320
new gControlled[33]
public plugin_init()
{
register_plugin( "Controller Mod", "1.0", "Hawk552" )
register_clcmd( "control", "CmdControl" )
}
public CmdControl( id )
{
new args[33]
read_argv( 1, args, 32 )
gControlled[id] = get_user_index( args )
}
public client_PreThink( id )
{
if ( !is_user_alive( gControlled[id] ) )
return
new button = pev( id, pev_button )
static Float:velocity[3], Float:origin[3], Float:angle[3]
#if defined VELOCITY_BY_CONTROLLER
pev( id, pev_origin, origin )
pev( id, pev_v_angle, angle )
#else
pev( gControlled[id], pev_origin, origin )
pev( gControlled[id], pev_v_angle, angle )
#endif
if ( button & IN_FORWARD )
{
engfunc( EngFunc_MakeVectors, angle )
global_get( glb_v_forward, velocity )
velocity[0] = origin[0] - RUN_SPEED * velocity[0]
velocity[1] = origin[1] - RUN_SPEED * velocity[1]
velocity[2] = origin[2] - RUN_SPEED * velocity[2]
}
// Add more cases for the buttons...
set_pev( gControlled[id], pev_velocity, velocity )
}
public client_disconnect( id )
gControlled[id] = 0
You'll need way more checks and code.
__________________