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

[CSGO] events problem in Danger Zone mode


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CDboy
Junior Member
Join Date: Aug 2020
Location: China
Old 08-30-2020 , 03:49   [CSGO] events problem in Danger Zone mode
Reply With Quote #1

Hi I am writing a plugin for danger zone mode. I want to record some interesting statistics about players' actions such as bomb planting and consumption. But after some tests, I found that in danger zone mode:

1) Sending a hostage to a rescue point will NOT fire hostage_rescued.
2) Planting a bomb will NOT fire bomb_planted.
3) Buying something in the pad will NOT fire item_purchased.

But why? Why doesn't these events happen? Any methods that can help me track these actions?
CDboy is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 08-30-2020 , 13:50   Re: [CSGO] events problem in Danger Zone mode
Reply With Quote #2

3)
Try test plugin.
PHP Code:
public void OnPluginStart()
{
    
AddCommandListener(listen"");
}

public 
Action listen(int client, const char[] commandint args)
{

    
char buffer[MAX_NAME_LENGTH];
    
GetCmdArgString(buffersizeof(buffer));

    
client == -PrintToServer("-(-1) %s '%s'"commandbuffer):PrintToServer("-(%N) %s '%s'"clientcommandbuffer);

    return 
Plugin_Continue;

Player is sending commands when for example purchase item.
But player need equip tablet or otherwise command is unknow.

Code:
-(Bacardi) tabletbuy_open ''
-(Bacardi) tabletbuy_buy_drone_knife_purchase ''''


-(Bacardi) tabletbuy_open ''
-(Bacardi) tabletbuy_buy_drone_pilot_upgrade_purchase ''
__________________
Do not Private Message @me
Bacardi is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 08-30-2020 , 15:38   Re: [CSGO] events problem in Danger Zone mode
Reply With Quote #3

1)
Here is example, check when player touch "func_hostage_rescue" area, "OnStartTouch".
Check does player carrying hostage.

- I made so it create and fire event "hostage_rescued", you just need load one plugin for re-create that event. Other plugins will trigger also to that event.

PHP Code:
#include <sdktools>

public void OnPluginStart()
{
    
HookEntityOutput("func_hostage_rescue""OnStartTouch"OnRescued);
}

public 
void OnRescued(const char[] outputint callerint activatorfloat delay)
{
    
// check is survival mode
    
if(FindEntityByClassname(-1"dangerzone_controller") == -1) return;

/*
Server event "hostage_rescued", Tick 8689:
- "userid" = "2"
- "hostage" = "365"
- "site" = "0"
*/

    
if(activator <= || activator MaxClients) return;

    
int hostage_entity GetEntPropEnt(activatorProp_Send"m_hCarriedHostage");

    if(
hostage_entity == -1) return;

    
Event hostage_rescued CreateEvent("hostage_rescued");

    if(
hostage_rescued == null) return;

    
hostage_rescued.SetInt("userid"GetClientUserId(activator));
    
hostage_rescued.SetInt("hostage"hostage_entity);
    
hostage_rescued.SetInt("site"0);
    
hostage_rescued.Fire();

__________________
Do not Private Message @me

Last edited by Bacardi; 08-30-2020 at 21:38. Reason: if event null return
Bacardi is offline
CDboy
Junior Member
Join Date: Aug 2020
Location: China
Old 08-31-2020 , 02:35   Re: [CSGO] events problem in Danger Zone mode
Reply With Quote #4

Quote:
Originally Posted by Bacardi View Post
1)
Here is example, check when player touch "func_hostage_rescue" area, "OnStartTouch".
Check does player carrying hostage.

- I made so it create and fire event "hostage_rescued", you just need load one plugin for re-create that event. Other plugins will trigger also to that event.

PHP Code:
#include <sdktools>

public void OnPluginStart()
{
    
HookEntityOutput("func_hostage_rescue""OnStartTouch"OnRescued);
}

public 
void OnRescued(const char[] outputint callerint activatorfloat delay)
{
    
// check is survival mode
    
if(FindEntityByClassname(-1"dangerzone_controller") == -1) return;

/*
Server event "hostage_rescued", Tick 8689:
- "userid" = "2"
- "hostage" = "365"
- "site" = "0"
*/

    
if(activator <= || activator MaxClients) return;

    
int hostage_entity GetEntPropEnt(activatorProp_Send"m_hCarriedHostage");

    if(
hostage_entity == -1) return;

    
Event hostage_rescued CreateEvent("hostage_rescued");

    if(
hostage_rescued == null) return;

    
hostage_rescued.SetInt("userid"GetClientUserId(activator));
    
hostage_rescued.SetInt("hostage"hostage_entity);
    
hostage_rescued.SetInt("site"0);
    
hostage_rescued.Fire();

Thanks a lot! That really helps!
CDboy is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 08-31-2020 , 09:45   Re: [CSGO] events problem in Danger Zone mode
Reply With Quote #5

For 2)

For example look when entity is created (SDKHooks).
Entity Classname is "planted_c4_survival",
and look entity again after one frame, does entity exist any more and to get entity data.


This example again fire event called "bomb_planted"

PHP Code:
#include <sdkhooks>

public void OnEntityCreated(int entity, const char[] classname)
{
    
// Danger Zone C4 planted
    
if(entity == -|| !StrEqual(classname"planted_c4_survival"false)) return;


    
// Need check does entity exist on next frame.
    // Data is set into entity in next frame or later.
    
RequestFrame(frameEntIndexToEntRef(entity));
}


public 
void frame(int ref)
{
    
int entity EntRefToEntIndex(ref);

    
// Entity not exist
    
if(entity == -1) return;


    
int player GetEntPropEnt(entityProp_Send"m_hOwnerEntity");
    
    if(
player || player MaxClients) return;

    
/*
        Server event "bomb_planted", Tick 10971:
        - "userid" = "3"
        - "site" = "282"
    */


    
Event bomb_planted CreateEvent("bomb_planted");
    
    if(
bomb_planted == null) return;
    
    
bomb_planted.SetInt("userid"GetClientUserId(player));
    
bomb_planted.SetInt("site"0);
    
bomb_planted.Fire();


__________________
Do not Private Message @me
Bacardi is offline
CDboy
Junior Member
Join Date: Aug 2020
Location: China
Old 08-31-2020 , 09:58   Re: [CSGO] events problem in Danger Zone mode
Reply With Quote #6

Quote:
Originally Posted by Bacardi View Post
For 2)

For example look when entity is created (SDKHooks).
Entity Classname is "planted_c4_survival",
and look entity again after one frame, does entity exist any more and to get entity data.


This example again fire event called "bomb_planted"

PHP Code:
#include <sdkhooks>

public void OnEntityCreated(int entity, const char[] classname)
{
    
// Danger Zone C4 planted
    
if(entity == -|| !StrEqual(classname"planted_c4_survival"false)) return;


    
// Need check does entity exist on next frame.
    // Data is set into entity in next frame or later.
    
RequestFrame(frameEntIndexToEntRef(entity));
}


public 
void frame(int ref)
{
    
int entity EntRefToEntIndex(ref);

    
// Entity not exist
    
if(entity == -1) return;


    
int player GetEntPropEnt(entityProp_Send"m_hOwnerEntity");
    
    if(
player || player MaxClients) return;

    
/*
        Server event "bomb_planted", Tick 10971:
        - "userid" = "3"
        - "site" = "282"
    */


    
Event bomb_planted CreateEvent("bomb_planted");
    
    if(
bomb_planted == null) return;
    
    
bomb_planted.SetInt("userid"GetClientUserId(player));
    
bomb_planted.SetInt("site"0);
    
bomb_planted.Fire();


Thank you so much! I will study this first!
CDboy 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 09:39.


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