Raised This Month: $ Target: $400
 0% 

3rd Vision Mode


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 07-14-2018 , 20:59   3rd Vision Mode
Reply With Quote #1

I was searching a 3rd vision mode, I found this from Connor.

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <xs>

#define VERSION "0.0.2"

#define MAX_PLAYERS    32

#define USE_TOGGLE 3


#define CAMERA_FORWARD -75.0
#define CAMERA_RIGHT 20.0
#define CAMERA_UP 10.0
#define CAMERA_FRACTION -35.0

new g_iPlayerCamera[MAX_PLAYERS+1]

new 
g_iMaxPlayers

public plugin_init()
{
    
register_plugin("Camera View AUTOMATIC"VERSION"ConnorMcLeod")
    
    
RegisterHam(Ham_Spawn"player""CBasePlayer_Spawn_Post"1)
    
register_forward(FM_SetView"SetView")
    
RegisterHam(Ham_Think"trigger_camera""Camera_Think")
    
    
g_iMaxPlayers get_maxplayers()
}

public 
CBasePlayer_Spawn_Postid )
{
    if( !
is_user_alive(id) )
    {
        return
    }
    
    new 
iEnt g_iPlayerCamera[id]
    if( !
pev_valid(iEnt) )
    {
        static 
iszTriggerCamera
        
if( !iszTriggerCamera )
        {
            
iszTriggerCamera engfunc(EngFunc_AllocString"trigger_camera")
        }
        
iEnt engfunc(EngFunc_CreateNamedEntityiszTriggerCamera)
        
set_kvd(0KV_ClassName"trigger_camera")
        
set_kvd(0KV_fHandled0)
        
set_kvd(0KV_KeyName"wait")
        
set_kvd(0KV_Value"999999")
        
dllfunc(DLLFunc_KeyValueiEnt0)
        
        
set_pev(iEntpev_spawnflagsSF_CAMERA_PLAYER_TARGET|SF_CAMERA_PLAYER_POSITION)
        
set_pev(iEntpev_flagspev(iEntpev_flags) | FL_ALWAYSTHINK)
        
        
dllfunc(DLLFunc_SpawniEnt)
        
        
g_iPlayerCamera[id] = iEnt
        
//   }
        
        
new Float:flMaxSpeediFlags pev(idpev_flags)
        
pev(idpev_maxspeedflMaxSpeed)
        
        
ExecuteHam(Ham_UseiEntididUSE_TOGGLE1.0)
        
        
set_pev(idpev_flagsiFlags)
        
// depending on mod, you may have to send SetClientMaxspeed here.
        // engfunc(EngFunc_SetClientMaxspeed, id, flMaxSpeed)
        
set_pev(idpev_maxspeedflMaxSpeed)
    }
}

public 
SetView(idiEnt)
{
    if( 
is_user_alive(id) )
    {
        new 
iCamera g_iPlayerCamera[id]
        if( 
iCamera && iEnt != iCamera )
        {
            new 
szClassName[16]
            
pev(iEntpev_classnameszClassNamecharsmax(szClassName))
            if( !
equal(szClassName"trigger_camera") ) // should let real cams enabled
            
{
                
engfunc(EngFunc_SetViewidiCamera// shouldn't be always needed
                
return FMRES_SUPERCEDE
            
}
        }
    }
    return 
FMRES_IGNORED
}

public 
client_disconnect(id)
{
    new 
iEnt g_iPlayerCamera[id]
    if( 
pev_valid(iEnt) )
    {
        
engfunc(EngFunc_RemoveEntityiEnt)
    }
    
g_iPlayerCamera[id] = 0
}

public 
client_putinserver(id)
{
    
g_iPlayerCamera[id] = 0
}

public 
get_cam_owner(iEnt)
{
    static 
id
    
for(id 1id<=g_iMaxPlayersid++)
    {
        if( 
g_iPlayerCamera[id] == iEnt )
        {
            return 
id
        
}
    }
    return 
0
}

public 
Camera_ThinkiEnt )
{
    static 
id
    
if( !(id get_cam_owneriEnt )) )
    {
        return
    }
    
    static 
Float:fVecPlayerOrigin[3], Float:fVecCameraOrigin[3], Float:fVecAngles[3], 
    
Float:fVecForward[3], Float:fVecRight[3], Float:fVecUp[3]

    
pev(idpev_originfVecPlayerOrigin)
    
pev(idpev_view_ofsfVecAngles)
    
    
fVecPlayerOrigin[2] += fVecAngles[2]
    
pev(idpev_v_anglefVecAngles)
    
    
angle_vector(fVecAnglesANGLEVECTOR_FORWARDfVecForward)
    
angle_vector(fVecAnglesANGLEVECTOR_RIGHTfVecRight)
    
angle_vector(fVecAnglesANGLEVECTOR_UPfVecUp)
    
    
fVecCameraOrigin[0] = fVecPlayerOrigin[0] + fVecForward[0] * CAMERA_FORWARD fVecRight[0] * CAMERA_RIGHT fVecUp[0] * CAMERA_UP
    fVecCameraOrigin
[1] = fVecPlayerOrigin[1] + fVecForward[1] * CAMERA_FORWARD fVecRight[1] * CAMERA_RIGHT fVecUp[1] * CAMERA_UP
    fVecCameraOrigin
