Raised This Month: $ Target: $400
 0% 

Not work player velocity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kulers2010
Junior Member
Join Date: Oct 2011
Location: Latvia
Old 07-24-2013 , 19:47   Not work player velocity
Reply With Quote #1

Thats my function
PHP Code:
public pfn_touch(entid)
{
    if (
id && id <= 32)
    {
        if (
is_user_alive(id))
        {
            if (
isBlock(ent))
            {
                new 
blockType entity_get_int(entEV_INT_body);                
                if (
blockType == BM_BHOP || blockType == BM_BARRIER_CT || blockType == BM_BARRIER_T || blockType == BM_BHOP_NOSLOW || blockType == BM_NONADMIN || blockType == BM_DELAYED)
                {
                    if (!
task_exists(TASK_BHOPSOLIDNOT ent) && !task_exists(TASK_BHOPSOLID ent))
                    {
                        new 
CsTeams:team cs_get_user_team(id);
                        
                        if (
blockType == BM_BARRIER_CT && team == CS_TEAM_T)
                        {
                            
taskSolidNot(TASK_BHOPSOLIDNOT ent);
                        }
                        else if (
blockType == BM_BARRIER_T && team == CS_TEAM_CT)
                        {
                            
taskSolidNot(TASK_BHOPSOLIDNOT ent);
                        }
                        else if (
blockType == BM_BHOP || blockType == BM_BHOP_NOSLOW)
                        {
                            
set_task(0.1"taskSolidNot"TASK_BHOPSOLIDNOT ent);
                        }
                        else if (
blockType == BM_NONADMIN && get_user_flags(id) & ADMIN_LEVEL_H)
                        {
                            
taskSolidNot(TASK_BHOPSOLIDNOT ent);
                        }
                        else if (
blockType == BM_DELAYED)
                        {
                            
set_task(2.0"taskSolidNot"TASK_BHOPSOLIDNOT ent);
                        }
                    }
                }else{
                    new 
FloatAngel[3];
                    
entity_get_vector(ent,EV_VEC_angles,Angel);
                    
//client_print(id,print_chat,"Angle: %f %f %f",Angel[0],Angel[1],Angel[2]);
                    
if(floatround(Angel[0]) == 90){
                        if(
blockType == BM_TRAMPOLINE)
                            
set_task(0.0,"actionTrampoline",id);
                        else if(
blockType == BM_LOWTRAMPOLINE)
                            
set_task(0.0,"actionLowTrampoline",id);
                        else if(
blockType == BM_HIGHTRAMPOLINE){
                            
set_task(0.0,"actionHighTrampoline",id);
                        }
                    }
                    
                    
                    
//Slide turas pie apaksas blokam
                    
if(blockType  ==  BM_SLIDE){
                        new 
Float:velocity[3];        
                        
entity_get_vector(idEV_VEC_velocityvelocity);
                        
velocity[2] = 100.0;                
                        
entity_set_vector(idEV_VEC_velocityvelocity);
                        
                        
client_print(id,print_chat,"Velocity 100");
                        
                    }
                    
                }
                
            }
        }
    }
    
    return 
PLUGIN_CONTINUE;

And thats not work, its only show in chat thats text velocity 100
PHP Code:
if(blockType  ==  BM_SLIDE){
                        new 
Float:velocity[3];        
                        
entity_get_vector(idEV_VEC_velocityvelocity);
                        
velocity[2] = 100.0;                
                        
entity_set_vector(idEV_VEC_velocityvelocity);
                        
                        
client_print(id,print_chat,"Velocity 100");
                        
                    } 

Last edited by kulers2010; 07-24-2013 at 19:47.
kulers2010 is offline
Send a message via Skype™ to kulers2010
MPD
Member
Join Date: May 2013
Location: Lithuania
Old 07-25-2013 , 05:45   Re: Not work player velocity
Reply With Quote #2

This was bothering me also. It turned out that it works for me only if I make set_task(0.1, ...). I have no idea what to do else to make velocity work.
MPD is offline
Send a message via Skype™ to MPD
kulers2010
Junior Member
Join Date: Oct 2011
Location: Latvia
Old 07-25-2013 , 08:46   Re: Not work player velocity
Reply With Quote #3

Quote:
Originally Posted by MPD View Post
This was bothering me also. It turned out that it works for me only if I make set_task(0.1, ...). I have no idea what to do else to make velocity work.
I wrote set_task(0.0,,, but i need immediately, not after it do task

Last edited by kulers2010; 07-25-2013 at 08:46. Reason: Grammer
kulers2010 is offline
Send a message via Skype™ to kulers2010
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 07-25-2013 , 08:55   Re: Not work player velocity
Reply With Quote #4

The minimun time a task can execute is 0.1 seconds. So putting anything less than that assumes you mean 0.1. If you need it right away, then call the function directly
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
kulers2010
Junior Member
Join Date: Oct 2011
Location: Latvia
Old 07-25-2013 , 16:17   Re: Not work player velocity
Reply With Quote #5

its not work
kulers2010 is offline
Send a message via Skype™ to kulers2010
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 07-26-2013 , 10:55   Re: Not work player velocity
Reply With Quote #6

Quote:
Originally Posted by kulers2010 View Post
its not work
What doesn't work?
What is supposed to happen? What does happen?
__________________

Last edited by Black Rose; 07-26-2013 at 11:05.
Black Rose is offline
MPD
Member
Join Date: May 2013
Location: Lithuania
Old 07-26-2013 , 11:12   Re: Not work player velocity
Reply With Quote #7

Quote:
Originally Posted by Black Rose View Post
What doesn't work?
What is supposed to happen? What does happen?
Setting velocity right after you get velocity doesn't work.
MPD is offline
Send a message via Skype™ to MPD
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 07-26-2013 , 11:17   Re: Not work player velocity
Reply With Quote #8

Quote:
Originally Posted by MPD View Post
Setting velocity right after you get velocity doesn't work.
I find this very hard to believe. Will try for myself.

EDIT: No problem at all...
When I set it at 100 instead of 1000 it won't move. When I use 200, it's almost like a normal jump. 100 is simply too low. Problem solved.
Code:
#include <amxmodx> #include <engine> public plugin_init() {     register_plugin("Test Plugin 9", "", "");     register_clcmd("megajump", "megajump"); } public megajump(id) {         new Float:velocity[3];         entity_get_vector(id, EV_VEC_velocity, velocity);     velocity[2] = 1000.0;     entity_set_vector(id, EV_VEC_velocity, velocity); }
__________________

Last edited by Black Rose; 07-26-2013 at 11:23.
Black Rose is offline
MPD
Member
Join Date: May 2013
Location: Lithuania
Old 07-26-2013 , 12:15   Re: Not work player velocity
Reply With Quote #9

Quote:
Originally Posted by Black Rose View Post
I find this very hard to believe. Will try for myself.

EDIT: No problem at all...
When I set it at 100 instead of 1000 it won't move. When I use 200, it's almost like a normal jump. 100 is simply too low. Problem solved.
Code:
#include <amxmodx> #include <engine> public plugin_init() {     register_plugin("Test Plugin 9", "", "");     register_clcmd("megajump", "megajump"); } public megajump(id) {         new Float:velocity[3];         entity_get_vector(id, EV_VEC_velocity, velocity);     velocity[2] = 1000.0;     entity_set_vector(id, EV_VEC_velocity, velocity); }
With clcmd everything works fine, I've tested it earlier. This is not solution, because it didn't work correctly without clcmd.

I was searching for answer on the internet and found that you need to get velocity in
PHP Code:
public client_PreThink(id
and set velocity in
PHP Code:
public client_PostThink(id
Maybe it will help. I will test it as soon as I can.
MPD is offline
Send a message via Skype™ to MPD
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 07-26-2013 , 15:06   Re: Not work player velocity
Reply With Quote #10

Quote:
Originally Posted by MPD View Post
With clcmd everything works fine, I've tested it earlier. This is not solution, because it didn't work correctly without clcmd.

I was searching for answer on the internet and found that you need to get velocity in
PHP Code:
public client_PreThink(id
and set velocity in
PHP Code:
public client_PostThink(id
Maybe it will help. I will test it as soon as I can.
This would be my best suggestion. Maybe it will need a loop to check for multiple players in need of a boost before unregister_forward() is called. I'm testing everything solo, so I can't determine.
Using Hamsandwich and Fakemeta is just a personal preference. Works just as well with engine.
Code:
#include <amxmodx> #include <hamsandwich> #include <fakemeta> new Float:g_pVelocity[33][3]; new g_fPostThink; public plugin_init() {     register_plugin("Test Plugin 9", "", "");         RegisterHam(Ham_Touch, "player", "HamTouch"); } public HamTouch(id, ent) {     if ( 0 < id < 33 ) {         pev(id, pev_velocity, g_pVelocity[id]);         g_pVelocity[id][2] = 100.0;         g_fPostThink = register_forward(FM_PlayerPostThink, "PlayerPostThink", 1);     } } public PlayerPostThink(id) {     if ( g_pVelocity[id][2] == 100.0 ) {         unregister_forward(FM_PlayerPostThink, g_fPostThink, 1);         set_pev(id, pev_velocity, g_pVelocity[id]);     } }
__________________

Last edited by Black Rose; 07-26-2013 at 15:09.
Black Rose 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 06:29.


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