[HELP] How do I loop set_task for only a few seconds.
I would like to print the players money to chat every second for 9 seconds. (freeze time)
I have tried using 9 different set tasks but I know this is not good to do, and it doesent print anything when I do this. Is there a way to loop a function during freezetime only? I want to do this so that the money stays updated when players make a purchase. Hooking an event instead does not work for this, if someone buys more then the others that player obviously prints more. I'm not sure if this will look good in the end, because I'm not sure looping set_task will make them print in the same order, but I think so. Thanks. |
Re: [HELP] How do I loop set_task for only a few seconds.
Why print the same data 9 times in chat. Wouldn't a HUD be better?
PHP Code:
|
Re: [HELP] How do I loop set_task for only a few seconds.
Quote:
I'm trying to keep my plugins in the background and have the server look as if it has not been tampered with. Thank you for helping me out! |
Re: [HELP] How do I loop set_task for only a few seconds.
Quote:
It only prints when I have a single set_task. Maybe I have to use show_hud... This is what the code look like: Code:
|
Re: [HELP] How do I loop set_task for only a few seconds.
1. Your register_event() is calling 'eventNewRound' and it should be 'FreezeTimeStart'.
2. You should call 1 set_task() in FreezeTimeStart and loop through all players within updatePlayerEconomy(). 3. Include flags in get_players() to exclude bots and hltv and remove this check in updatePlayerEconomy(). 4. Only call cs_get_user_team() once and set the value in a variable. Then do: if ( CS_TEAM_T <= iTeam <= CS_TEAM_CT ) |
Re: [HELP] How do I loop set_task for only a few seconds.
Quote:
It is working, but I can't test it with bots for some reason. Even without the "ch" flags. The idea is, that the chat can display a maximum of 5 chat messages. So while playing 5 vs 5, as long as it prints every message in the same order it will look pretty good. Very strange that my previously very similar code makes bots print it, but not this.. Oh well! Here is the code for anyone else doing something similar in the future. Thanks again @Bugsy I really appreciate it! Code:
|
Re: [HELP] How do I loop set_task for only a few seconds.
PHP Code:
|
Re: [HELP] How do I loop set_task for only a few seconds.
Quote:
I get some issues on these lines: if (CS_TEAM_T <= (iPTeam=cs_get_user_team(player)) <= CS_TEAM_CT) if (iPTeam != cs_get_user_team(player2)) continue; WARNING [36]: tag mismatch WARNING [36]: tag mismatch WARNING [36]: tag mismatch WARNING [43]: tag mismatch Not sure what is wrong. |
Re: [HELP] How do I loop set_task for only a few seconds.
Since cs_get_user_team() returns a CsTeams type, you need to define the iPTeam variable as CsTeams. You were also missing a closing bracket. Natsheh, you should avoid calling cs_get_user_team() multiple times for the same player.
I didn't look at your code beyond this, not sure if it does what you expect. Give it a try. Code:
|
Re: [HELP] How do I loop set_task for only a few seconds.
Quote:
Even when setting the "CT" and "TERRORIST" flag, it still printed to both teams. I wrote something that change the color of the money, to indicate what you can afford. It is working great, but I don't think my code is very optimized. Maybe someone can take a look? I will later combine this with the get equipment code you wrote. Anyways, here is the color chat code. I know I should store get_* in variables, but when I do I get warnings and errors. I'm obviously not doing it right. Code:
|
| All times are GMT -4. The time now is 04:39. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.