AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   solid_bsp without movetype_push (https://forums.alliedmods.net/showthread.php?t=220763)

Randomize 07-14-2013 06:37

solid_bsp without movetype_push
 
When I type /give_helmet, the CS crash and showed windows dialog "Solid_BSP Without Movetype_Push". What's wrong? :shock:
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#include <fakemeta_stocks>

#define PLUGIN    "Helmet Protection"
#define VERSION    "1.0"
#define AUTHOR    "DavidJr"

new bool:g_have_helmet[33]

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /helmet""give_helmet")
    
register_concmd("helmet""give_helmet")    
    
RegisterHam(Ham_TraceAttack"player""fw_trace")
}
public 
plugin_precache()
{    
    
precache_model("models/cspb/headgear.mdl")
}
public 
fw_trace(victimidFloat:damageFloat:dir[3], ptrbits
{
    new 
victim read_data(2)
    if (
get_user_attacker(id) == victim  && is_user_connected(id) && is_user_alive(id))
    {
        if (
get_tr2(ptrTR_iHitgroup) == HIT_HEAD//be attacked on head, drop the helmet
        

            
client_cmd(id"spk cspb/helmet_hit.wav")
            
client_cmd(victim"spk cspb/helmet_protection.wav")
            
client_print(victimprint_chat"Helmet Protection!")
            
g_have_helmet[id] = false
            drop_helmet
(id)
        }
    }
    return 
HAM_IGNORED 
}
public 
give_helmet(idimodelnumtargeter//set helmet on head
{
    if (
g_have_helmet[id] == false)
    {
        
set_pev(g_have_helmet[id], pev_movetypeMOVETYPE_FOLLOW)
        
set_pev(g_have_helmet[id], pev_aimentid)
        
set_pev(g_have_helmet[id], pev_rendermodekRenderNormal)
        
engfunc(EngFunc_SetModelg_have_helmet[id], "models/cspb/headgear.mdl")
        
client_print(idprint_chat"You got a helmet.")
    }
    return 
true
}
public 
drop_helmet(id//drop helmet on ground
{
    if (
g_have_helmet[id] == true)
    {
        
set_pev(g_have_helmet[id], pev_movetypeMOVETYPE_NONE)
        
set_pev(g_have_helmet[id], pev_aimentid)
        
set_pev(g_have_helmet[id], pev_rendermodekRenderNormal)
        
engfunc(EngFunc_SetModelg_have_helmet[id], "models/cspb/headgear.mdl")
    }
    return 
false



BaD CopY 03-07-2015 17:37

Re: solid_bsp without movetype_push
 
Bump.. same problem :/

Jhob94 03-08-2015 00:24

Re: solid_bsp without movetype_push
 
Quote:

Originally Posted by BaD CopY (Post 2271004)
Bump.. same problem :/

you can't, it is how the game works by default.

Use one of this:
Code:

#define        SOLID_NOT                      0          // No interaction with other objects
#define        SOLID_TRIGGER                  1          // Touch on edge, but not blocking
#define        SOLID_BBOX                      2          // Touch on edge, block
#define        SOLID_SLIDEBOX                  3          // Touch on edge, but not an onground

I guess you want bsp because bbox makes user stuck on the entity (i am not sure if it was you that said in the other thread)
If i am right, you can try TRIGGER and search for one movetype that causes collisions and suits fine for your needs.
Quote:

Originally Posted by hlsdk_const.inc
// NOTE: Some movetypes will cause collisions independent of SOLID_NOT/SOLID_TRIGGER when the entity moves

Movetypes:
Code:

#define        MOVETYPE_NONE                  0          // Never moves
#define        MOVETYPE_WALK                  3          // Player only - moving on the ground
#define        MOVETYPE_STEP                  4          // Gravity, special edge handling -- monsters use this
#define        MOVETYPE_FLY                    5          // No gravity, but still collides with stuff
#define        MOVETYPE_TOSS                  6          // Gravity/Collisions
#define        MOVETYPE_PUSH                  7          // No clip to world, push and crush
#define        MOVETYPE_NOCLIP                8          // No gravity, no collisions, still do velocity/avelocity
#define        MOVETYPE_FLYMISSILE            9          // Extra size to monsters
#define        MOVETYPE_BOUNCE                10          // Just like Toss, but reflect velocity when contacting surfaces
#define MOVETYPE_BOUNCEMISSILE          11          // Bounce w/o gravity
#define MOVETYPE_FOLLOW                12          // Track movement of aiment
#define        MOVETYPE_PUSHSTEP              13          // BSP model that needs physics/world collisions (uses nearest hull for world collision)



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

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