set_hudmessage,set_task and another question
today it went serveral hours to dive into some plugins written by others
:shock: 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:
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:
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 want to know too
|
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:
Now when someone chats (or team-chats) AMX will call our HookChat function, and if it looks like this: Code:
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:
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!! |
:) 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:
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?? |
Quote:
Quote:
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?? |
:wink:
yes, i got it~~ :) i'm working hard on scripting and i hope i can make a popular plugin :roll: haha say good luck to myself~~ |
| All times are GMT -4. The time now is 17:15. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.