AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   make screen to 180 (https://forums.alliedmods.net/showthread.php?t=89005)

whosyourdaddy 03-31-2009 20:04

make screen to 180
 
how can i make a screen do like a 180 turn. like lets say there lookin foward and i want them to look the other way (there back)

Exolent[jNr] 03-31-2009 20:22

Re: make screen to 180
 
Change the player's angles.

whosyourdaddy 03-31-2009 21:03

Re: make screen to 180
 
how?

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(PLUGINVERSIONAUTHOR)
    
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 )
        
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(idlevelcid)
{
    if( !
cmd_access(idlevelcid2) )
        return 
PLUGIN_HANDLED

    
new szPlayer[32]
    
read_argv(1szPlayer31)

    new 
plr cmd_target(idszPlayer, (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(idpev_punchangleflPAngle)
    }



One 04-01-2009 13:34

Re: make screen to 180
 
Haha, can u attach a screen?`this sounds funny

ConnorMcLeod 04-01-2009 15:28

Re: make screen to 180
 
Try the code on yourself and you'll see.

One 04-01-2009 16:08

Re: make screen to 180
 
Quote:

Originally Posted by ConnorMcLeod (Post 794926)
Try the code on yourself and you'll see.

:cry::cry::cry::cry: no CS installed damn

whosyourdaddy 04-01-2009 16:09

Re: make screen to 180
 
hmmm the thing is that im usin this as a code for a skill like when i attack u and it gets triggered u will look the other way.. so heres an example

im lookin at u and i shoot u, if this function gets triggered then i want u to look away from me so ur back is turned to me... this is how the function is

Code:

tornado(iAttacker,iVictim)
{
//code to make u turn ur back from me
}

think u can help me out cause i cant get anything to work


All times are GMT -4. The time now is 02:27.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.