Raised This Month: $ Target: $400
 0% 

NoClip Help, If Stuck In wall After Time You Will Die


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
cikjam
Senior Member
Join Date: Feb 2009
Location: Australia
Old 06-26-2009 , 02:13   NoClip Help, If Stuck In wall After Time You Will Die
Reply With Quote #1

I need help with My noclip block for blockmaker, everything works but I want to make it so if you are stuck in a wall when the noclip time runs out you die.

Code:
actionNoclip(id, bool:OverrideTimer)
{
    new Float:fTime = halflife_time();
    
    if (fTime >= gfNoclipNextUse[id] || OverrideTimer)
    {
        new Float:fTimeout = get_cvar_float("bm_nocliptime");
        
        set_user_noclip(id, 1);
        set_task(fTimeout, "taskNoclipRemove", TASK_NOCLIP + id, "", 0, "a", 1);
        
        //only make player glow blue for noclip if player isn't already stealth
        if (fTime >= gfStealthTimeOut[id])
        {
            set_user_rendering(id, kRenderFxGlowShell, 0, 0, 255, kRenderNormal, 16);
        }
        
        //play invincibility sound
        emit_sound(id, CHAN_STATIC, gszInvincibleSound, 1.0, ATTN_NORM, 0, PITCH_NORM);
        
        gfNoclipTimeOut[id] = fTime + fTimeout;
        gfNoclipNextUse[id] = fTime + fTimeout + get_cvar_float("bm_noclipcooldown");
    }
    else
    {
        set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
        show_hudmessage(id, "Wait Time: %.1f", gfNoclipNextUse[id] - fTime);
    }
}
cikjam is offline
zacky
Senior Member
Join Date: Mar 2008
Location: Sweden
Old 06-26-2009 , 03:31   Re: NoClip Help, If Stuck In wall After Time You Will Die
Reply With Quote #2

Show us the taskNoclipRemove.
zacky is offline
Send a message via Skype™ to zacky
cikjam
Senior Member
Join Date: Feb 2009
Location: Australia
Old 06-26-2009 , 04:32   Re: NoClip Help, If Stuck In wall After Time You Will Die
Reply With Quote #3

Code:
public taskNoclipRemove(id)
{
    id -= TASK_NOCLIP;
    
    //make sure player is alive
    if (is_user_alive(id))
    {
        set_user_noclip(id, 0);
        
        //only set players rendering back to normal if player is not stealth
        if (halflife_time() >= gfStealthTimeOut[id])
        {
            set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 16);
        }
    }
}
cikjam is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 06-26-2009 , 06:02   Re: NoClip Help, If Stuck In wall After Time You Will Die
Reply With Quote #4

PHP Code:
stock bool:is_user_stuck(id)
{
        static 
Float:Origin[3];
        
pev(idpev_originOrigin);
        
engfunc(EngFunc_TraceHullOriginOriginIGNORE_MONSTERSpev(idpev_flags) & FL_DUCKING HULL_HEAD HULL_HUMAN00);
        if (
get_tr2(0TR_StartSolid))
                return 
true;
 
        return 
false;

In your code:

PHP Code:
if(is_user_stuck(id))
{
    
user_kill(id); // or something similiar.

__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
cikjam
Senior Member
Join Date: Feb 2009
Location: Australia
Old 06-26-2009 , 06:15   Re: NoClip Help, If Stuck In wall After Time You Will Die
Reply With Quote #5

So where would i put them?
Also , Will this work once the time runs out? I dont want it to kill them when they still got time.

Last edited by cikjam; 06-26-2009 at 06:18.
cikjam is offline
zacky
Senior Member
Join Date: Mar 2008
Location: Sweden
Old 06-26-2009 , 06:51   Re: NoClip Help, If Stuck In wall After Time You Will Die
Reply With Quote #6

Put it in taskNoclipRemove inside the if (is_user_alive(id)) {
zacky is offline
Send a message via Skype™ to zacky
cikjam
Senior Member
Join Date: Feb 2009
Location: Australia
Old 06-26-2009 , 06:57   Re: NoClip Help, If Stuck In wall After Time You Will Die
Reply With Quote #7

I got it to work.
I put the Stock Stuff In front of ActionNoclip and i added the use_kill thing to tasknoclipremove.

I dont think thats the right place where i put the Stock stuff. Where should i put it.
cikjam is offline
zacky
Senior Member
Join Date: Mar 2008
Location: Sweden
Old 06-26-2009 , 08:08   Re: NoClip Help, If Stuck In wall After Time You Will Die
Reply With Quote #8

i just said where to put it. In taskNoclipRemove inside the if(is_user_alive(id)) {

EDIT: I have noclip block in my bm too and it works fine when i put it there.

EDIT2: I dont have that stock, but try this stock instead:
PHP Code:
stock bool:is_user_stuck(index) {
    new 
Float:g_noclip_origin[3];
    
pev(indexpev_origing_noclip_origin);
    if ( 
trace_hull(g_noclip_originHULL_HUMAN,index) != )
    {
        return 
true;
    }
    return 
false;

and then do as Xellath said:
PHP Code:
if (is_user_stuck(id)) {
      
user_kill(id);


Last edited by zacky; 06-26-2009 at 08:13.
zacky is offline
Send a message via Skype™ to zacky
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-26-2009 , 09:14   Re: NoClip Help, If Stuck In wall After Time You Will Die
Reply With Quote #9

If that doesn't work you can try using EngFunc_PointContents
__________________
Bugsy is offline
cikjam
Senior Member
Join Date: Feb 2009
Location: Australia
Old 06-26-2009 , 23:46   Re: NoClip Help, If Stuck In wall After Time You Will Die
Reply With Quote #10

I just found 1 problem, When the noclip runs out and im inside a Blockmaker Block, it doesnt kill me, i just stay stuck.

Code:
stock bool:is_user_stuck(id)
{
        static Float:Origin[3];
        pev(id, pev_origin, Origin);
        engfunc(EngFunc_TraceHull, Origin, Origin, IGNORE_MONSTERS, pev(id, pev_flags) & FL_DUCKING ? HULL_HEAD : HULL_HUMAN, 0, 0);
        if (get_tr2(0, TR_StartSolid))
                return true;
 
        return false;
}
Is there anything i need to add?

Zacky does your one get slayed when in block?

EDIT: Tested Zacky's, Its working, So far so good.

Last edited by cikjam; 06-26-2009 at 23:52.
cikjam 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 15:40.


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