Raised This Month: $ Target: $400
 0% 

[Solved] Moving func_wall


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 05-15-2010 , 06:23   [Solved] Moving func_wall
Reply With Quote #1

Hi again,

M having trouble with moving func_wall's, heres my current code :

PHP Code:
public DoGrab(id)
{
    if(!
UserGrabbing[id])
    {
        new 
EntEntBody
        get_user_aiming
(idEntEntBody)
    
        if(
Ent)
        {
            new 
szClassname[32]
            
pev(Entpev_classnameszClassname31)
    
            if(
equal(szClassname"func_wall"))
            {
                if(!
IsGrabbed[Ent])
                {
                    
IsGrabbed[Ent]++
                    
UserGrabbing[id] = Ent
                    set_rendering
(EntkRenderFxNone25500kRenderTransColor80)
                
                    static 
Float:origin[2][3];
                
                    
pev(idpev_originorigin[0]);
                    
pev(Entpev_originorigin[1]);

                    
GrabDistance[id] = get_distance_f(origin[0], origin[1]);
                }
            }
        }
    }
}

public 
client_PreThink(id)
{
    if(!
is_user_alive(id)) return PLUGIN_CONTINUE;
    
    if(!
UserGrabbing[id]) return PLUGIN_CONTINUE;
    
    new 
buttons pev(idpev_button);
    
    static 
Float:origin[2][3], ilook[3], Float:look[3];
    static 
Float:direction[3], Float:moveto[3], Float:grabbedorigin[3];

    static 
Float:velocity[3], Float:length;

    
get_user_origin(idilook3);
    
IVecFVec(ilooklook);

    
pev(UserGrabbing[id], pev_origingrabbedorigin);

    
pev(idpev_originorigin[0]);
    
pev(UserGrabbing[id], pev_origin,origin[1]);

    
direction[0] = look[0] - origin[0][0];
    
direction[1] = look[1] - origin[0][1];
    
direction[2] = look[2] - origin[0][2];

    
length get_distance_f(lookorigin[0]);

    if(!
length)
        
length 1.0;

    
moveto[0] = origin[0][0] + direction[0] * GrabDistance[id];
    
moveto[1] = origin[0][1] + direction[1] * GrabDistance[id];
    
moveto[2] = origin[0][2] + direction[2] * GrabDistance[id];

    
velocity[0] = (moveto[0] - origin[1][0]) * 8;
    
velocity[1] = (moveto[1] - origin[1][1]) * 8;
    
velocity[2] = (moveto[2] - origin[1][2]) * 8;

    
set_pev(UserGrabbing[id], pev_velocityvelocity);

    if(
buttons IN_ATTACK)
    {
        
set_pev(idpev_buttonbuttons & ~IN_ATTACK);
        
GrabDistance[id] += 7;
    }

    else if(
buttons IN_ATTACK2)
    {
        
set_pev(idpev_buttonbuttons & ~IN_ATTACK2);
        
GrabDistance[id] -= 7;

        if(
GrabDistance[id] < MIN_DIST)
            
GrabDistance[id] = MIN_DIST;
    }
    
    return 
PLUGIN_CONTINUE

The entity gets a color, but doesn't move at all. ( no error logs )
I have tried many ways and looked at many plugins like : entmover, jedi grab, grab plugins but nothing seems to work.

Greetings Grim.
__________________
I am out of order!

Last edited by grimvh2; 05-16-2010 at 08:43.
grimvh2 is offline
 



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 03:35.


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