Raised This Month: $51 Target: $400
 12% 

Projectile Camera


Post New Thread Reply   
 
Thread Tools Display Modes
daren adler
Member
Join Date: Aug 2017
Location: Iowa
Old 07-24-2022 , 20:17   Re: Projectile Camera
Reply With Quote #11

Quote:
Originally Posted by Sreaper View Post
Are you using the latest stable Sourcemod version and did you compile with the latest build as well?
no, i did not. i still have the 1 before this update, and yes i tryed to compile it on web on sourcemod compiler.
i will add the newer version and try again. ty
__________________
GuitarSlayer

Last edited by daren adler; 07-24-2022 at 20:19.
daren adler is offline
Send a message via MSN to daren adler
Sreaper
髪を用心
Join Date: Nov 2009
Old 07-24-2022 , 20:19   Re: Projectile Camera
Reply With Quote #12

Quote:
Originally Posted by daren adler View Post
no, i did not. i still have the 1 before this update, and yes i tryed to compile it on web on sourcemod compiler.
The web compiler is likely newer than what your server is running. I would recommending to either upgrade or use the compiler on your server.
Sreaper is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 07-24-2022 , 20:36   Re: Projectile Camera
Reply With Quote #13

Your demo shows some projectiles ( nade-like projectiles ) spin your screen.

I think the best solution is making an invisible entity, parent it to the original, and force its angles to be straight. Then SetClientViewEntity on the invisible entity.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334

Last edited by eyal282; 07-24-2022 at 20:36.
eyal282 is offline
daren adler
Member
Join Date: Aug 2017
Location: Iowa
Old 07-24-2022 , 20:41   Re: Projectile Camera
Reply With Quote #14

Quote:
Originally Posted by Sreaper View Post
The web compiler is likely newer than what your server is running. I would recommending to either upgrade or use the compiler on your server.
Thank you sooo much,,yes all i had to do was update my sm,,very kool......
__________________
GuitarSlayer
daren adler is offline
Send a message via MSN to daren adler
bigborther
Member
Join Date: Feb 2014
Location: china
Old 02-12-2023 , 05:11   Re: Projectile Camera
Reply With Quote #15

fix view rotate issue. REF: https://forums.alliedmods.net/showpo...4&postcount=53

Code:
void setClientToProjectileiew(int client) {
    int ent = EntRefToEntIndex(observedEntRef[client]);
    static float ClientAngles[3];
    if(IsValidEntity(ent)){
        GetClientEyeAngles(client, ClientAngles);
        PrintToConsole(client, "ClientAngles[0]=%f, ClientAngles[1]=%f, ClientAngles[2]=%f",
        ClientAngles[0], ClientAngles[1], ClientAngles[2]);
        TeleportEntity(ent, NULL_VECTOR, ClientAngles, NULL_VECTOR);
        SetClientViewEntity(client, ent);
    } else {
        setClientToClientView(client);
    }
}
Attached Files
File Type: smx projectile-camera.smx (5.0 KB, 54 views)
File Type: sp Get Plugin or Get Source (projectile-camera.sp - 77 views - 2.9 KB)

Last edited by bigborther; 02-12-2023 at 05:11.
bigborther is offline
daren adler
Member
Join Date: Aug 2017
Location: Iowa
Old 02-29-2024 , 17:08   Re: Projectile Camera
Reply With Quote #16

Could i get this one made just for the hl2/hl2dm rocket please ?.
Quote:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

public Plugin myinfo = {
name = "Projectile Camera",
author = "lugui",
description = "Watch the path of projectiles.",
version = "1.1.0",
}

bool projectileCamEnabled[MAXPLAYERS+1];
int observedEntRef[MAXPLAYERS+1];

public OnPluginStart() {
RegAdminCmd("sm_pc", Command_projectileCamera, ADMFLAG_ROOT, "Projectile Camera");
for(int i = 1; i < MaxClients; i ++){
observedEntRef[i] = -1;
}
}


public Action Command_projectileCamera(client, args){
projectileCamEnabled[client] = !projectileCamEnabled[client];
ReplyToCommand(client, "Projectile Camera %s", projectileCamEnabled[client]? "enabled" : "disabled");
}

public void OnClientDisconnect (int client) {
projectileCamEnabled[client] = false;
observedEntRef[client] = 0;
}

public void OnEntityCreated(int entity, const char[] classname) {
if(IsValidEntity(entity)) {
SDKHook(entity, SDKHook_SpawnPost, OnEntitySpawn);
}
}

public OnEntitySpawn(int entity) {
int iOwner = 0;
observedEntRef[iOwner] = -1;
if(HasEntProp(entity, Prop_Send, "m_hOwnerEntity")){
iOwner = GetEntPropEnt(entity, Prop_Send, "m_hOwnerEntity");
} else if (HasEntProp(entity, Prop_Send, "m_hOwner")) {
iOwner = GetEntPropEnt(entity, Prop_Send, "m_hOwner");
} else if (HasEntProp(entity, Prop_Send, "m_hThrower")) {
iOwner = GetEntPropEnt(entity, Prop_Send, "m_hThrower");
}

if(!isValidClient(iOwner) || !projectileCamEnabled[iOwner]){
return;
}

observedEntRef[iOwner] = EntIndexToEntRef(entity);
SDKUnhook(entity, SDKHook_SpawnPost, OnEntitySpawn);
}

public OnGameFrame() {
for(int client = 1; client < MaxClients; client++){
if(!projectileCamEnabled[client] || !isValidClient(client) || !IsPlayerAlive(client)){
continue;
}

int buttons = GetClientButtons(client);
if(buttons & IN_ATTACK2) {
setClientToProjectileiew(client);
} else {
setClientToClientView(client);
}
}
}

void setClientToProjectileiew(int client) {
int ent = EntRefToEntIndex(observedEntRef[client]);
if(IsValidEntity(ent)){
SetClientViewEntity(client, ent);
} else {
setClientToClientView(client);
}
}

void setClientToClientView(int client) {
SetClientViewEntity(client, client);
}



stock bool isValidClient(int client, bool allowBot = false) {
if ( !( 1 <= client <= MaxClients ) || !IsClientInGame(client) || IsClientSourceTV(client) || (!allowBot && IsFakeClient(client) ) ){
return false;
}
return true;
}
__________________
GuitarSlayer
daren adler is offline
Send a message via MSN to daren adler
Reply



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 16:46.


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