Raised This Month: $ Target: $400
 0% 

set_hudmessage,set_task and another question


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
breaddawson
Senior Member
Join Date: Jul 2004
Location: Beijing,China
Old 10-03-2004 , 10:57   set_hudmessage,set_task and another question
Reply With Quote #1

today it went serveral hours to dive into some plugins written by others

and i have a few questions

I. i began to realized that the native set_hudmessage() is frequently used
i look it up to the amxmodx.inc
and i found this

Quote:
/* Sets format for hudmessage. */
native set_hudmessage(red=200, green=100, blue=0, Float=-1.0, Float:y=0.35, effects=0, Float:fxtime=6.0, Float:holdtime=12.0, Float:fadeintime=0.1, Float:fadeouttime=0.2,channel=4);
i know the x and the y is to specify the origin of ur hudmessage
but i want to know the bounds of them
sorry for my poor english
i mean that it's a float,so it might be assignd 5.0 or -3.2 or many others
but the number assigned should be limited ,>-10 and <10 ,for instance
then,what's the limit ??

the effects ,the fxtime and the channel means what?
i mean,what can i do with them?

II.set_task is another frequently used function
and i also found some information about it

Quote:
/* Calls function on specified time.
* Flags:
* "a" - repeat.
* "b" - loop task.
* "c" - do task on time after a map timeleft.
* "d" - do task on time before a map timelimit. */
native set_task(Float:time,const function[],id = 0,parameter[]="",len = 0,flags[]="", repeat = 0);
"on specified time",it's good
i'm a little puzzled by the first parameter "Float:time"
does it show the frequncy of u given function called by set_task?
or show another thing?

and what does the "id" mean,what can i do with it?


III.what is the differences between "PLUGIN_HANDLED" and "PLUGIN_CONTINUE"??


then u see all my questions
is there someone kindly give me a hand?
thank u all~
__________________
i'm bread dawson ,a chinese boy
wish u be happy~
breaddawson is offline
Send a message via ICQ to breaddawson Send a message via MSN to breaddawson
ol
Senior Member
Join Date: Jul 2004
Old 10-03-2004 , 11:04  
Reply With Quote #2

i want to know too
ol is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 10-03-2004 , 11:25  
Reply With Quote #3

You could try playing with those values in a plugin to see their results, but anyway...

The x & y bounds I believe is 0.1 <--> 1.0 with -1.0 being Centered...

I believe the effects parameter is if you want the HUD Message to flash or not..
the fxtime would be how long the effect lasts..

The channel is different, if for example you display 2 messages at the same time on the same channel, the second message will overwrite the first message, but if you use different channels you can see them both at the same time on screen (need diff x & y values)..

The set_task() function basically executes a function after a certain amount of time which is specified by Float:time.. so if I put:
set_task( 1.5, "MyFunction", 2000 )
Then AMX will execute MyFunction() in 1.5 seconds from when I called set_task()..

The ID parameter is used to identify the actual task, so you could later do:
if( task_exists( 2000 ) )
{
// do something here..
remove_task( 2000 )
}

Lastly, the differences between PLUGIN_HANDLED & PLUGIN_CONTINUE are a little bit tricky... First of all, you only need to return one of those values if the function is called by AMX, like a forward function or a registered function..

An good example would be Hooking Chat like:
Code:
register_clcmd( "say", "HookChat" ) register_clcmd( "say_team", "HookChat" )

Now when someone chats (or team-chats) AMX will call our HookChat function, and if it looks like this:
Code:
public HookChat( id ) {     return PLUGIN_HANDLED }

Then that means you will NOT see their chat appear on the screen.. PLUGIN_HANDLED basically stops execution and tells AMX that it is done (and to stop other plugins that Hook Chat as well)

However, if it looks like this:
Code:
public HookChat( id ) {     return PLUGIN_CONTINUE }

Then you WILL see their Chat appear on screen.. PLUGIN_CONTINUE basically means that AMX should return any results by public functions and let other plugins continue also..

I hope that helps!!
xeroblood is offline
Send a message via MSN to xeroblood
breaddawson
Senior Member
Join Date: Jul 2004
Location: Beijing,China
Old 10-03-2004 , 11:46  
Reply With Quote #4

thank u very much
u really help me a lot
not only ur explain,but also ur kind heart

i found one line below in some plugin

Code:
set_task(1.0,"ejl_dice_timer",77,"",0,"a", 9999)

does it mean this?
when AMX X found this line,the time might be 11:00:00
then at 11:00:01,it will call the function "ejl_dice_timer"
the task id is 77
it pass no parameters to the function
and this task is repeated 9999 times

but if mean like this
what's the time between the first and the second call of the function?


about "PLUGIN_HANDLED"&"PLUGIN_CONTINUE"
after reading ur reply
i think it might mean this
when u write a "PLUGIN_HANDLED"
then it will do nothing but return with nothing
it leads to an end of ur function
and show nothing to u
but if u use a "PLUGIN_CONTINUE"
the affects made by this function will be shown to u
am i right??
__________________
i'm bread dawson ,a chinese boy
wish u be happy~
breaddawson is offline
Send a message via ICQ to breaddawson Send a message via MSN to breaddawson
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 10-03-2004 , 12:02  
Reply With Quote #5

Quote:
Originally Posted by breaddawson
Code:
set_task(1.0,"ejl_dice_timer",77,"",0,"a", 9999)

what's the time between the first and the second call of the function?
The repeated task will get called every 1 second (1.0)....

Quote:
Originally Posted by breaddawson
about "PLUGIN_HANDLED"&"PLUGIN_CONTINUE"
after reading ur reply
i think it might mean this
when u write a "PLUGIN_HANDLED"
then it will do nothing but return with nothing
it leads to an end of ur function
and show nothing to u
but if u use a "PLUGIN_CONTINUE"
the affects made by this function will be shown to u
am i right??
Almost.. but try not to think of it in terms of Your Plugin Only, think of it in terms of AMX & All Loaded Plugins...

If my plugin registered a command like "amx_blah", then I could return PLUGIN_HANDLED at the end, cuz no other plugin will have an "amx_blah" command, so AMX itself is done...

But, if I thought maybe another plugin might have registered that command, I would return PLUGIN_CONTINUE to let AMX execute the other plugins code as well...

Make sense??
xeroblood is offline
Send a message via MSN to xeroblood
breaddawson
Senior Member
Join Date: Jul 2004
Location: Beijing,China
Old 10-03-2004 , 12:44  
Reply With Quote #6



yes, i got it~~

i'm working hard on scripting
and i hope i can make a popular plugin

haha

say good luck to myself~~
__________________
i'm bread dawson ,a chinese boy
wish u be happy~
breaddawson is offline
Send a message via ICQ to breaddawson Send a message via MSN to breaddawson
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 00:29.


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