AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Ent flying x units over player (https://forums.alliedmods.net/showthread.php?t=50137)

osk522 01-20-2007 08:05

Ent flying x units over player
 
Hi there!
Iv'e been searching the forums for over 2 hours now (yes, I said hours), but can find how to make an ent(camera) follow another ent (player), x units over the ent(player).
And don't post some crap about topdown view.

BTW the ent(camera) wont have any function, except that the player will attach its view to it (attach_view(id,cameraent[id])).

XxAvalanchexX 01-20-2007 17:02

Re: Ent flying x units over player
 
Code:
new myCamera[33]; public plugin_init() {      register_forward(FM_PlayerPostThink,"fw_postthink"); } public make_a_camera(id) {      myCamera[id] = create_entity("info_target"); } public fw_postthink(id) {      if(pev_valid(myCamera[id]))      {           new Float:origin[3];           pev(id,pev_origin,origin);           origin[2] += 128.0; // or however many units           set_pev(myCamera[id],pev_origin,origin);      } }

After updating your position, it finds the space 128 units above you, and sets your camera's origin to that. If you want to make sure it doesn't go through the roof, you'll want to do a trace line upwards and see if it hits anything before 128 units.

osk522 01-20-2007 18:45

Re: Ent flying x units over player
 
Quote:

Originally Posted by XxAvalanchexX (Post 429603)
After updating your position, it finds the space 128 units above you, and sets your camera's origin to that. If you want to make sure it doesn't go through the roof, you'll want to do a trace line upwards and see if it hits anything before 128 units.

Haven't tested it, but it looks so simple it just got to work :wink:.
+karma.

osk522 01-20-2007 21:10

Re: Ent flying x units over player
 
Tested it, although I dont know if it works.
When I do attach_view(id,cameraent[id]) the display fucks up.
When I shoot, I can hear the sounds of the gun.
I think it's becouse the ent doesn't have any angles, how do I fix it?

XxAvalanchexX 01-20-2007 22:03

Re: Ent flying x units over player
 
I've never actually been able to get attach_view to work. I don't know why. It always sets my view to the origin of 0,0,0.

osk522 01-21-2007 09:28

Re: Ent flying x units over player
 
Quote:

Originally Posted by XxAvalanchexX (Post 429707)
I've never actually been able to get attach_view to work. I don't know why. It always sets my view to the origin of 0,0,0.

Iv'e got it to work.
I can post a copy if you want.

GoD-Tony 01-21-2007 11:01

Re: Ent flying x units over player
 
I'm also trying to do something similar, please post it if you have it working. Thanks.

Zenith77 01-21-2007 20:21

Re: Ent flying x units over player
 
attach_view() only works with entities that have a model set. Don't ask me why, HL is just weird. If in the case you don't want your entity to have a model, you can just set the correct rendering on it.

dutchmeat 01-22-2007 05:15

Re: Ent flying x units over player
 
this will work:
http://forums.alliedmods.net/showthread.php?t=29637
the only thin you have to do is change the coordinates.

But, if you are going to use this as a check to see if the player has a wallhack, it won't work.
A wallhack is a hook to the client's video memory, so it won't change the halflife view. If you want to create a 'wallhack check' you will have to make a clientside program, that makes a 'windows' screenshot, and send it via socket.

osk522 01-22-2007 11:38

Re: Ent flying x units over player
 
Quote:

Originally Posted by dutchmeat (Post 430165)
this will work:
http://forums.alliedmods.net/showthread.php?t=29637
the only thin you have to do is change the coordinates.

But, if you are going to use this as a check to see if the player has a wallhack, it won't work.
A wallhack is a hook to the client's video memory, so it won't change the halflife view. If you want to create a 'wallhack check' you will have to make a clientside program, that makes a 'windows' screenshot, and send it via socket.

I know that.
Otherwise every wallhack there is would probably be detected by VAC...


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

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