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

Bomb planting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
waggel
Junior Member
Join Date: Aug 2007
Old 11-11-2015 , 20:46   Bomb planting
Reply With Quote #1

Hi, i'm currently getting started into writing plugins, and messing around with sourcemod (pawn) programming.

And i was wondering if it's possible to plant the bomb automatically by the server.

So for example, at the beginning of the round, the server would select a random clientid of the terrorist and plant/put down the bomb for him on fixed location on one of the 2 bomb sites.


Kind regards,
Waggel
waggel is offline
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 11-12-2015 , 23:38   Re: Bomb planting
Reply With Quote #2

Create the bomb using CreateEntityByName, set the appropriate netprops, keyvalues, dispatch it, and teleport it?

And to find a bomb site on the map, use FindEntityByClassname?

(I have no idea really since I don't play csgo.)
Potato Uno is offline
waggel
Junior Member
Join Date: Aug 2007
Old 11-15-2015 , 16:27   Re: Bomb planting
Reply With Quote #3

Hi, thanks for reply.

So i've been on this for days now and no result.

I followed your tip and this is how far i got yet.
1 First I remove the bomb that has been given to one of the terrorists
2 I create an entity "planted_c4" (that's the one that gets created when a bomb is planted)
3 I teleport it to the bomb location, this works, i see it laying on the bombsite.

So next step is to fire of the event "bomb_planted", which triggers the beeping and bomb has been planted message, roundtimer stops, but it keeps beeping forever, even past the mp_c4timer seconds and never explodes. Also the bomb doesn't bling, just looks static.

Anyone who can help me a bit further?!

muchos gracias
waggel is offline
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 11-15-2015 , 16:46   Re: Bomb planting
Reply With Quote #4

sm_dump_netprops file.txt
sm_dump_datamaps file.txt

Look at its netprops and see if there's one you should probably be setting.
__________________
Chdata is offline
waggel
Junior Member
Join Date: Aug 2007
Old 11-15-2015 , 17:31   Re: Bomb planting
Reply With Quote #5

Thanks, netprops generated a giant list, looking into it now
waggel is offline
waggel
Junior Member
Join Date: Aug 2007
Old 11-15-2015 , 18:29   Re: Bomb planting
Reply With Quote #6

You saved my life! I literally was hunting this question for like 10 hours already now and i feel like an idiot.

Here is a reference to help other people:

What you do first is:
Create the entity "planted_c4"
DispatchSpawn the entity
Teleport the entity to the location of a bombsite.

Then you have to change the prop called m_bBombTicking to the value 1; but the SetEntProp doesn't work so you have to use SetEntData with offset 1216, bytelength 1 (8bits) and value to 1, this will starts the countdown of the bomb, blinking, and explossion after the c4timer. Also triggers the round end after.
waggel is offline
r3v
Senior Member
Join Date: Feb 2016
Location: Lithuania, Vilnius
Old 01-30-2022 , 04:31   Re: Bomb planting
Reply With Quote #7

I want to make working with CS:Source Retakes server, but planted bomb (without model) only blinking and playing beep sound. I upload offsets, so maybe someone can fix this?
PHP Code:
#pragma semicolon 1

#include <retakes>

#pragma newdecls required

#include <sdktools>
#include <cstrike>

ConVar
    g_cvPluginEnabled
,
    
g_cvFreezeTime;
bool
    g_bBombDeleted
;
int
    m_bBombTicking
;
Bombsite
    g_bsBombsite
;
float
    g_vecPosition
[3];

public 
Plugin myinfo =
{
    
name        "[CS:S] Retakes AutoPlant",
    
author        "domino_",
    
description    "A plugin which automatically plants the bomb in Retakes",
    
version        "0.0.5 (rewritten by Grey83)",
    
url            ""
}

public 
APLRes AskPluginLoad2(Handle myselfbool latechar[] errorint err_max)
{
    if((
m_bBombTicking FindSendPropInfo("CPlantedC4""m_bBombTicking")) == -1)
    {
        
FormatEx(errorerr_max"Unable to find offset CPlantedC4::m_bBombTicking.");
        return 
APLRes_Failure;
    }
    return 
APLRes_Success;
}

public 
void OnPluginStart() 
{
    
g_cvPluginEnabled CreateConVar("b3none_ap_enabled""1""Enable AutoPlant?(1 Enabled | 0 Disabled)");
    
g_cvFreezeTime FindConVar("mp_freezetime");

    
HookEvent("round_start"OnRoundStartEventHookMode_PostNoCopy);
}

public 
void OnRoundStart(Handle event, const char[] namebool dontBroadcast
{
    if(
GetConVarBool(g_cvPluginEnabled))
    {
        
g_bBombDeleted false;
        for(
int i 1<= MaxClientsi++) if(IsClientInGame(i) && IsPlayerAlive(i) && GetPlayerWeaponSlot(i4) > 0)
        {
            
g_bBombDeleted SafeRemoveBomb(i);

            
GetClientAbsOrigin(ig_vecPosition);

            
int iUserid GetClientUserId(i);
            
SendPlantEvent(iUserid);
            
CreateTimer(GetConVarFloat(g_cvFreezeTime)+0.1PlantBombiUseridTIMER_FLAG_NO_MAPCHANGE);
            break;
        }
    }
}

public 
Action PlantBomb(Handle timerint iUserid)
{
    if(
g_bBombDeleted)
    {
        
int ent CreateEntityByName("planted_c4");
        if(
ent != -1)
        {
            
SetEntData(entm_bBombTicking11true);
            
TeleportEntity(entg_vecPositionNULL_VECTORNULL_VECTOR);
    
            if(
DispatchSpawn(ent))
            {
                
ActivateEntity(ent);
                
SendPlantEvent(iUseridtrue);
            }
        }
    }
}

stock void SendPlantEvent(int iUserid, const bool planted false)
{
    
Event event CreateEvent(planted "bomb_planted" "bomb_beginplant");
    if(
event)
    {
        
event.SetInt("userid"iUserid);
        
event.SetInt("site", (g_bsBombsite == BombsiteA) ? 1);
        
event.Fire();
    }
}

public 
void Retakes_OnSitePicked(Bombsitesite)
{
    
g_bsBombsite site;
}

stock bool SafeRemoveBomb(int iClient)
{
    
int iWeapon GetPlayerWeaponSlot(iClient4);
    if(
iWeapon == -|| !HasEntProp(iWeaponProp_Send"m_hOwnerEntity"))
        return 
false;

    
int iOwnerEntity GetEntPropEnt(iWeaponProp_Send"m_hOwnerEntity");
    if(
iOwnerEntity != iClientSetEntPropEnt(iWeaponProp_Send"m_hOwnerEntity"iClient);

    
CS_DropWeapon(iClientiWeaponfalse);

    if(
HasEntProp(iWeaponProp_Send"m_hWeaponWorldModel"))
    {
        
int iWorldModel GetEntPropEnt(iWeaponProp_Send"m_hWeaponWorldModel");
        if(
iWorldModel != -&& !AcceptEntityInput(iWorldModel"Kill"))
            return 
false;
    }

    return 
AcceptEntityInput(iWeapon"Kill");

Attached Files
File Type: zip dump.zip (173.9 KB, 57 views)

Last edited by r3v; 01-30-2022 at 04:31.
r3v 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 04:09.


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