Raised This Month: $51 Target: $400
 12% 

[CS:GO] Bomb Ping


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Koga73
Senior Member
Join Date: Mar 2011
Location: 🍩
Old 06-20-2019 , 20:31   [CS:GO] Bomb Ping
Reply With Quote #1

Heyo.

I'm looking for a plugin that will ping the bomb after a (maybe set by cvar?) seconds at the dropped location, and stop once it's picked up. My friend is running a map without a radar (which many custom maps don't have), and some times it can be difficult to find the location of the bomb.

I don't know if it's possible to control the amount of pings per seconds as well, but if possible, it should ping with a 5 second interval.

I hope somebody can help me out. Good day.
__________________
Koga73 is offline
Cruze
Veteran Member
Join Date: May 2017
Old 06-20-2019 , 22:39   Re: [CS:GO] Bomb Ping
Reply With Quote #2

Like a beacon that blinks every 5 seconds?
__________________
Taking paid private requests! Contact me
Cruze is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 06-21-2019 , 04:04   Re: [CS:GO] Bomb Ping
Reply With Quote #3

Quote:
Originally Posted by Koga73 View Post
Heyo.

I'm looking for a plugin that will ping the bomb after a (maybe set by cvar?) seconds at the dropped location, and stop once it's picked up. My friend is running a map without a radar (which many custom maps don't have), and some times it can be difficult to find the location of the bomb.

I don't know if it's possible to control the amount of pings per seconds as well, but if possible, it should ping with a 5 second interval.

I hope somebody can help me out. Good day.
not tested
just modified https://forums.alliedmods.net/showthread.php?p=2370819

PHP Code:
#pragma semicolon 1
//#pragma newdecls required

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>

Handle g_hBeaconTimer                INVALID_HANDLE;
float g_vecBeaconOrigin[3];
int g_BeamIndex = -1;

ConVar g_hCvarBeaconRadius            null;
ConVar g_hCvarBeaconLifetime        null;
ConVar g_hCvarBeaconWidth            null;
ConVar g_hCvarBeaconAmplitude        null;
ConVar g_hCvarBeaconColor            null;
ConVar g_hCvarBeaconRandomColor        null;

public 
Plugin myinfo = {
    
name        "Bomb beacon",
    
author      "lingzhidiyu",
    
description "description",
    
version     "1.0",
    
url         "url"
}

public 
void OnPluginStart() {
    
g_hCvarBeaconRadius            CreateConVar("bomb_beacon_radius",        "600.0",        "Set beacon radius");
    
g_hCvarBeaconLifetime        CreateConVar("bomb_beacon_lifetime",        "1.0",            "Set beacon lifetime");
    
g_hCvarBeaconWidth            CreateConVar("bomb_beacon_width",            "10.0",            "Set beacon width");
    
g_hCvarBeaconAmplitude        CreateConVar("bomb_beacon_amplitude",        "1.0",            "Set beacon amplitude");
    
g_hCvarBeaconColor            CreateConVar("bomb_beacon_color",            "255 0 0 255",    "Set beacon color");
    
g_hCvarBeaconRandomColor    CreateConVar("bomb_beacon_randomcolor",    "1",            "Set beacon randomcolor");
    
AutoExecConfig(true);

    
HookEvent("round_start",    OnRoundStart,    EventHookMode_Post);
    
HookEvent("bomb_dropped",    OnBombDropped,    EventHookMode_Post);
    
HookEvent("bomb_pickup",    OnBombPickedUp,    EventHookMode_Post);
}

public 
void OnMapStart() {
    
g_BeamIndex PrecacheModel("materials/sprites/laserbeam.vmt"true);
}

public 
void OnMapEnd() {
    
delete g_hBeaconTimer;
}

public 
void OnRoundStart(Event event, const char[] namebool dontBroadcast) {
    
delete g_hBeaconTimer;
}

public 
void OnBombDropped(Event event, const char[] namebool dontBroadcast) {
    new 
c4 = -1;
    while((
c4 FindEntityByClassname(c4"planted_c4"))!=-1)
        
GetEntPropVector(c4Prop_Data"m_vecOrigin"g_vecBeaconOrigin);

    
Timer_BombBeacon(INVALID_HANDLE);
    
g_hBeaconTimer CreateTimer(1.0Timer_BombBeacon_TIMER_REPEAT);
}


public 
void OnBombPickedUp(Event event, const char[] namebool dontBroadcast) {

    
delete g_hBeaconTimer;
}

public 
Action Timer_BombBeacon(Handle timer) {
    
int color[4];
    if (
GetConVarInt(g_hCvarBeaconRandomColor) == 1) {
        
PickRandomColor(color);
    } else {
        
GetConVarColor(g_hCvarBeaconColorcolor);
    }

    
TE_SetupBeamRingPoint(g_vecBeaconOrigin10.0GetConVarFloat(g_hCvarBeaconRadius), g_BeamIndex, -1030GetConVarFloat(g_hCvarBeaconLifetime), GetConVarFloat(g_hCvarBeaconWidth), GetConVarFloat(g_hCvarBeaconAmplitude), color00);
    
TE_SendToAll();
}

stock void PickRandomColor(int color[4], int min 1int max 255int alpha 255) {
    
color[0] = GetRandomInt(minmax);
    
color[1] = GetRandomInt(minmax);
    
color[2] = GetRandomInt(minmax);
    if (
alpha == -1) {
        
color[3] = GetRandomInt(minmax);
    } else {
        
color[3] = alpha;
    }
}

stock bool GetConVarColor(const Handle convarint color[4]) {
    
char szColor[4][16];
    
GetConVarString(g_hCvarBeaconColorszColor[0], sizeof(szColor[]));

    if (
ExplodeString(szColor[0], " "szColor4sizeof(szColor[])) == 4) {
        
color[0] = StringToInt(szColor[0]);
        
color[1] = StringToInt(szColor[1]);
        
color[2] = StringToInt(szColor[2]);
        
color[3] = StringToInt(szColor[3]);

        return 
true;
    }

    return 
false;

__________________
8guawong is offline
Koga73
Senior Member
Join Date: Mar 2011
Location: 🍩
Old 06-21-2019 , 07:04   Re: [CS:GO] Bomb Ping
Reply With Quote #4

Quote:
Originally Posted by Cruze View Post
Like a beacon that blinks every 5 seconds?
Exactly

Quote:
Originally Posted by 8guawong View Post
not tested
just modified https://forums.alliedmods.net/showthread.php?p=2370819

PHP Code:
#pragma semicolon 1
//#pragma newdecls required

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>

Handle g_hBeaconTimer                INVALID_HANDLE;
float g_vecBeaconOrigin[3];
int g_BeamIndex = -1;

ConVar g_hCvarBeaconRadius            null;
ConVar g_hCvarBeaconLifetime        null;
ConVar g_hCvarBeaconWidth            null;
ConVar g_hCvarBeaconAmplitude        null;
ConVar g_hCvarBeaconColor            null;
ConVar g_hCvarBeaconRandomColor        null;

public 
Plugin myinfo = {
    
name        "Bomb beacon",
    
author      "lingzhidiyu",
    
description "description",
    
version     "1.0",
    
url         "url"
}

public 
void OnPluginStart() {
    
g_hCvarBeaconRadius            CreateConVar("bomb_beacon_radius",        "600.0",        "Set beacon radius");
    
g_hCvarBeaconLifetime        CreateConVar("bomb_beacon_lifetime",        "1.0",            "Set beacon lifetime");
    
g_hCvarBeaconWidth            CreateConVar("bomb_beacon_width",            "10.0",            "Set beacon width");
    
g_hCvarBeaconAmplitude        CreateConVar("bomb_beacon_amplitude",        "1.0",            "Set beacon amplitude");
    
g_hCvarBeaconColor            CreateConVar("bomb_beacon_color",            "255 0 0 255",    "Set beacon color");
    
g_hCvarBeaconRandomColor    CreateConVar("bomb_beacon_randomcolor",    "1",            "Set beacon randomcolor");
    
AutoExecConfig(true);

    
HookEvent("round_start",    OnRoundStart,    EventHookMode_Post);
    
HookEvent("bomb_dropped",    OnBombDropped,    EventHookMode_Post);
    
HookEvent("bomb_pickup",    OnBombPickedUp,    EventHookMode_Post);
}

public 
void OnMapStart() {
    
g_BeamIndex PrecacheModel("materials/sprites/laserbeam.vmt"true);
}

public 
void OnMapEnd() {
    
delete g_hBeaconTimer;
}

public 
void OnRoundStart(Event event, const char[] namebool dontBroadcast) {
    
delete g_hBeaconTimer;
}

public 
void OnBombDropped(Event event, const char[] namebool dontBroadcast) {
    new 
c4 = -1;
    while((
c4 FindEntityByClassname(c4"planted_c4"))!=-1)
        
GetEntPropVector(c4Prop_Data"m_vecOrigin"g_vecBeaconOrigin);

    
Timer_BombBeacon(INVALID_HANDLE);
    
g_hBeaconTimer CreateTimer(1.0Timer_BombBeacon_TIMER_REPEAT);
}


public 
void OnBombPickedUp(Event event, const char[] namebool dontBroadcast) {

    
delete g_hBeaconTimer;
}

public 
Action Timer_BombBeacon(Handle timer) {
    
int color[4];
    if (
GetConVarInt(g_hCvarBeaconRandomColor) == 1) {
        
PickRandomColor(color);
    } else {
        
GetConVarColor(g_hCvarBeaconColorcolor);
    }

    
TE_SetupBeamRingPoint(g_vecBeaconOrigin10.0GetConVarFloat(g_hCvarBeaconRadius), g_BeamIndex, -1030GetConVarFloat(g_hCvarBeaconLifetime), GetConVarFloat(g_hCvarBeaconWidth), GetConVarFloat(g_hCvarBeaconAmplitude), color00);
    
TE_SendToAll();
}

stock void PickRandomColor(int color[4], int min 1int max 255int alpha 255) {
    
color[0] = GetRandomInt(minmax);
    
color[1] = GetRandomInt(minmax);
    
color[2] = GetRandomInt(minmax);
    if (
alpha == -1) {
        
color[3] = GetRandomInt(minmax);
    } else {
        
color[3] = alpha;
    }
}

stock bool GetConVarColor(const Handle convarint color[4]) {
    
char szColor[4][16];
    
GetConVarString(g_hCvarBeaconColorszColor[0], sizeof(szColor[]));

    if (
ExplodeString(szColor[0], " "szColor4sizeof(szColor[])) == 4) {
        
color[0] = StringToInt(szColor[0]);
        
color[1] = StringToInt(szColor[1]);
        
color[2] = StringToInt(szColor[2]);
        
color[3] = StringToInt(szColor[3]);

        return 
true;
    }

    return 
false;

Looks promising, I'll give it a try and let you know, ty.

Edit: Compiled it, doesn't seem to work.
__________________

Last edited by Koga73; 06-21-2019 at 07:15.
Koga73 is offline
Koga73
Senior Member
Join Date: Mar 2011
Location: 🍩
Old 06-23-2019 , 15:23   Re: [CS:GO] Bomb Ping
Reply With Quote #5

Anybody got a clue on why the above isn't working?
__________________
Koga73 is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 06-23-2019 , 21:57   Re: [CS:GO] Bomb Ping
Reply With Quote #6

Quote:
Originally Posted by Koga73 View Post
Anybody got a clue on why the above isn't working?
any errors in the log?
__________________
8guawong is offline
Koga73
Senior Member
Join Date: Mar 2011
Location: 🍩
Old 06-25-2019 , 12:31   Re: [CS:GO] Bomb Ping
Reply With Quote #7

Quote:
Originally Posted by 8guawong View Post
any errors in the log?
Nothing pops up in the error logs, and the plugin loads on the sm plugins list.
__________________
Koga73 is offline
Koga73
Senior Member
Join Date: Mar 2011
Location: 🍩
Old 06-26-2019 , 12:37   Re: [CS:GO] Bomb Ping
Reply With Quote #8

Ok it worked for a round (random round) and not again, but the beacon was below ground for some reason.
__________________
Koga73 is offline
Reply



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 03:34.


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