Raised This Month: $ Target: $400
 0% 

hud_showmessage not showing up


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
skis
Junior Member
Join Date: Jul 2008
Old 07-23-2008 , 21:18   hud_showmessage not showing up
Reply With Quote #1

Can anyone please check out my code and figure out why hud_showmessage isn't showing up to the person who picked up the bomb? No errors are coming up in the server log when someone picks the bomb up.

Also, is there a way to show the message to everybody instead of just the player who picks it up? (I'm assuming in the "id" parameter of the "public bombpickup(id)" function that metamod is passing the id of the player who made the event fire in the first place? Is that how it works?)

Here's my code:

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "mod_name_goes_here"
#define VERSION "1.0"
#define AUTHOR "author_name_goes_here"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_logevent("bombdrop"3"2=Dropped_The_Bomb");
    
register_logevent("bombpickup"3"2=Got_The_Bomb");
}

public 
bombdrop(id) {
    
//not written yet
    
return PLUGIN_CONTINUE;
}

public 
bombpickup(id) {
    new 
players[32];
    new 
numi;
    
get_players(playersnum"e""TERRORIST");
    for(
1;numi++) {
        new 
weapons[32];
        new 
numweaponsj;
        
get_user_weapons(iweaponsnumweapons);
        for (
0numweaponsj++) {
            if (
equal(weapons[j],"weapon_c4")) {
                
set_hudmessage(25500, -1.00.01)
                
show_hudmessage(id"you picked up the bomb")
            }
        }
    }
    return 
PLUGIN_CONTINUE;

Thanks
skis is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-23-2008 , 21:31   Re: hud_showmessage not showing up
Reply With Quote #2

Change:
Code:
if(equal(weapons[j],"weapon_c4"))
To:
Code:
if(weapons[j]==CSW_C4)
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
skis
Junior Member
Join Date: Jul 2008
Old 07-23-2008 , 21:37   Re: hud_showmessage not showing up
Reply With Quote #3

That compiles and doesn't cause any errors when the bomb is picked up, but it also doesn't show the message on the screen when the bomb is picked up.
skis is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-23-2008 , 21:41   Re: hud_showmessage not showing up
Reply With Quote #4

http://forums.alliedmods.net/showthread.php?t=40164
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
skis
Junior Member
Join Date: Jul 2008
Old 07-23-2008 , 22:19   Re: hud_showmessage not showing up
Reply With Quote #5

OK, I changed to fakemeta to find who has the bomb using the script from that thread. The message is still not displaying on the screen. Is there a way to show the message to every player so I can see if it's just sending it to the wrong player?

Here's my code now:

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta_util>

#define PLUGIN "mod_name_goes_here"
#define VERSION "1.0"
#define AUTHOR "author_goes_here"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_logevent("bombdrop"3"2=Dropped_The_Bomb");
    
register_logevent("bombpickup"3"2=Got_The_Bomb");
}

public 
bombdrop() {
    return 
PLUGIN_CONTINUE;
}

public 
bombpickup(id) {
    new 
carrier 0ownerentbomb fm_find_ent_by_class(-1"weapon_c4");
    if (
bomb && (ownerent pev(bombpev_owner)) <= get_maxplayers()) {
        
carrier ownerent;
    }
    if (
carrier) {
        
set_hudmessage(25500, -1.00.01)
        
show_hudmessage(id"you picked up the bomb")
        return 
PLUGIN_CONTINUE;
    } else {
        return 
PLUGIN_CONTINUE;
    }
    return 
PLUGIN_CONTINUE;

skis is offline
Jon
Veteran Member
Join Date: Dec 2007
Old 07-24-2008 , 05:49   Re: hud_showmessage not showing up
Reply With Quote #6

Quote:
Originally Posted by skis View Post
Is there a way to show the message to every player so I can see if it's just sending it to the wrong player?
Change:
Code:
show_hudmessage(id, "you picked up the bomb")

To (0 = everyone)
Code:
show_hudmessage(0, "you picked up the bomb")

Last edited by Jon; 07-24-2008 at 05:53.
Jon is offline
hzqst
Senior Member
Join Date: Jul 2008
Old 07-24-2008 , 08:33   Re: hud_showmessage not showing up
Reply With Quote #7

why not using "cs_get_user_plant(index)"?
hzqst is offline
skis
Junior Member
Join Date: Jul 2008
Old 07-24-2008 , 17:26   Re: hud_showmessage not showing up
Reply With Quote #8

OK, I changed to cs_get_user_plant and here's what I've got now, along with server_prints to see what exactly is getting called:

PHP Code:
public bombpickup(id)
{
    
server_print("bombpickup called");
    new 
max get_maxplayers();
    for (new 
1<= maxi++)
    {
        
server_print("checking id %d"i);
        if (
cs_get_user_plant(i) == 1)
        {
            
server_print("match for id %d"i);
            
set_hudmessage(25500, -1.00.01);
            
show_hudmessage(0"someone picked up the bomb");
            return 
PLUGIN_CONTINUE;
        }
    }
    return 
PLUGIN_CONTINUE;

Every time the bomb is picked up, this is what happens in the server console (16 slot server):

Code:
bombpickup called
checking id 1
checking id 2
checking id 3
checking id 4
checking id 5
checking id 6
checking id 7
checking id 8
checking id 9
checking id 10
checking id 11
checking id 12
checking id 13
checking id 14
checking id 15
checking id 16
Are all my returns correct, or does anyone see anything wrong with this code?
skis is offline
Jon
Veteran Member
Join Date: Dec 2007
Old 07-25-2008 , 08:57   Re: hud_showmessage not showing up
Reply With Quote #9

"cs_get_user_plant - Returns 1 if a player can plant the bomb"

Doesn't that mean the player has to be standing on the bombsite with the C4 icon blinking red?
Jon is offline
Reply


Thread Tools
Display Modes

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 05:38.


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