Raised This Month: $12 Target: $400
 3% 

Blocking input while dead


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Des12
Senior Member
Join Date: Jan 2005
Old 09-10-2007 , 18:07   Blocking input while dead
Reply With Quote #1

Hello everyone, I'm once again coding for The Specialists, and in The Specialists, once a player dies he must press +attack to respawn.

Blocking IN_ATTACK works perfectly when the player is alive, but does not work at all when he is dead.

Code:
public client_PreThink(id) {     if(!is_user_alive(id)) { // if I take away, person still can spawn but can't attack while alive         if(g_spawnblock[id] > 0) { //is always > 0             new bufferstop = entity_get_int(id,EV_INT_button)                 if(bufferstop != 0) {                 entity_set_int(id,EV_INT_button,bufferstop & ~IN_ATTACK & ~IN_ATTACK2 & ~IN_USE & ~IN_ALT1)             }                                       return PLUGIN_HANDLED;         }     } }

Strange, anyone have a solution to preventing someone from spawning?
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
Des12
Senior Member
Join Date: Jan 2005
Old 09-27-2007 , 20:18   Re: Blocking input while dead
Reply With Quote #2

Bump, well is it possible to hook a respawn message and block it? How do you block messages?
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
X-Script
BANNED
Join Date: Jul 2007
Location: (#504434)
Old 09-27-2007 , 20:24   Re: Blocking input while dead
Reply With Quote #3

you mean?

PHP Code:
#include <amxmodx>
#include <engine>

public plugin_init() {
    
register_plugin("LOL","ROFL","PWN");
    
    
register_cvar("mp_deathblock","0");
    
    
register_message(get_user_msgid("DeathMsg"),"message");
    
    new 
mod[32];
    
get_modname(mod,31);
    
    if(
equal(mod,"ts")) {
        
register_message(get_user_msgid("TSMessage"),"message");
        
register_cvar("mp_tsmessageblock","0");
    }
}

public 
message(msg_id,msg_dest,msg_entity) {
    new 
mod[32];
    
get_modname(mod,31);
    if(
msg_id == get_user_msgid("DeathMsg")) {
        if(
get_cvar_num("mp_deathblock") >= 1) {
            return 
PLUGIN_HANDLED;
        }
    }
    if(
equal(mod,"ts")) {
        if(
msg_id == get_user_msgid("TSMessage")) {
            if(
get_cvar_num("mp_tsmessageblock") >= 1) {
                new 
msg[92];
                
get_msg_arg_string(6,msg,91);
                if(!
is_integer(msg) && !equal(msg,"Press Fire To Play!")) {
                    return 
PLUGIN_HANDLED;
                }
            }
        }
    }
    return 
PLUGIN_CONTINUE;
}

stock bool:is_integer(str[]) {
    new 
istr str_to_num(str);
    new 
restr[32];
    
num_to_str(istr,restr,31);
    if(
equal(str,restr)) {
        return 
true;
    }
    return 
false;

X-Script is offline
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 09-29-2007 , 14:53   Re: Blocking input while dead
Reply With Quote #4

No, that's not what he means.

Des12, debug. First start simple and give it an echo so you know the global variables that you claim are always above 0 are actually above 0, for example.

Code:
Change:             if(bufferstop != 0) {                 entity_set_int(id,EV_INT_button,bufferstop & ~IN_ATTACK & ~IN_ATTACK2 & ~IN_USE & ~IN_ALT1)             } TO:             if(bufferstop != 0) {                 entity_set_int(id,EV_INT_button,bufferstop & ~IN_ATTACK)                 client_print(id,print_chat,"Stopped Attack")             }

And take out PLUGIN_HANDLED - you don't need that there.

I would bet you don't get any echo, which will tell you that the error lies before the button setting, in your variable testing code.
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
potatis_invalido
BANNED
Join Date: Jul 2007
Location: 0 (world)
Old 10-01-2007 , 05:39   Re: Blocking input while dead
Reply With Quote #5

This works in Counter-Strike.
You need AMX Mod X 1.80 or Ham Sandwich installed.
Code:
#include <amxmodx>
#include <hamsandwich>
 
public plugin_init()
{
    RegisterHam(Ham_Spawn, "player", "ham_spawn_player");
}
 
public ham_spawn_player(id)
{
    if(!is_user_alive(id))
    {
        return HAM_SUPERCEDE;
    }
    return HAM_IGNORED;
}
potatis_invalido is offline
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 10-01-2007 , 12:01   Re: Blocking input while dead
Reply With Quote #6

It just depends whether or not TS sends a Ham_Spawn on player spawn or does it some other way.

Only one way to find out ...
purple_pixie 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 16:51.


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