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

Solved [CSGO] Random point instead of round draw


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Spyrek
Senior Member
Join Date: Jun 2009
Old 08-08-2018 , 06:31   [CSGO] Random point instead of round draw
Reply With Quote #1

Hello,
how can I force win of random team?

PHP Code:
public Action CS_OnTerminateRound(floatdelayCSRoundEndReasonreason)
{
    if(
reason == CSRoundEnd_Draw)
    {
        
// random point to one team
    
}

    return 
Plugin_Continue;


Last edited by Spyrek; 08-08-2018 at 09:02.
Spyrek is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 08-08-2018 , 08:46   Re: [CSGO] Random point instead of round draw
Reply With Quote #2

Quote:
Originally Posted by Spyrek View Post
Hello,
how can I force win of random team?

PHP Code:
public Action CS_OnTerminateRound(floatdelayCSRoundEndReasonreason)
{
    if(
reason == CSRoundEnd_Draw)
    {
        
// random point to one team
    
}

    return 
Plugin_Continue;

Code:
public Action CS_OnTerminateRound(float& delay, CSRoundEndReason& reason)
{
    if(reason == CSRoundEnd_Draw)
    {
        if(GetRandomInt(0, 1) == 1)
            reason = CSRoundEnd_CTWin;
        else
            reason = CSRoundEnd_TerroristWin;

        // random point to one team
        // Feel free to write in PrintToChatAll here that a random team was assigned the win.

        return Plugin_Changed;
    }

    return Plugin_Continue;
}
[/QUOTE]
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
Spyrek
Senior Member
Join Date: Jun 2009
Old 08-08-2018 , 09:01   Re: [CSGO] Random point instead of round draw
Reply With Quote #3

Quote:
Originally Posted by eyal282 View Post
Code:
public Action CS_OnTerminateRound(float& delay, CSRoundEndReason& reason)
{
    if(reason == CSRoundEnd_Draw)
    {
        if(GetRandomInt(0, 1) == 1)
            reason = CSRoundEnd_CTWin;
        else
            reason = CSRoundEnd_TerroristWin;

        // random point to one team
        // Feel free to write in PrintToChatAll here that a random team was assigned the win.

        return Plugin_Changed;
    }

    return Plugin_Continue;
}
Thanks
Spyrek is offline
Spyrek
Senior Member
Join Date: Jun 2009
Old 08-10-2018 , 07:47   Re: [CSGO] Random point instead of round draw
Reply With Quote #4

It works, but... game doesn't add point to the winning team.
So I found workaround:
PHP Code:
public void OnPluginStart()
{    
    
HookEvent("round_start"Event_RoundStart);
}

public 
Action Event_RoundStart(Handle event, const char[] namebool dontBroadcast)
{    
    
int winner GetRandomInt(23);
    
ServerCommand("mp_default_team_winner_no_objective %d"winner);
    
    return 
Plugin_Continue;

But maybe there is better solution?
Spyrek is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 08-10-2018 , 08:30   Re: [CSGO] Random point instead of round draw
Reply With Quote #5

PHP Code:

ConVar mp_default_team_winner_no_objective
;

public 
void OnPluginStart()
{    
    
HookEvent("round_start"Event_RoundStart);
    
mp_default_team_winner_no_objective FindConVar("mp_default_team_winner_no_objective");
}

public 
Action Event_RoundStart(Handle event, const char[] namebool dontBroadcast)
{    
    
mp_default_team_winner_no_objective.SetInt(GetRandomInt(23));

__________________
Ilusion9 is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 08-11-2018 , 18:28   Re: [CSGO] Random point instead of round draw
Reply With Quote #6

Quote:
Originally Posted by Ilusion9 View Post
PHP Code:

ConVar mp_default_team_winner_no_objective
;

public 
void OnPluginStart()
{    
    
HookEvent("round_start"Event_RoundStart);
    
mp_default_team_winner_no_objective FindConVar("mp_default_team_winner_no_objective");
}

public 
Action Event_RoundStart(Handle event, const char[] namebool dontBroadcast)
{    
    
mp_default_team_winner_no_objective.SetInt(GetRandomInt(23));


Messing with cvars is a terrible way especially without reverse.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 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 19:17.


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