| ConnorMcLeod |
04-01-2009 02:10 |
Re: make screen to 180
PHP Code:
/* Copyright © 2008, ConnorMcLeod
Migraine 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 Migraine; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <amxmodx> #include <amxmisc> #include <fakemeta>
#define PLUGIN "Migraine" #define AUTHOR "ConnorMcLeod" #define VERSION "0.0.1"
new bool:g_bReversed[33] new Float:g_flAngles[33][2] new Float:g_flCVars[33][2]
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_forward(FM_PlayerPreThink, "PlayerPreThink") register_clcmd("amx_reverse", "AdminCommand_Reverse", ADMIN_KICK) }
public client_putinserver(id) { g_bReversed[id] = false set_task(0.1, "Get_CVars", id) }
public Get_CVars(id) { query_client_cvar(id, "m_pitch", "ClientCvarResult") query_client_cvar(id, "m_yaw", "ClientCvarResult") }
public ClientCvarResult(id, const szCvar[], const szValue[]) { new Float:flValue = str_to_float(szValue)
if( flValue < 0 ) flValue = -flValue
switch( szCvar[2] ) { case 'p':g_flCVars[id][0] = flValue case 'y':g_flCVars[id][1] = flValue }
// Restore_ClientValues(id) // can't rememeber why i put this here }
public AdminCommand_Reverse(id, level, cid) { if( !cmd_access(id, level, cid, 2) ) return PLUGIN_HANDLED
new szPlayer[32] read_argv(1, szPlayer, 31)
new plr = cmd_target(id, szPlayer, (1<<1)|(1<<3)) if( !plr ) return PLUGIN_HANDLED
if( !g_bReversed[plr] ) { Inverse_ClientValues(plr) g_bReversed[plr] = true } else { Restore_ClientValues(plr) g_bReversed[plr] = false }
g_flAngles[plr][0] = 0.0 g_flAngles[plr][1] = 0.0
return PLUGIN_HANDLED }
Restore_ClientValues(id) { client_cmd(id, "m_pitch %f", g_flCVars[id][0]) client_cmd(id, "m_yaw %f", g_flCVars[id][1]) }
Inverse_ClientValues(id) { client_cmd(id, "m_pitch %f", -g_flCVars[id][0]) client_cmd(id, "m_yaw %f", -g_flCVars[id][1]) }
public PlayerPreThink(id) { if(is_user_alive(id) && g_bReversed[id]) { if( g_flAngles[id][1] < 180.0 ) { g_flAngles[id][1] += 2.0 g_flAngles[id][0] = g_flAngles[id][1] * 2.0 } else { g_flAngles[id][0] = 0.0 }
static Float:flPAngle[3] flPAngle[0] = g_flAngles[id][0] flPAngle[1] = g_flAngles[id][0] flPAngle[2] = g_flAngles[id][1] set_pev(id, pev_punchangle, flPAngle) } }
|