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

Solved CS:GO Player Health by 200 HP = round end


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
iskenderkebab33
Senior Member
Join Date: Jun 2018
Old 07-23-2018 , 03:45   CS:GO Player Health by 200 HP = round end
Reply With Quote #1

Hey, as the title says, if someone have 200 HP round will end and it will Print in to the chat, Player XYZ won the round.
example: if player kill a enemy he will get +5 HP the first player who will get 200 HP the round will end. (please do not ask how i got this idea, xd)

Thanks

Last edited by iskenderkebab33; 11-03-2018 at 17:30.
iskenderkebab33 is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 07-23-2018 , 07:31   Re: CS:GO Player Health by 200 HP = round end
Reply With Quote #2

Learn how to code yourself, it's easy. Also quite annoying getting "easy" requests such as this, when it's just a couple lines.

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>

#pragma semicolon 1

public void OnMapStart()
{
    
HookEvent("player_death"Event_Death);
}

public 
Action Event_Death(Event hEvent, const char[] sNamebool bDontBroadcast)
{
    for (
int i 1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && IsPlayerAlive(i))
        {
            
int iHealth GetClientHealth(i);
            
            
int iTeam GetClientTeam(i);
            
            if (
iHealth >= 200)
            {
                
CS_TerminateRound(7.0iTeam CSRoundEnd_CTWin CSRoundEnd_TerroristWin);
                
                
PrintToChatAll("%N Has won the round."i);
            }
        }
    }


Last edited by mug1wara; 07-23-2018 at 18:11.
mug1wara is offline
iskenderkebab33
Senior Member
Join Date: Jun 2018
Old 07-23-2018 , 07:46   Re: CS:GO Player Health by 200 HP = round end
Reply With Quote #3

Quote:
Originally Posted by mug1wara View Post
Learn how to code yourself, it's easy. Also quite annoying getting "easy" requests such as this, when it's just a couple lines.

PHP Code:
#include <sourcemod>

#pragma semicolon 1

public void OnMapStart()
{
    
HookEvent("round_end"Event_End);
}

public 
Action Event_End(Event hEvent, const char[] sNamebool bDontBroadcast)
{
    for (
int i 1<= MaxClientsi++)
    {
        if (
IsClientInGame(i))
        {
            
int iHealth GetClientHealth(i);
            
            if (
iHealth >= 200)
            {
                
PrintToChatAll("%N Has won the round."i);
            }
        }
    }

thanks, and... i'm learing from other coders stuff, sometimes i don't know how to code, so i create a Post. And thank you guys who help me with coding.
iskenderkebab33 is offline
iskenderkebab33
Senior Member
Join Date: Jun 2018
Old 07-23-2018 , 17:26   Re: CS:GO Player Health by 200 HP = round end
Reply With Quote #4

Quote:
Originally Posted by mug1wara View Post
Learn how to code yourself, it's easy. Also quite annoying getting "easy" requests such as this, when it's just a couple lines.

PHP Code:
#include <sourcemod>

#pragma semicolon 1

public void OnMapStart()
{
    
HookEvent("round_end"Event_End);
}

public 
Action Event_End(Event hEvent, const char[] sNamebool bDontBroadcast)
{
    for (
int i 1<= MaxClientsi++)
    {
        if (
IsClientInGame(i))
        {
            
int iHealth GetClientHealth(i);
            
            if (
iHealth >= 200)
            {
                
PrintToChatAll("%N Has won the round."i);
            }
        }
    }

btw. this isn't working :/
iskenderkebab33 is offline
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 07-23-2018 , 17:43   Re: CS:GO Player Health by 200 HP = round end
Reply With Quote #5

Still needs some modifications but it should be a good start:

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>

#pragma semicolon 1
#pragma newdecls  required

public void OnMapStart() 

    
HookEvent("player_death"OnPlayerDeathPost); 


public 
void OnPlayerDeathPost(Event hEvent, const char[] szNamebool bDontBroadcast)
{
    
int iAttacker GetClientOfUserId(hEvent.GetInt("attacker"));
    
    if (
IsClientInGame(iAttacker) && IsPlayerAlive(iAttacker))
    {
        
int iHealth GetClientHealth(iAttacker) + 5;
        
        if (
iHealth >= 200)
        {
            
// Optional
            
SetEntityHealth(iAttacker200);
            
            
PrintToChatAll("Player %N won the round !"iAttacker);
            
            
CS_TerminateRound(3.0CSRoundEnd_Draw);
        }
        else
        {
            
SetEntityHealth(iAttackeriHealth);
        }
    }

__________________
micapat is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 07-23-2018 , 18:12   Re: CS:GO Player Health by 200 HP = round end
Reply With Quote #6

Didn't quite understand the request so I apologize.

Edited post above, looks better and should work as a charm.
mug1wara 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:08.


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