Raised This Month: $ Target: $400
 0% 

Can't figure this out


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Razor
New Member
Join Date: Aug 2004
Old 09-01-2004 , 15:03   Can't figure this out
Reply With Quote #1

I seem to be having some difficulty with my code, i've tested it with many different methods, and yet still it doesn't work. All i'd like for it to do is speak Danger.wav when hp is below 20. Take a look at the following code

Code:
#include <amxmodx>
#include <fun>

#define MAX_PLAYERS 32


public plugin_init() {
	 register_plugin("Environment Status","0.1","Lloyd Banks")
	 set_task(1.0,"check_status")
}


public check_status(id)
{
	new iPlayer 
	new iPlayers[MAX_PLAYERS]
	new iNumPlayers
	get_players(iPlayers,iNumPlayers)
	if (get_user_health(iPlayer) < 20)
		{ 
			new name[33]
			get_user_name(0, name, 32)
			client_print(id, print_chat, "Careful %s, Your hp is low!", name)
			client_cmd(id, "spk fvox/danger.wav")
		}
	
    
}
Anybody see something I don't ?
__________________
69.90.156.137:27015 2fort 24/7 Killing Fieldz
Love it or leave it
Razor is offline
Razor
New Member
Join Date: Aug 2004
Old 09-01-2004 , 15:44  
Reply With Quote #2

Also I seem to have posted a glitch on the
Code:
set_task(1.0,"check_status")
I've corrected and compiled that as
Code:
set_task(1.0,"check_status",846,"",0,"b")
Now i've compiled it as this, but when run in the server, every second it speaks fvox/danger.wav, I do not want it to do this, I want it to do this whenever the hp is BELOW 20. [/code]
__________________
69.90.156.137:27015 2fort 24/7 Killing Fieldz
Love it or leave it
Razor is offline
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 09-01-2004 , 15:56  
Reply With Quote #3

Code:
public check_status() {    new players[32],inum    get_players(players,inum)    for(new x = 0; x < inum; x++)    {       if (get_user_health(players[x]) < 20)       {          new name[33]          get_user_name(players[x], name, 32)          client_print(players[x], print_chat, "Careful %s, Your hp is low!", name)          client_cmd(players[x], "spk fvox/danger.wav")       }    } }
Freecode is offline
Razor
New Member
Join Date: Aug 2004
Old 09-02-2004 , 15:08  
Reply With Quote #4

Thank you Freecode, that works beautifully, I also have 1 more problem I come across when I'm trying to use set_task to time certain events.
In the following code, I'm trying to make a 2 second interval between functions :

Code:
#include <amxmodx> #include <fun> #define MAX_PLAYERS 32 //will be used later on public plugin_init() {      register_plugin("Environment Status","1.10","Lloyd Banks")      //register_event("Damage","event_damage","b") // Used in another part of script      set_task(12.0,"event_damage",846,"",0,"b")        register_event("DeathMsg","event_death","b") } public event_death(id) {     client_cmd(id, "spk fvox/beep.wav")     set_task(2.0,"do_beep2",849,"",0,"b")     return PLUGIN_CONTINUE } public do_beep2(id) {     client_cmd(id, "spk fvox/beep.wav")     set_task(2.0,"do_beep3",850,"",0,"b")     return PLUGIN_CONTINUE } public do_beep3(id) {     client_cmd(id, "spk fvox/beep.wav")     set_task(2.0,"do_flatline",851,"",0,"b")     return PLUGIN_CONTINUE } public do_flatline(id) {     client_cmd(id, "spk fvox/flatline.wav")     return PLUGIN_HANDLED }

I believe thats supposed to work, but whenever I've been killed, no sound is played. This is one problem that has plagued me for a while as well. Have any solutions?
__________________
69.90.156.137:27015 2fort 24/7 Killing Fieldz
Love it or leave it
Razor 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 17:13.


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