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

I want to get velocity by viewangle


Post New Thread Reply   
 
Thread Tools Display Modes
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 01-01-2009 , 18:52   Re: I want to get velocity by viewangle
Reply With Quote #21

OMG it's exaclty like noclip!
I hate you for your awesomeness Exolent.
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
cs1.7
Senior Member
Join Date: Oct 2008
Old 01-02-2009 , 02:21   Re: I want to get velocity by viewangle
Reply With Quote #22

really cool.

how do you correctly increase velocity?

i have added:

PHP Code:
    static Float:maxspeed;
    
pev(clientpev_maxspeedmaxspeed);
    
set_pev(clientpev_maxspeed600.0); // i have added this line 
..but it acts weird though! The speed is much lower than 600 ..or 500 or whatever. If you press duck though ..it gets (i would guess the full speed)

I dont know if it's a little (cool) typo by Exolent[jNr] where he accidently doubled the speed (instead of halfing it). But: i wonder why the speed gets increased but definitely not as high as demanded in the code. Maybe i set the speed wrong. Please show the correct way.


-----

on a side note: as i was experimenting with setting speed i added:


PHP Code:
    static Float:maxspeed;
    
pev(clientpev_maxspeedmaxspeed);
    
set_pev(clientpev_maxspeedmaxspeed 2.0); // i have added this line 
The funny thing: As soon as u go over 1.0, you get the following effect. The "twirl" effect might be very cool for punishments plugins. Like ATAC.
Maybe you can reproduce the "twirl" effect in a "correct way" and create atac_twirl ..or something. Thats just a hint.

http://www.file-upload.eu/download-1...unish.rar.html
cs1.7 is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 01-02-2009 , 06:16   Re: I want to get velocity by viewangle
Reply With Quote #23

Just double the variable with the wanted speed.
PHP Code:
static Float:MaxSpeed pevidpev_maxspeedMaxSpeed );
MaxSpeed *= 2.0// Or whatever.
// Now, after using velocity_by_aim(), it will have a doubled value. 
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ

Last edited by Dores; 01-02-2009 at 06:19.
Dores is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-02-2009 , 09:51   Re: I want to get velocity by viewangle
Reply With Quote #24

Instead of using pev_maxspeed, just use a value you want.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
cs1.7
Senior Member
Join Date: Oct 2008
Old 01-10-2009 , 01:02   Re: I want to get velocity by viewangle
Reply With Quote #25

Quote:
Originally Posted by Exolent[jNr] View Post
Instead of using pev_maxspeed, just use a value you want.
do you mean like:
PHP Code:
    pev(idpev_maxspeedmaxspeed); 
replace pev_maxspeed with 500

PHP Code:
    pev(id500maxspeed); 
if yes, it does not work.


another thing: if you are in the air and not moving you ..slowly.. sink down to the ground. I could set user gravity to absolute zero to terminate this sinking effect and after deactivating via "say /fly" reset to users previous gravity. Any ideas to remove the sinking effect in a better way?
cs1.7 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-10-2009 , 01:10   Re: I want to get velocity by viewangle
Reply With Quote #26

No, I mean change the whole "maxspeed" part to your value:
PHP Code:
    static Float:maxspeed;
    
//pev(client, pev_maxspeed, maxspeed);
    
maxspeed 250.0

Gravity would be the best way to fix the sinking.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define NOCLIP_SPEED 250.0

new bool:g_flying[33];

public 
plugin_init()
{
    
register_plugin("Noclip Simulator""0.1""Exolent");
    
    
register_clcmd("say /fly""CmdFly");
    
    
register_forward(FM_PlayerPreThink"FwdPlayerPreThink");
}

public 
client_disconnect(client)
{
    
g_flying[client] = false;
}

public 
CmdFly(client)
{
    
g_flying[client] = !g_flying[client];
    
    
client_print(clientprint_chat"You are no%s flying."g_flying[client] ? "w" " longer");
    
    
set_pev(clientpev_gravityg_flying[client] ? 0.000001 1.0);
    
    return 
PLUGIN_HANDLED;
}

