Raised This Month: $ Target: $400
 0% 

set_hudmessage connected with set_task


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LynX
Veteran Member
Join Date: Oct 2004
Old 03-28-2005 , 16:31   set_hudmessage connected with set_task
Reply With Quote #1

Well, I would like to do this thing. When I set task, I want that hudmessage appears as long as task is running. But, there should be a counter which counts like 15,14,13...3,2,1 untill task finished. How can I do this?
Code is below, alter it please:

Code:
#include <amxmodx> #include <fun> public plugin_init() { register_plugin("Hudmessage with task","dunno","LynX") register_clcmd("hudmessage","hudmessage1") return PLUGIN_HANDLED } public hudmessage1(id) { //I will put some stuff here later set_hudmessage(200,0,0, 0.03, 0.76, 2, 0.02, 1.0, 0.01, 0.1, 2) show_hudmessage(id,"Task finishes in <countdownthinghere> ") set_task(15, "hudmessage2",id) return PLUGIN_HANDLED } public hudmessage2(id) { //I will remove stuff here return PLUGIN_HANDLED }

Thanks.

LynX
__________________
Current plugin : SoulPunisher anti-cheat
Percentage done : {||--------} 20%

If you think v3x is a PIMP, paste this into your sig!

If you think Bailopan is DA BOMB, paste this into your sig
LynX is offline
Send a message via ICQ to LynX
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-28-2005 , 16:46  
Reply With Quote #2

Make a time variable, set it so that each time the task it looped it decreases it by 1.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 03-28-2005 , 16:58  
Reply With Quote #3

You could set the hudmessage holdtime to a value like 1, and call the hudmessage to display every second until you are done. Then it would only appear until the task ends.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
LynX
Veteran Member
Join Date: Oct 2004
Old 03-28-2005 , 17:01  
Reply With Quote #4

You mean:

Code:
#include <amxmodx> #include <fun> new timer public plugin_init() { register_plugin("Hudmessage with task","dunno","LynX") register_clcmd("hudmessage","hudmessage1") return PLUGIN_HANDLED } public hudmessage1(id) { //I will put some stuff here later set_hudmessage(200,0,0, 0.03, 0.76, 2, 0.02, 1.0, 0.01, 0.1, 2) show_hudmessage(id,"Task finishes in d% time ", timer - 1) set_task(15, "hudmessage2",id) return PLUGIN_HANDLED } public hudmessage2(id) { //I will remove stuff here return PLUGIN_HANDLED }

[ edit ]

I know this above probably won't work, but can some1 show me a code snippet?
__________________
Current plugin : SoulPunisher anti-cheat
Percentage done : {||--------} 20%

If you think v3x is a PIMP, paste this into your sig!

If you think Bailopan is DA BOMB, paste this into your sig
LynX is offline
Send a message via ICQ to LynX
FeuerSturm
AlliedModders Donor
Join Date: Apr 2004
Old 03-28-2005 , 17:43  
Reply With Quote #5

Code:
public hudmessage(id){     if(timer > 0){         set_hudmessage(200,0,0, 0.03, 0.76, 2, 0.02, 1.0, 0.01, 0.1, 2)         show_hudmessage(id,"Task finishes in %d seconds",timer)         timer--         set_task(1.0,"hudmessage",id)         return PLUGIN_HANDLED     }     return PLUGIN_HANDLED }
FeuerSturm is offline
LynX
Veteran Member
Join Date: Oct 2004
Old 03-28-2005 , 17:47  
Reply With Quote #6

So, this above will work if I just put it into code, right?
__________________
Current plugin : SoulPunisher anti-cheat
Percentage done : {||--------} 20%

If you think v3x is a PIMP, paste this into your sig!

If you think Bailopan is DA BOMB, paste this into your sig
LynX is offline
Send a message via ICQ to LynX
FeuerSturm
AlliedModders Donor
Join Date: Apr 2004
Old 03-28-2005 , 17:56  
Reply With Quote #7

no, because you're not setting a value to "timer" anywhere
FeuerSturm is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-28-2005 , 17:57  
Reply With Quote #8

Quote:
Originally Posted by LynX
So, this above will work if I just put it into code, right?
He eliminated the need for a second function..

So just take out your hudmessage() functions, and replace them with the above code that he's provided. Remember to change the command. ;)
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
LynX
Veteran Member
Join Date: Oct 2004
Old 03-28-2005 , 18:24  
Reply With Quote #9

Argh, I'm now confused... Can some1 show me the whole plugin code, without having thrashing head into monitor? ^^

If nobody won't - won't that function just loop itself? And when it runs out nothing will happen? I gotta remove some stuff too in next function!
__________________
Current plugin : SoulPunisher anti-cheat
Percentage done : {||--------} 20%

If you think v3x is a PIMP, paste this into your sig!

If you think Bailopan is DA BOMB, paste this into your sig
LynX is offline
Send a message via ICQ to LynX
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-28-2005 , 18:30  
Reply With Quote #10

Code:
#include <amxmodx> #include <fun> new timer = 15 public plugin_init() {     register_plugin("Hudmessage with task","dunno","LynX")     register_clcmd("hudmessage","hudmessage") } public hudmessage(id) {     if(timer > 0){         set_hudmessage(200,0,0, 0.03, 0.76, 2, 0.02, 1.0, 0.01, 0.1, 2)         show_hudmessage(id,"Task finishes in %d seconds",timer)         timer--         set_task(1.0,"hudmessage",id)         return PLUGIN_HANDLED     }     return PLUGIN_HANDLED }
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x 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 09:51.


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