Raised This Month: $ Target: $400
 0% 

Hud message problems.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GarbageBox
Senior Member
Join Date: Feb 2010
Old 08-15-2010 , 11:28   Hud message problems.
Reply With Quote #1

When I test it, it does not show any hud message.
I just want to show the info of the dead player who looking for an alive player.
Here is my code, can someone fix?
Code:
#include <amxmodx>
#include <amxmisc>
#include <csx>
#include <cstrike>
#include <csstats>
#include <geoip>

#define PLUGIN_NAME "Dead Hud Message"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "WS.Chu"
new SzAddCmd[] = "amx_pausecfg add ^"%s^""

public plugin_init()
{
	register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
	register_event("HLTV", "new_round", "a", "1=0", "2=0")
	register_event("TextMsg", "restart_round", "a", "2=#Game_will_restart_in")
	set_task(1.0, "DHM",0,"",0,"b")
	return PLUGIN_CONTINUE
}

public plugin_cfg()
{
	// Put here titles of plugins which you don't want to pause
	server_cmd(SzAddCmd, "Dead Hud Message")
}

public DHM(id)
{
		new SzHostname[64], SzTimer[32] // Get Hostname & Time
		get_cvar_string("Hostname",SzHostname,63) // Get Hostname
		get_time("%Y/%m/%d - %H:%M:%S", SzTimer,31) // Get Time
		
		new SzName[128] // Get Player Name
		get_user_name(id, SzName, 127) // Get Player Name
		
		new SzAuthID[32] // Get STEAMID
		get_user_authid(id, SzAuthID, 32) // Get STEAMID
		
		new SzScores = (get_user_frags(id) - cs_get_user_deaths(id)) // Get Player Scores
		
		new mOsef[8], SzRank // Get Player Rank
		SzRank = get_user_stats(id, mOsef, mOsef) // Get Player Rank
		
		new SzIP[16] // Get Player IP
		static SzCountry[32] // Get Player Country
		get_user_ip(id, SzIP, 15, 1) // Get Player IP
		geoip_country(SzIP, SzCountry, 45) // Get Player Country By Using The IP
		
		set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.05, 0.60, 2, 1.0, 1.0, 0.1, 0.2, -1) 
		show_hudmessage(Player,"%s^nTime: %s^nPlayer Name: %s^nID: %s^n分數: %d^nRank: %i / %i^nCountry: %s", SzHostname, SzTimer, SzName, SzAuthID, SzScores, SzRank, get_statsnum(), SzCountry) 
}
__________________
You can be a SUPER coder but you Haven't to say such as "stupid, etc." words to the others
GarbageBox is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-15-2010 , 11:45   Re: Hud message problems.
Reply With Quote #2

The player's id can not appear by magic from such task. You have to loop through all players.
__________________
Arkshine is offline
GarbageBox
Senior Member
Join Date: Feb 2010
Old 08-15-2010 , 22:33   Re: Hud message problems.
Reply With Quote #3

How can I correct it?
I`m a code newbie...
__________________
You can be a SUPER coder but you Haven't to say such as "stupid, etc." words to the others
GarbageBox is offline
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 08-15-2010 , 23:08   Re: Hud message problems.
Reply With Quote #4

Quote:
Originally Posted by Arkshine View Post
You have to loop through all players.
RedRobster is offline
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 08-15-2010 , 23:24   Re: Hud message problems.
Reply With Quote #5

Quote:
Originally Posted by RedRobster View Post
Quote:
Originally Posted by Arkshine View Post
You have to loop through all players.
Quote:
Originally Posted by GarbageBox View Post
I`m a code newbie...
PHP Code:
new maxplayers get_maxplayers()
for (new 
1i<= maxplayersi++) {
         
//Here your stuff
         //i var, represents the player id


Last edited by Mxnn; 08-15-2010 at 23:43.
Mxnn is offline
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 08-15-2010 , 23:32   Re: Hud message problems.
Reply With Quote #6

And you are showing him wrong.
If you are going to do it that way, create "maxplayers" as a global variable and get the value in plugin_init() since that will not change during that map.

Also, you must do:
PHP Code:
for(new 1<= maxplayersi++)
{
        
//Your stuff

0 is the server id.

Last edited by RedRobster; 08-16-2010 at 00:07. Reason: Dammit DG :P
RedRobster is offline
GarbageBox
Senior Member
Join Date: Feb 2010
Old 08-16-2010 , 01:16   Re: Hud message problems.
Reply With Quote #7

Here is the code what I have edited.
But still nothing show, something wrong?
Code:
#include <amxmodx>
#include <amxmisc>
#include <csx>
#include <cstrike>
#include <csstats>
#include <geoip>

#define PLUGIN_NAME "Dead Hud Message"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "WS.Chu"
new SzAddCmd[] = "amx_pausecfg add ^"%s^""
new MaxPlayers

public plugin_init()
{
	register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
	register_event("HLTV", "new_round", "a", "1=0", "2=0")
	register_event("TextMsg", "restart_round", "a", "2=#Game_will_restart_in")
	MaxPlayers = get_maxplayers()
	set_task(1.0, "DHM",0,"",0,"b")
	return PLUGIN_CONTINUE
}

public plugin_cfg()
{
	// Put here titles of plugins which you don't want to pause
	server_cmd(SzAddCmd, "Dead Hud Message")
}

public DHM(id)
{
	for (new i = 1; i <= SzMaxPlayers; i++)
	{
		new SzHostname[64], SzTimer[32] // Get Hostname & Time
		get_cvar_string("Hostname",SzHostname,63) // Get Hostname
		get_time("%Y/%m/%d - %H:%M:%S", SzTimer,31) // Get Time
		
		new SzName[128] // Get Player Name
		get_user_name(id, SzName, 127) // Get Player Name
		
		new SzAuthID[32] // Get STEAMID
		get_user_authid(id, SzAuthID, 32) // Get STEAMID
		
		new SzScores = (get_user_frags(id) - cs_get_user_deaths(id)) // Get Player Scores
		
		new mOsef[8], SzRank // Get Player Rank
		SzRank = get_user_stats(id, mOsef, mOsef) // Get Player Rank
		
		new SzIP[16] // Get Player IP
		static SzCountry[32] // Get Player Country
		get_user_ip(id, SzIP, 15, 1) // Get Player IP
		geoip_country(SzIP, SzCountry, 45) // Get Player Country By Using The IP
		
		set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.05, 0.60, 2, 1.0, 1.0, 0.1, 0.2, -1) 
		show_hudmessage(MaxPlayers, "%s^nTime: %s^nPlayer Name: %s^nID: %s^n分數: %d^nRank: %i / %i^nCountry: %s", SzHostname, SzTimer, SzName, SzAuthID, SzScores, SzRank, get_statsnum(), SzCountry) 
	}
}
__________________
You can be a SUPER coder but you Haven't to say such as "stupid, etc." words to the others
GarbageBox 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 22:00.


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