Raised This Month: $51 Target: $400
 12% 

Give on round start 0 money to ct ot tr


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 09-22-2008 , 15:19   Give on round start 0 money to ct ot tr
Reply With Quote #1

I need a code that on round start remove money from CT or TR(always 0 on round start), can control with cvar.
THX
xbatista is offline
Send a message via Skype™ to xbatista
PrEn1umz
Junior Member
Join Date: Feb 2007
Location: Nice, France
Old 09-22-2008 , 16:03   Re: Give on round start 0 money to ct ot tr
Reply With Quote #2

mp_startmoney 0 ?
PrEn1umz is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 09-22-2008 , 16:09   Re: Give on round start 0 money to ct ot tr
Reply With Quote #3

Try this.
amx_rsm_amount <num> - amount of money on new round (def: 0, as you requested).
PHP Code:
#include <amxmodx>
#include <cstrike>
 
new g_Toggleg_Amount;
new 
g_MaxPlayers;
 
public 
plugin_init()
{
        
register_plugin("Round Start Money""1.0.3""hleV");
 
        
g_Toggle register_cvar("amx_rsmoney""1");
        
g_Amount register_cvar("amx_rsm_amount""0");
 
        
register_event("HLTV""HLTV""a""1=0""2=0");
 
        
g_MaxPlayers get_maxplayers();
}
 
public 
HLTV()
{
        if (!
get_pcvar_num(g_Toggle))
                return;
 
        new 
Amount get_pcvar_num(g_Amount);
 
        for (new 
Client 1Client <= g_MaxPlayersClient++)
        {
                if (!
is_user_connected(Client) || !is_user_alive(Client))
                        return;
 
                if (
cs_get_user_team(Client) == CS_TEAM_T && cs_get_user_money(Client) != Amount)) // Or CS_TEAM_CT
                        
cs_set_user_money(ClientAmount));
        }

__________________

Last edited by hleV; 09-23-2008 at 07:41. Reason: Fixed.
hleV is offline
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 09-23-2008 , 02:11   Re: Give on round start 0 money to ct ot tr
Reply With Quote #4

Code:
public HLTV() {         if (!get_pcvar_num(g_Toggle))                 return;           for (new Client = 1; Client <= g_MaxPlayers; Client++)         {
                new CsTeams:Team = cs_get_user_team(Client);
                  if (Team == CS_TEAM_T && cs_get_user_money(Client) != get_pcvar_num(g_Amount)) // Or CS_TEAM_CT                         cs_set_user_money(Client, get_pcvar_num(g_Amount));         } }
Don't create a new variable in a loop.
__________________
atomen is offline
Send a message via MSN to atomen
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 09-23-2008 , 05:58   Re: Give on round start 0 money to ct ot tr
Reply With Quote #5

OK thx,I'm now in school ,when I get home will check ;)
xbatista is offline
Send a message via Skype™ to xbatista
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 09-23-2008 , 07:26   Re: Give on round start 0 money to ct ot tr
Reply With Quote #6

PHP Code:
#include <amxmodx>
#include <cstrike>
 
new g_Toggleg_Amount;
new 
g_MaxPlayers;
 
public 
plugin_init()
{
        
register_plugin("Round Start Money""1.0.1""hleV");
 
        
g_Toggle register_cvar("amx_rsmoney""1");
        
g_Amount register_cvar("amx_rsm_amount""0");
 
        
register_event("HLTV""HLTV""a""1=0""2=0");
 
        
g_MaxPlayers get_maxplayers();
}
 
public 
HLTV()
{
        if (!
get_pcvar_num(g_Toggle))
                return;
 
        for (new 
Client 1Client <= g_MaxPlayersClient++)
        {
                new 
CsTeams:Team cs_get_user_team(Client);
 
                if (
Team == CS_TEAM_T && cs_get_user_money(Client) != get_pcvar_num(g_Amount)) // Or CS_TEAM_CT
                        
cs_set_user_money(Clientget_pcvar_num(g_Amount));
        }

You should optimize this:

PHP Code:
#include <amxmodx>
#include <cstrike>
 
new g_Toggleg_Amount;
new 
g_MaxPlayers;
 
public 
plugin_init()
{
        
register_plugin("Round Start Money""1.0.1""hleV");
 
        
g_Toggle register_cvar("amx_rsmoney""1");
        
g_Amount register_cvar("amx_rsm_amount""0");
 
        
register_event("HLTV""HLTV""a""1=0""2=0");
 
        
g_MaxPlayers get_maxplayers();
}
 
public 
HLTV()
{
        if (!
get_pcvar_num(g_Toggle))
                return;
 
        new 
amount get_pcvar_num(g_Amount);
        for (new 
Client 1Client <= g_MaxPlayersClient++)
        {
                if( !
is_user_connected(Client// you didnt check if client was in server
                
|| cs_get_user_team(Client) != CS_TEAM_T )
                {
                    continue;
                }
                
                
cs_set_user_money(Clientamount);
        }

__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 09-23-2008 , 08:49   Re: Give on round start 0 money to ct ot tr
Reply With Quote #7

YEP. It works
And can you add and when 1-st round start?

Last edited by xbatista; 09-23-2008 at 09:03.
xbatista is offline
Send a message via Skype™ to xbatista
zwfgdlc
Senior Member
Join Date: May 2006
Old 09-23-2008 , 09:22   Re: Give on round start 0 money to ct ot tr
Reply With Quote #8

one thing to keep in mind is if the player spawn after at round start?
for example player shortly after at round start retry.
zwfgdlc is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 09-23-2008 , 09:35   Re: Give on round start 0 money to ct ot tr
Reply With Quote #9

Ohh NVM ;) but thx
xbatista is offline
Send a message via Skype™ to xbatista
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 22:17.


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