Raised This Month: $ Target: $400
 0% 

[HELP] How do I loop set_task for only a few seconds.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GoldNux
Senior Member
Join Date: Mar 2018
Old 04-22-2018 , 12:08   Re: [HELP] How do I loop set_task for only a few seconds.
Reply With Quote #1

Quote:
Originally Posted by Bugsy View Post
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...
Natshehs contribution opened up the posibility to use client_print_color, before I had an issue using it.
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:
#include <cromchat> public updatePlayerEconomy() {     new players[32], playercount, player, player2, szName[32];     get_players(players, playercount, "h");     for(new i, j, CsTeams:iPTeam, iPMoney; i < playercount; i++)     {         player = players[i];                 if (CS_TEAM_T <= (iPTeam=cs_get_user_team(player)) <= CS_TEAM_CT)         {             iPMoney = cs_get_user_money(player);             get_user_name(player, szName, charsmax(szName));                         for(j = 0; j < playercount; j++)             {                 player2 = players[j];                 if (iPTeam != cs_get_user_team(player2)) continue;                 {                     if (cs_get_user_team(player2) == CS_TEAM_T && !is_user_hltv(player2) && cs_get_user_team(player2) != CS_TEAM_SPECTATOR)                     {                         if (iPMoney < 3000)                             CC_SendMessage(player2, "%s:&x07 $ %d", szName, iPMoney)                         else if (iPMoney > 3000 && iPMoney < 3500)                             CC_SendMessage(player2, "%s:&x01 $ %d", szName, iPMoney)                         else if (iPMoney > 3500 && iPMoney < 10000)                             CC_SendMessage(player2, "%s:&x04 $ %d", szName, iPMoney)                         else if (iPMoney > 10000)                             CC_SendMessage(player2, "%s:&x06 $ %d", szName, iPMoney)                     }                     else if (cs_get_user_team(player2) == CS_TEAM_CT && !is_user_hltv(player2) && cs_get_user_team(player2) != CS_TEAM_SPECTATOR)                     {                         if (iPMoney < 3250)                             CC_SendMessage(player2, "%s:&x07 $ %d", szName, iPMoney)                         else if (iPMoney > 3250 && iPMoney < 4100)                             CC_SendMessage(player2, "%s:&x01 $ %d", szName, iPMoney)                         else if (iPMoney > 4100 && iPMoney < 10000)                             CC_SendMessage(player2, "%s:&x04 $ %d", szName, iPMoney)                         else if (iPMoney > 10000)                             CC_SendMessage(player2, "%s:&x06 $ %d", szName, iPMoney)                     }                 }             }         }     } }
__________________
Try my version of de_dust2, I think it's great and you should check it out!
https://gamebanana.com/mods/83731

Last edited by GoldNux; 04-22-2018 at 12:43.
GoldNux 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 04:39.


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