[2] = fVecPlayerOrigin[2] + fVecForward[2] * CAMERA_FORWARD fVecRight[2] * CAMERA_RIGHT fVecUp[2] * CAMERA_UP
    
    engfunc
(EngFunc_TraceLinefVecPlayerOriginfVecCameraOriginIGNORE_MONSTERSid0)
    static 
Float:flFraction
    get_tr2
(0TR_flFractionflFraction)
    if( 
flFraction != 1.0 // adjust camera place if close to a wall
    
{
        
flFraction *= CAMERA_FRACTION
        
        
//fVecCameraOrigin[0] = fVecPlayerOrigin[0] + fVecForward[0] * flFraction + fVecRight[0] * flFraction + fVecUp[0] * flFraction
        //fVecCameraOrigin[1] = fVecPlayerOrigin[1] + fVecForward[1] * flFraction + fVecRight[1] * flFraction + fVecUp[1] * flFraction
        //fVecCameraOrigin[2] = fVecPlayerOrigin[2] + fVecForward[2] * flFraction + fVecRight[2] * flFraction + fVecUp[2] * flFraction
        
        
fVecCameraOrigin[0] = fVecPlayerOrigin[0] + (fVecForward[0] * flFraction)
        
fVecCameraOrigin[1] = fVecPlayerOrigin[1] + (fVecForward[1] * flFraction)
        
fVecCameraOrigin[2] = fVecPlayerOrigin[2] + (fVecForward[2] * flFraction)
    }

    
set_pev(iEntpev_originfVecCameraOrigin)
    
set_pev(iEntpev_anglesfVecAngles)

The problem - http://prntscr.com/k6k5et

But as you guys can see on the picture, where the player shot isn't the same as the aim. So, is there a way to fix that? The difference changes depending where you're aiming at.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
Apb hq
Senior Member
Join Date: Apr 2014
Old 07-17-2018 , 05:54   Re: 3rd Vision Mode
Reply With Quote #2

Has anyone an idea how to fix this bug i need this plugin also?

Thanks in advance
Apb hq is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-17-2018 , 06:02   Re: 3rd Vision Mode
Reply With Quote #3

I am not sure but try fixing the player entity angles.

I'll do some tests latter.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 07-17-2018 at 06:04.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Apb hq
Senior Member
Join Date: Apr 2014
Old 07-29-2018 , 12:33   Re: 3rd Vision Mode
Reply With Quote #4

Quote:
Originally Posted by Natsheh View Post
I am not sure but try fixing the player entity angles.

I'll do some tests latter.
Did you try to fix this issue , thanks in advance
Apb hq is offline
Kalipso22
Junior Member
Join Date: Jul 2018
Location: Türkiye
Old 07-29-2018 , 13:42   Re: 3rd Vision Mode
Reply With Quote #5

PHP Code:
#include <amxmodx>
#include <engine>

#define PLUGIN    "3Rd view"
#define AUTHOR    "Ferrari & Sylvanor"
#define VERSION    "1.0"

#define MAX_PLAYERS 32

new g_pCamera

// pas besoin de taguer bool, fais comme tu veux cependant.
new g_bCameraMAX_PLAYERS ]

public 
plugin_precache() 
{      
    
precache_model"models/rpgrocket.mdl" ); 
}
public 
plugin_init()
{
    
// register_plugin ça peut pas faire de mal non plus

    
g_pCamera register_cvar("amx_3rdview""1")
    
register_clcmd("say /3pers""cmdCamera")
    
register_clcmd("say_team /3pers""cmdCamera")

}

public 
client_putinserverid )
{
    
g_bCameraid ] = false
}

public 
cmdCameraid )
{
    if( 
get_pcvar_numg_pCamera ) )
    {
        if( (
g_bCameraid ] = !g_bCameraid ]) )
        {
            
set_viewidCAMERA_3RDPERSON )
        }
        else
        {
            
set_viewidCAMERA_NONE );
        }
    }
    return 
PLUGIN_HANDLED // PLUGIN_CONTINUE ou même rien du tout si tu veux pouvoir voir la commande dans le tchat.

Can you try this ?
Kalipso22 is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 07-29-2018 , 13:57   Re: 3rd Vision Mode
Reply With Quote #6

No, set_view() is not what I want. Thank you anyway.

Exaplaining again:

With set_view() the aiment is bad, because the crosshair gets blocked by the player's model. So, with the code I gave, that won't happen. But, there's a problem, where I shot sometimes is not the same place that my crosshair is, I just wanna fix it.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
Apb hq
Senior Member
Join Date: Apr 2014
Old 08-02-2018 , 21:31   Re: 3rd Vision Mode
Reply With Quote #7

Quote:
Originally Posted by Natsheh View Post
I am not sure but try fixing the player entity angles.

I'll do some tests latter.
@Natsheh have you tried to fix this issue ?
Thanks in advance
Apb hq is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 08-02-2018 , 22:57   Re: 3rd Vision Mode
Reply With Quote #8

Quote:
Originally Posted by Apb hq View Post
@Natsheh have you tried to fix this issue ?
Thanks in advance
I have but its abit buggy ill try to find a better way.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 08-21-2018 , 13:47   Re: 3rd Vision Mode
Reply With Quote #9

Did someone find any solution?
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 10-25-2018 , 19:22   Re: 3rd Vision Mode
Reply With Quote #10

Any bless human?
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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