Raised This Month: $32 Target: $400
 8% 

Check for winning team


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sanjay Singh
Veteran Member
Join Date: Sep 2016
Old 12-01-2019 , 13:04   Check for winning team
Reply With Quote #1

I want to check for winning team and reward that team players with XP.
First Team or Second Team.

Help
ty.
Attached Files
File Type: sma Get Plugin or Get Source (pub_war_nothing.sma - 166 views - 71.3 KB)
__________________

Last edited by Sanjay Singh; 12-01-2019 at 14:48.
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 12-01-2019 , 13:33   Re: Check for winning team
Reply With Quote #2

And what's your problem?
redivcram is offline
Sanjay Singh
Veteran Member
Join Date: Sep 2016
Old 12-01-2019 , 13:49   Re: Check for winning team
Reply With Quote #3

Quote:
Originally Posted by redivcram View Post
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.
__________________

Last edited by Sanjay Singh; 12-01-2019 at 14:46.
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh
Sanjay Singh
Veteran Member
Join Date: Sep 2016
Old 12-01-2019 , 22:58   Re: Check for winning team
Reply With Quote #4

Bump
__________________
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh
instinctpt1
Senior Member
Join Date: Dec 2016
Location: Chandigarh, India
Old 12-02-2019 , 13:37   Re: Check for winning team
Reply With Quote #5

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!

Last edited by instinctpt1; 12-02-2019 at 13:44.
instinctpt1 is offline
Sanjay Singh
Veteran Member
Join Date: Sep 2016
Old 12-02-2019 , 13:48   Re: Check for winning team
Reply With Quote #6

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 View Post
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 is offline
Send a message via AIM to Sanjay Singh
instinctpt1
Senior Member
Join Date: Dec 2016
Location: Chandigarh, India
Old 12-02-2019 , 13:59   Re: Check for winning team
Reply With Quote #7

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")
            
        } 

Last edited by instinctpt1; 12-02-2019 at 14:00.
instinctpt1 is offline
Sanjay Singh
Veteran Member
Join Date: Sep 2016
Old 12-02-2019 , 14:05   Re: Check for winning team
Reply With Quote #8

Ok but i want to show msg to lost team too in that case?
__________________

Last edited by Sanjay Singh; 12-03-2019 at 01:47.
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh
Sanjay Singh
Veteran Member
Join Date: Sep 2016
Old 12-03-2019 , 01:47   Re: Check for winning team
Reply With Quote #9

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");
            }
        } 
__________________

Last edited by Sanjay Singh; 12-04-2019 at 09:26.
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh
ZaX
Senior Member
Join Date: Jan 2015
Old 12-03-2019 , 03:47   Re: Check for winning team
Reply With Quote #10

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

Also check comment #10

Last edited by ZaX; 12-03-2019 at 03:49.
ZaX is offline
Reply


Thread Tools
Display Modes

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:09.


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