AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Check for winning team (https://forums.alliedmods.net/showthread.php?t=320026)

Sanjay Singh 12-01-2019 14:04

Check for winning team
 
1 Attachment(s)
I want to check for winning team and reward that team players with XP.
First Team or Second Team.

Help
ty.

redivcram 12-01-2019 14:33

Re: Check for winning team
 
And what's your problem?

Sanjay Singh 12-01-2019 14:49

Re: Check for winning team
 
Quote:

Originally Posted by redivcram (Post 2675246)
And what's your problem?

Unable to find which team won. first or second team after 16 score and get their team players in loop n reward them with xp.

Sanjay Singh 12-01-2019 23:58

Re: Check for winning team
 
Bump

instinctpt1 12-02-2019 14:37

Re: Check for winning team
 
Add additional (CS)TeamCheck in both these if blocks, get captains team accordingly and then do whatever u want with those team players

PHP Code:

if(ScoreFtrstTeam >= 16)
        {
            
//Change description of the game.
            
            
new GameDescBuffer[32]
            
formatex(GameDescBuffer,charsmax(GameDescBuffer),"GG! %d To %d",ScoreFtrstTeam,ScoreScondteam)

            
// set_task(8.0,"StartSongForAll")

            
set_cvar_string("amx_warname",GameDescBuffer)
            
            
server_cmd("mp_freezetime 99999");
            
set_task(7.0,"FirstTeamWinnerMessage")
            
        }

        if(
ScoreScondteam >= 16)
        {   

            new 
GameDescBuffer[32]
            
formatex(GameDescBuffer,charsmax(GameDescBuffer),"GG! %d To %d",ScoreScondteam,ScoreFtrstTeam)
            
set_cvar_string("amx_warname",GameDescBuffer)

            
            
server_cmd("mp_freezetime 99999");
            
set_task(7.0,"SecondTeamWinnerMessage"
        } 

Example if 1st IF block is running.. now we know FirstTeam is winning
Now check for { FistCaptainTeamName } ,it will be 1 or 2 acc to given code
Now if its 1 ... u knw WinningTeam is terrorists, get all T players else others :)

Correct section for this is SCRIPTING HELP!

Sanjay Singh 12-02-2019 14:48

Re: Check for winning team
 
like this?
PHP Code:

if(ScoreFtrstTeam >= 16)
{
    
//Change description of the game.
    
    
new GameDescBuffer[32]
    
formatex(GameDescBuffer,charsmax(GameDescBuffer),"GG! %d To %d",ScoreFtrstTeam,ScoreScondteam)

    
// set_task(8.0,"StartSongForAll")

    
set_cvar_string("amx_warname",GameDescBuffer)
    
    
server_cmd("mp_freezetime 99999");
    
set_task(7.0,"FirstTeamWinnerMessage")

    
//Check
    
new players[32], num
    get_players
(playersnum,"h")

    new 
player
    
for(new 0numi++)
    {
        
player players[i]
        if(
FirstCaptainTeamName == && get_user_team(player) == 1)
        {
            
//Your Team T WON
        
}
        else if(
get_user_team(player) == 2)
        {
            
//Your Team CT Lost
        
}
    }
    
}

if(
ScoreScondteam >= 16)
{   

    new 
GameDescBuffer[32]
    
formatex(GameDescBuffer,charsmax(GameDescBuffer),"GG! %d To %d",ScoreScondteam,ScoreFtrstTeam)
    
set_cvar_string("amx_warname",GameDescBuffer)

    
    
server_cmd("mp_freezetime 99999");
    
set_task(7.0,"SecondTeamWinnerMessage"

    
//Check
    
new players[32], num
    get_players
(playersnum,"h")

    new 
player
    
for(new 0numi++)
    {
        
player players[i]
        if(
FirstCaptainTeamName == && get_user_team(player) == 2)
        {
            
//Your Team CT WON
        
}
        else if(
get_user_team(player) == 1)
        {
            
//Your Team T Lost
        
}
    }



Quote:

Originally Posted by instinctpt1 (Post 2675400)
Add additional (CS)TeamCheck in both these if blocks, get captains team accordingly and then do whatever u want with those team players

PHP Code:

if(ScoreFtrstTeam >= 16)
        {
            
//Change description of the game.
            
            
new GameDescBuffer[32]
            
formatex(GameDescBuffer,charsmax(GameDescBuffer),"GG! %d To %d",ScoreFtrstTeam,ScoreScondteam)

            
// set_task(8.0,"StartSongForAll")

            
set_cvar_string("amx_warname",GameDescBuffer)
            
            
server_cmd("mp_freezetime 99999");
            
set_task(7.0,"FirstTeamWinnerMessage")
            
        }

        if(
ScoreScondteam >= 16)
        {   

            new 
GameDescBuffer[32]
            
formatex(GameDescBuffer,charsmax(GameDescBuffer),"GG! %d To %d",ScoreScondteam,ScoreFtrstTeam)
            
set_cvar_string("amx_warname",GameDescBuffer)

            
            
server_cmd("mp_freezetime 99999");
            
set_task(7.0,"SecondTeamWinnerMessage"
        } 

Example if 1st IF block is running.. now we know FirstTeam is winning
Now check for { FistCaptainTeamName } ,it will be 1 or 2 acc to given code
Now if its 1 ... u knw WinningTeam is terrorists, get all T players else others :)

Correct section for this is SCRIPTING HELP!


instinctpt1 12-02-2019 14:59

Re: Check for winning team
 
Something like this ( in both IF statements) :
PHP Code:

if(ScoreFtrstTeam >= 16)
        {
            
//Change description of the game.
            
            
new GameDescBuffer[32]
            
formatex(GameDescBuffer,charsmax(GameDescBuffer),"GG! %d To %d",ScoreFtrstTeam,ScoreScondteam)

            
// set_task(8.0,"StartSongForAll")
            
new players[32], num
            FirstCaptainTeamName 
== get_players(players,num"ae""T") : get_players(playersnum"ae""CT")
            for(new 
0numi++)
            {
                
// you are winning
            
}

            
set_cvar_string("amx_warname",GameDescBuffer)
            
            
server_cmd("mp_freezetime 99999");
            
set_task(7.0,"FirstTeamWinnerMessage")
            
        } 


Sanjay Singh 12-02-2019 15:05

Re: Check for winning team
 
Ok but i want to show msg to lost team too in that case?

Sanjay Singh 12-03-2019 02:47

Re: Check for winning team
 
Tested & this isnt working. Added in both ifs.

Code used to test
PHP Code:

if(ScoreFtrstTeam >= 16)
        {
            
//Change description of the game.
            
            
new GameDescBuffer[32]
            
formatex(GameDescBuffer,charsmax(GameDescBuffer),"GG! %d To %d",ScoreFtrstTeam,ScoreScondteam)
            
            
server_cmd("mp_freezetime 99999");
            
set_task(7.0,"FirstTeamWinnerMessage")
            
            new 
players[32], numiPlayer
            FirstCaptainTeamName 
== get_players(players,num"ae""T") : get_players(playersnum"ae""CT")
            for(new 
0numi++)
            {
                
iPlayer players[i];
                
client_print_color(iPlayer, -1"Debug: Your Team WON");
            }    
        }

        if(
ScoreScondteam >= 16)
        {   
            new 
GameDescBuffer[32]
            
formatex(GameDescBuffer,charsmax(GameDescBuffer),"GG! %d To %d",ScoreScondteam,ScoreFtrstTeam)
            
            
server_cmd("mp_freezetime 99999");
            
set_task(7.0,"SecondTeamWinnerMessage")

            new 
players[32], numiPlayer
            FirstCaptainTeamName 
== get_players(players,num"ae""T") : get_players(playersnum"ae""CT")
            for(new 
0numi++)
            {
                
iPlayer players[i];
                
client_print_color(iPlayer, -1"Debug: Your Team WON");
            }
        } 


ZaX 12-03-2019 04:47

Re: Check for winning team
 
Check this thread it might help you
https://forums.alliedmods.net/showthread.php?t=286591

Also check comment #10


All times are GMT -4. The time now is 09:01.

Powered by vBulletin®
Copyright ©2000 - 2020, vBulletin Solutions, Inc.