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

[CS:GO][REQ] JailBreak Revolt Sound


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
trickgod
Junior Member
Join Date: Jun 2018
Old 08-19-2019 , 18:55   [CS:GO][REQ] JailBreak Revolt Sound
Reply With Quote #1

I want him to play a voice when any prisoner damages the guard. And Only Once In Each Round.
At the same time PrintToChat "[Player Name] launched a rebellion"

Is there anyone to do it ?
trickgod is offline
Pilo
AlliedModders Donor
Join Date: Jan 2019
Location: Israel
Old 08-20-2019 , 05:01   Re: [CS:GO][REQ] JailBreak Revolt Sound
Reply With Quote #2

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

public void OnPluginStart()
{
    
HookEvent("player_hurt"Event_PlayerHurt);
}

public 
void OnMapStart()
{
    
PrecacheSound("misc/rebellion.mp3");
    
AddFileToDownloadsTable("sound/misc/rebellion.mp3");
}

public 
Action Event_PlayerHurt(Event event, const char[] namebool dB)
{
    
int attacker GetClientOfUserId(event.GetInt("attacker"));
    
int victim GetClientOfUserId(event.GetInt("userid"));
    
    if (
IsClientInGame(attacker) && !IsFakeClient(attacker))
    {
        if (
IsClientInGame(victim) && !IsFakeClient(victim))
        {
            if (
GetClientTeam(attacker) == CS_TEAM_T)
            {
                if (
GetClientTeam(victim == CS_TEAM_CT))
                {
                    
EmitSoundToAll("misc/rebellion.mp3");
                    
PrintToChatAll("%N launched a rebellion"attacker);
                }
            }
        }
    }
    return 
Plugin_Continue;

Maybe try this ?
__________________

Taking Private(PAID) Plugins In PM
Feel free to Donate with PayPal
Feel free to message me in Discord Pilo#8253
Total donated : 25$
Pilo is offline
trickgod
Junior Member
Join Date: Jun 2018
Old 08-28-2019 , 17:43   Re: [CS:GO][REQ] JailBreak Revolt Sound
Reply With Quote #3

Quote:
Originally Posted by Pilo View Post
PHP Code:
#include <cstrike>
#include <sdktools>

public void OnPluginStart()
{
    
HookEvent("player_hurt"Event_PlayerHurt);
}

public 
void OnMapStart()
{
    
PrecacheSound("misc/rebellion.mp3");
    
AddFileToDownloadsTable("sound/misc/rebellion.mp3");
}

public 
Action Event_PlayerHurt(Event event, const char[] namebool dB)
{
    
int attacker GetClientOfUserId(event.GetInt("attacker"));
    
int victim GetClientOfUserId(event.GetInt("userid"));
    
    if (
IsClientInGame(attacker) && !IsFakeClient(attacker))
    {
        if (
IsClientInGame(victim) && !IsFakeClient(victim))
        {
            if (
GetClientTeam(attacker) == CS_TEAM_T)
            {
                if (
GetClientTeam(victim == CS_TEAM_CT))
                {
                    
EmitSoundToAll("misc/rebellion.mp3");
                    
PrintToChatAll("%N launched a rebellion"attacker);
                }
            }
        }
    }
    return 
Plugin_Continue;

Maybe try this ?
Not Working
PHP Code:
Logs :
L 08/28/2019 23:59:21: [SMCall stack trace:
L 08/28/2019 23:59:21: [SM]   [0IsClientInGame
L 08
/28/2019 23:59:21: [SM]   [1Line 22plugin.sp::Event_PlayerHurt
L 08
/28/2019 23:59:27: [SMException reportedClient index 0 is invalid 

Last edited by trickgod; 08-28-2019 at 17:43.
trickgod is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 08-29-2019 , 05:27   Re: [CS:GO][REQ] JailBreak Revolt Sound
Reply With Quote #4

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

bool g_bRebellion;

public 
void OnPluginStart()
{
    
HookEvent("player_hurt"Event_PlayerHurt);
    
HookEvent("round_start"Event_RoundStart);
}

public 
void OnMapStart()
{
    
g_bRebellion false;

    
PrecacheSound("misc/rebellion.mp3");
    
AddFileToDownloadsTable("sound/misc/rebellion.mp3");
}

public 
void Event_PlayerHurt(Event event, const char[] namebool dB)
{
    if (
g_bRebellion) return;

    
int attacker GetClientOfUserId(event.GetInt("attacker"));
    
int victim GetClientOfUserId(event.GetInt("userid"));
    
    if (
attacker && IsClientInGame(attacker) && !IsFakeClient(attacker))
    {
        if (
victim && IsClientInGame(victim) && !IsFakeClient(victim))
        {
            if (
GetClientTeam(attacker) == CS_TEAM_T)
            {
                if (
GetClientTeam(victim == CS_TEAM_CT))
                {
                    
EmitSoundToAll("misc/rebellion.mp3");
                    
PrintToChatAll("%N launched a rebellion"attacker);

                    
g_bRebellion true;
                }
            }
        }
    }
}

public 
void Event_RoundStart(Event event, const char[] namebool dB)
{
    
g_bRebellion false;

__________________

Last edited by Ilusion9; 08-29-2019 at 05:27.
Ilusion9 is offline
trickgod
Junior Member
Join Date: Jun 2018
Old 08-30-2019 , 20:15   Re: [CS:GO][REQ] JailBreak Revolt Sound
Reply With Quote #5

Quote:
Originally Posted by Ilusion9 View Post
PHP Code:
#include <sourcemod>
#include <cstrike>
#include <sdktools>

bool g_bRebellion;

public 
void OnPluginStart()
{
    
HookEvent("player_hurt"Event_PlayerHurt);
    
HookEvent("round_start"Event_RoundStart);
}

public 
void OnMapStart()
{
    
g_bRebellion false;

    
PrecacheSound("misc/rebellion.mp3");
    
AddFileToDownloadsTable("sound/misc/rebellion.mp3");
}

public 
void Event_PlayerHurt(Event event, const char[] namebool dB)
{
    if (
g_bRebellion) return;

    
int attacker GetClientOfUserId(event.GetInt("attacker"));
    
int victim GetClientOfUserId(event.GetInt("userid"));
    
    if (
attacker && IsClientInGame(attacker) && !IsFakeClient(attacker))
    {
        if (
victim && IsClientInGame(victim) && !IsFakeClient(victim))
        {
            if (
GetClientTeam(attacker) == CS_TEAM_T)
            {
                if (
GetClientTeam(victim == CS_TEAM_CT))
                {
                    
EmitSoundToAll("misc/rebellion.mp3");
                    
PrintToChatAll("%N launched a rebellion"attacker);

                    
g_bRebellion true;
                }
            }
        }
    }
}

public 
void Event_RoundStart(Event event, const char[] namebool dB)
{
    
g_bRebellion false;

Not Working
trickgod is offline
Javierko
AlliedModders Donor
Join Date: Sep 2017
Location: Czech republic
Old 08-30-2019 , 20:37   Re: [CS:GO][REQ] JailBreak Revolt Sound
Reply With Quote #6

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

#pragma semicolon 1
#pragma newdecls required

bool g_bIsRebel false;

/*
    > Plugin
*/

public void OnPluginStart()
{
    
HookEvent("player_hurt"Event_PlayerHurt);
    
HookEvent("round_start"Event_RoundStart);
}

public 
void OnMapStart()
{
    
PrecacheSound("misc/rebellion.mp3");
    
AddFileToDownloadsTable("sound/misc/rebellion.mp3");
}

public 
void Event_PlayerHurt(Event eEvent, const char[] szNamebool bDbs)
{
    if(
g_bIsRebel)
    {
        return;
    }
    
    
int iVictim GetClientOfUserId(eEvent.GetInt("userid"));
    
int iAttacker GetClientOfUserId(eEvent.GetInt("attacker"));
    
    if(
IsValidClient(iVictimtrue) && IsValidClient(iAttackertrue))
    {
        if(
iVictim != iAttacker)
        {
            if(
GetClientTeam(iVictim) == CS_TEAM_CT && GetClientTeam(iAttacker) == CS_TEAM_T)
            {
                
EmitSoundToAll("misc/rebellion.mp3");
                
PrintToChatAll("%N attacked a CT"iAttacker);
                
                
g_bIsRebel true;
            }
        }
    }
}

public 
void Event_RoundStart(Event eEvent, const char[] szNamebool bDbs)
{
    
g_bIsRebel false;
}

/*
    > Stocks
*/

bool IsValidClient(int iClientbool bAlive false)
{
    if(
iClient >= && iClient <= MaxClients && IsClientConnected(iClient) && IsClientInGame(iClient) && !IsClientSourceTV(iClient) && (bAlive == false || IsPlayerAlive(iClient)))
    {
        return 
true;
    }
    
    return 
false;

__________________
My Github & Sourcemod work.
If you like my work and if you want to support me, you can through PayPal.

Official SourceMod CZ/SK Discord: https://discord.gg/Qvar55a
Javierko 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 11:01.


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