Raised This Month: $ Target: $400
 0% 

[Help] Change Team score values


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
jppmarujo
Junior Member
Join Date: Nov 2011
Location: Portugal
Old 11-30-2011 , 14:57   [Help] Change Team score values
Reply With Quote #1

Hey there guys.

So, i pick this structure up, and i am trying to edit it, but keep it simple, because i'm learning how to script in Pawn and C, and i want to be able to fully understand the source code and what's the function of every piece.

So, this piece of code is supposed to make teams play 15 rounds (in total : for example CT: 8 and T: 7) and then swap them.

But, what's happening is that the values don't change. So, if i play for the Counter-Terrorist team in the first half, and i win 14 rounds and the Terrorists team only 1, what happens is that when teams swap i am in disavantadge, because the score don't swap to. So, i'm looking in the cstrike func wiki, and can't find a way to swap the scores when teams swap places.

PHP Code:
#include <amxmodx>
#include <cstrike>

new enablehalf_roundsrounds_count

public plugin_init() 
{
    
register_plugin("Auto Swap Teams""0.1""#Kz.Tw | nobody")
    
half_rounds register_cvar("amx_half_rounds","15")
    
enable register_cvar("swap_teams""1")
    
register_event("HLTV""event_round_start""a""1=0""2=0")
    
register_event("TextMsg""Event_TextMsg""a""2&#Game_C")
}

public 
event_round_start()
{
    if(
get_pcvar_num(enable))
    {
        
rounds_count++
        if(
rounds_count == get_pcvar_num(half_rounds))
            
swap_teams()
    }
}

public 
Event_TextMsg()
    
rounds_count 0

public swap_teams()
{
    new 
CT[32],T[32]
    new 
chCTchT
    
new tround
    
    client_print
(0,print_chat,"* [AST] Switching Teams ")
    
get_players(CT,chCT,"e","CT")
    
get_players(T,chT,"e","TERRORIST")

    for(new 
0chCTi++)
    {
        
cs_set_user_team(CT[i], CS_TEAM_T)

        
client_print(CT[i],print_chat,"* [AST] You're Team is CT now")
    }

    for(new 
0chTi++)
    {
        
cs_set_user_team(T[i], CS_TEAM_CT)
        
        
client_print(T[i], print_chat"* [AST] You're Team is T now")
    }

What i did was to put in my server.cfg win_limit 16 . So, if i reset rounds when teams swap instead of swaping the scores too, the scores stay stored? Meaning:

I am terrorist and i win the first half: 14 - 1;

When teams are swaped, scores are resetted to : 0 - 0;

When i am in CT (the second half), would it take only two rounds to win?

Sorry if this is confusing, and thanks for your help in advance.
</span></span>

Last edited by jppmarujo; 11-30-2011 at 14:58.
jppmarujo is offline
 



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 08:24.


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