Raised This Month: $ Target: $400
 0% 

Shootable Objects Move


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
deadman909
Veteran Member
Join Date: Oct 2008
Old 05-15-2013 , 13:07   Shootable Objects Move
Reply With Quote #1

Hi I tried this plugin but there seems to be no effect. It is suppose to let you move objects by shooting them but when I shot objects it does nothing.

Can someone fix it and make it into a regular mod. Just for normal play and not Zombie.

PHP Code:
/*================================================================================
    
    ----------------------------------
    -*- [ZP] Shootable Objects 1.0 -*-
    ----------------------------------
    
    ~~~~~~~~~~~~~~~
    - Description -
    ~~~~~~~~~~~~~~~
    
    This is just a conversion of Biohazard's object shooting feature to ZP.
    It allows humans to move func_pushables around by shooting them from a
    distance. Zombies can do the same by slashing them with the knife.
    
    ~~~~~~~~~
    - CVARS -
    ~~~~~~~~~
    
    * zp_pushpwr_humans <2.0> - How strong humans shoot objects away
    * zp_pushpwr_zombies <5.0> - How strong zombies shoot objects away
    * zp_push_momentum <0/1> - Convey pushable's velocity to other
       players/entities when they collide (looks more realistic)
    
================================================================================*/

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <xs>
#include <zombieplague>

new cvar_pushpwr_humanscvar_pushpwr_zombiescvar_push_momentum

public plugin_init()
{
    
register_plugin("[ZP] Shootable Objects""1.0""MeRcyLeZZ")
    
    
cvar_pushpwr_humans register_cvar("zp_pushpwr_humans""5.0")
    
cvar_pushpwr_zombies register_cvar("zp_pushpwr_zombies""5.0")
    
cvar_push_momentum register_cvar("zp_push_momentum""1")
    
    
RegisterHam(Ham_TraceAttack"func_pushable""fw_TraceAttack_Pushable")
    
RegisterHam(Ham_Touch"func_pushable""fw_Touch_Pushable")
}

public 
fw_TraceAttack_Pushable(entattackerFloat:damageFloat:direction[3])
{
    
// Non-player attacker
    
if (!is_user_connected(attacker))
        return;
    
    
// Get object's velocity
    
static Float:velocity[3]
    
pev(entpev_velocityvelocity)
    
    
// Calculate velocity based on direction, damage and multipliers
    
xs_vec_mul_scalar(directiondamagedirection)
    
xs_vec_mul_scalar(directionzp_get_user_zombie(attacker) ? get_pcvar_float(cvar_pushpwr_zombies) : get_pcvar_float(cvar_pushpwr_humans), direction)
    
    
// Add up the new vector
    
xs_vec_add(velocitydirectiondirection)
    
    
// Vertical velocity shouldn't be affected
    
direction[2] = velocity[2]
    
    
// Set the final velocity
    
set_pev(entpev_velocitydirection)
}

public 
fw_Touch_Pushable(selfother)
{
    
// Momentum cvar disabled or touching an invalid entity
    
if (!get_pcvar_num(cvar_push_momentum) || !pev_valid(other))
        return;
    
    
// Get object's velocity
    
static Float:velocity1[3]
    
pev(selfpev_velocityvelocity1)
    
    
// Transfer velocity (if any) to the colliding entity
    
if (vector_length(velocity1) > 0.0)
    {
        static 
Float:velocity2[3]
        
pev(otherpev_velocityvelocity2)
        
velocity2[0] += velocity1[0]
        
velocity2[1] += velocity1[1]
        
set_pev(otherpev_velocityvelocity2)
    }

__________________

deadman909 is offline
Send a message via MSN to deadman909 Send a message via Yahoo to deadman909
 



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


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