public 
FwdPlayerPreThink(client)
{
    if( !
g_flying[client] || !is_user_alive(client) ) return;
    
    
set_pev(clientpev_movetypeMOVETYPE_FLY);
    
    new 
Float:maxspeed NOCLIP_SPEED;
    if( 
is_user_ducking(client) )
    {
        
// I don't know the real calculation for ducking velocity
        // but this will have to do for now
        
maxspeed /= 2.0;
    }
    
    static 
Float:aim_velocity[3];
    
velocity_by_aim(clientfloatround(maxspeed), aim_velocity);
    
    static 
Float:client_origin[3];
    
pev(clientpev_originclient_origin);
    
    new 
button pev(clientpev_button);
    
    new 
Float:velocity[3];
    if( 
button IN_FORWARD )
    {
        
velocity[0] += aim_velocity[0];
        
velocity[1] += aim_velocity[1];
        
velocity[2] += aim_velocity[2];
    }
    if( 
button IN_BACK )
    {
        
velocity[0] -= aim_velocity[0];
        
velocity[1] -= aim_velocity[1];
        
velocity[2] -= aim_velocity[2];
    }
    if( 
button IN_MOVERIGHT )
    {
        
// angle velocity_aim -90 degrees
        
        //velocity[0] += ((floatcos(-90.0, degrees) * velocity_aim[0]) - (floatsin(-90.0, degrees) * velocity_aim[1]));
        //                 cos 90 = 0                                     sin -90 = -1
        //               (( 0 * velocity_aim[0] ) - ( -1 * velocity_aim[1] ))
        //               velocity_aim[1]
        
velocity[0] += aim_velocity[1];
        
        
//velocity[1] += ((floatsin(-90.0, degrees) * velocity_aim[0]) - (floatcos(-90.0, degrees) * velocity_aim[1]));
        //                sin -90 = -1                                      cos -90 = 0
        //               (( -1 * velocity_aim[0] ) - ( 0 * velocity_aim[1] ))
        //               -velocity_aim[0]
        
velocity[1] -= aim_velocity[0];
    }
    if( 
button IN_MOVELEFT )
    {
        
// angle velocity_aim 90 degrees
        
        //velocity[0] += ((floatcos(90.0, degrees) * velocity_aim[0]) - (floatsin(90.0, degrees) * velocity_aim[1]));
        //               cos 90 = 0                                      sin 90 = 1
        //               (( 0 * velocity_aim[0] ) - ( 1 * velocity_aim[1] ))
        //               -velocity_aim[1]
        
velocity[0] -= aim_velocity[1];
        
        
//velocity[1] += ((floatsin(90.0, degrees) * velocity_aim[0]) - (floatcos(90.0, degrees) * velocity_aim[1]));
        //               sin 90 = 1                                      cos 90 = 0
        //               (( 1 * velocity_aim[0] ) - ( 0 * velocity_aim[1] ))
        //               velocity_aim[0]
        
velocity[1] += aim_velocity[0];
    }
    
    
set_pev(clientpev_velocityvelocity);
}

// modified from kz_ljs_xm
bool:is_user_ducking(client)
{
    static 
Float:absmin[3], Float:absmax[3];
    
pev(clientpev_absminabsmin);
    
pev(clientpev_absmaxabsmax);
    
    return ( (
absmax[2] - absmin[2]) > 64.0 );

__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
cs1.7
Senior Member
Join Date: Oct 2008
Old 01-10-2009 , 01:36   Re: I want to get velocity by viewangle
Reply With Quote #27

just that you know:


the speed values with this pev_maxspeed seemingly do not equal the actual cs speeds in game. i mean if i put

PHP Code:
#define NOCLIP_SPEED 600.0 
then i would say it's actually like 300.0. it's much slower. half?

the same thing as i reported about

PHP Code:
  static Float:maxspeed;
    
pev(clientpev_maxspeedmaxspeed);
    
set_pev(clientpev_maxspeed600.0); // i have added this line 
it must be the way pev_maxspeed works. your code is perfect.

this one of my new fav plugins.

edit
i think it's something else:
ey, could it be that the is_user_ducking part of your code divides and affects the regular flying speed too?

i mean i just set

if( is_user_ducking(id) )
{
// I don't know the real calculation for ducking velocity
// but this will have to do for now
maxspeed /= 1.0;
}

and i truely flew as fast as 600.0

the regular flying speed is beeing divided by the value of is_user_ducking. So if u set is_user_ducking = 1.0 , then u get the full speed of #define NOCLIP_SPEED

Last edited by cs1.7; 01-10-2009 at 06:01.
cs1.7 is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 01-10-2009 , 12:23   Re: I want to get velocity by viewangle
Reply With Quote #28

Side note: You should know that: num / 1 = num. But you seem to ignore me anyways.
Dores is offline
cs1.7
Senior Member
Join Date: Oct 2008
Old 01-10-2009 , 12:39   Re: I want to get velocity by viewangle
Reply With Quote #29

it works awesome. i just wondered why it behaved like that.

Exolent[jNr] is gonna get alot of karmas from me. i was on this for two years now..lol


maybe i should create a vid.
cs1.7 is offline
cs1.7
Senior Member
Join Date: Oct 2008
Old 06-27-2009 , 17:43   Re: I want to get velocity by viewangle
Reply With Quote #30

ey Exolent[jNr]

this is by far one of my fav codes.

I just found out something though.


If you are in the sky and look/aim on your feet ..then you almost cant move sidewards..with A or D.

The same goes if you look in the opposite direction. Look straight in the air..then it's the same problem..if ou try to move to the sides (A or D) ..then you almost can't move too.

I have the feeling the more you aim upwards/downwards..the slower you are if you want to move to the side (A or D).
cs1.7 is offline
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 01:45.


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