Raised This Month: $ Target: $400
 0% 

Compile for 0 bytes + set_task help.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 08-31-2004 , 15:07   Compile for 0 bytes + set_task help.
Reply With Quote #1

This compiles to .amx for a lovely 0 bytes. Since I'm new at this it's probably something very obvious(a PLUGIN_CONTINUE should be PLUGIN_HANDLED???), but please help me. Also, are my set_tasks doing what they are supposed to do. (Plugin is supposed to give one health a second to a player who has the boost activated.)

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

new bool:booston[32] = false

public plugin_init()
{
	register_plugin("Health Boost","0.1","twistedeuphoria")
	register_concmd("hboost","health_switch",ADMIN_IMMUNITY,"Blah-To be added later.")
	register_clcmd("hboost","health_switch",ADMIN_IMMUNITY,"Blah-To be added later.")
	set_task(.5,"check_boost",1,"b",1)
	return PLUGIN_CONTINUE
}



public health_switch(id)
{
	if(booston[id] == false)
		booston[id] = true
	if(booston[id] == true)
		booston[id] = false	
	return PLUGIN_CONTINUE
}

public check_boost()
{
	new i
	for(i=0,i<=31,i++)
	{
		if(booston[i] == true)
			set_task(1,"give_health",2,id,"b",1)
		if(booston[i] == false)
			remove_task(i,2)
	}	
	return PLUGIN_CONTINUE
}

public give_health(id)
{
	new oldhealth
	new newhealth
	oldhealth = get_user_health(id)
	newhealth = (oldhealth + 1)
	set_user_health(id,newhealth)
	return PLUGIN_CONTINUE
}
Thank you for your time.
twistedeuphoria is offline
sanaell
Senior Member
Join Date: May 2004
Location: SamutPrakarn Thailand
Old 08-31-2004 , 15:11  
Reply With Quote #2

invert tag plz and change Code to small tag
__________________
[email protected]
The Source of Pain is the Pain of Source
sanaell is offline
Send a message via MSN to sanaell
KRoT@L
Member
Join Date: Aug 2004
Location: http://www.amxmod.net
Old 08-31-2004 , 22:37  
Reply With Quote #3

Code:
#include <amxmodx> #include <amxmisc> #include <fun> new bool:booston[32] = false public plugin_init() { register_plugin("Health Boost","0.1","twistedeuphoria") register_concmd("hboost","health_switch",ADMIN_IMMUNITY,"Blah-To be added later.") register_clcmd("hboost","health_switch",ADMIN_IMMUNITY,"Blah-To be added later.") set_task(1.0,"check_boost",941,"",0,"b") return PLUGIN_CONTINUE } public health_switch(id, level, cid) {     if (!cmd_access(id,level,cid,1))         return PLUGIN_HANDLED     if(!booston[id])         booston[id] = true     else         booston[id] = false     return PLUGIN_CONTINUE } public check_boost() {       for(new i=0;i<32;i++)     {         if(booston[i])             set_user_health(i,get_user_health(i)+1)     }     return PLUGIN_CONTINUE }
KRoT@L is offline
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 08-31-2004 , 23:36  
Reply With Quote #4

What is the 941 in set_task? Just a random number? When I try to use it it give hboost:invalid command.

Wierd got it to work by taking out clcmd and changeing command name(I think).

Haha well I got mine working well and I originally just wanted a console command anyway so hey its all good for me.

I would bind it anyway so length of command isn't really an issue either.

Anyway thanks again KroT@L!
twistedeuphoria is offline
KRoT@L
Member
Join Date: Aug 2004
Location: http://www.amxmod.net
Old 08-31-2004 , 23:45  
Reply With Quote #5

Yeah random number.
I've just tried the plugin and it has worked fine.. (I've typed hboost in the console)
KRoT@L 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 17:21.


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