Raised This Month: $71 Target: $400
 17% 

Create "Dueling Box"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
keyboard1333
Senior Member
Join Date: Aug 2013
Old 01-11-2014 , 23:41   Create "Dueling Box"
Reply With Quote #1

A while ago I saw a plugin (on Pink Taco I believe) that created a box that would allow certain players in and repel the other players.

Is there any plugin (with public sourcecode) that does this? (I've looked )

If not, what would be the steps to create such a plugin? And also, would it be possible to prevent weapons discharge entering the box?

Last edited by keyboard1333; 01-11-2014 at 23:41.
keyboard1333 is offline
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 01-12-2014 , 00:47   Re: Create "Dueling Box"
Reply With Quote #2

Hmm, you could probably piece it together with code from several plugins, but I'd do the following:

Create a Trigger Multiple entity, then hook it for OnTouch or OnStartTouch and use that method for ensuring only your two dueling players are allowed. Hook OnEndTouch to see if your duelers leave the box. Use Temp Ents (the beam, see Timer for some usable code) to create a visible box around the trigger entity. For the repelling, you could go for complicated and create a series of push entities around it, or go the math route and use TeleportEntity with vector funness. As for the weapon discharge, I'm going to assume you mean preventing players from outside the box from injuring the ones inside, in which case you can hook OnTakeDamage or TraceAttack and see if both players are within the box, and if not, nullify the damage.
__________________
thetwistedpanda is offline
keyboard1333
Senior Member
Join Date: Aug 2013
Old 01-12-2014 , 01:03   Re: Create "Dueling Box"
Reply With Quote #3

I think I understood most of what you said (and I know from experience how to do a few of those), but the one that goes straight past me is
Quote:
Create a Trigger Multiple entity
.
Would a quick explanation or a link to something explaining what that is be possible?

Also, I meant stopping the weapon projectiles from entering the box (hooking the collision then destroying them?)
keyboard1333 is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 01-12-2014 , 01:45   Re: Create "Dueling Box"
Reply With Quote #4

I did something like this recently. Not sure what of it you'd be able to utilize. Also here's hoping you have at least basic sourcepawn knowledge.

also i've REALLY cleaned up my stock brush-creating code since I released that plugin
__________________
ddhoward is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 01-12-2014 , 02:05   Re: Create "Dueling Box"
Reply With Quote #6

Quote:
Originally Posted by thetwistedpanda View Post
Hmm, you could probably piece it together with code from several plugins, but I'd do the following:

Create a Trigger Multiple entity, then hook it for OnTouch or OnStartTouch and use that method for ensuring only your two dueling players are allowed. Hook OnEndTouch to see if your duelers leave the box. Use Temp Ents (the beam, see Timer for some usable code) to create a visible box around the trigger entity. For the repelling, you could go for complicated and create a series of push entities around it, or go the math route and use TeleportEntity with vector funness. As for the weapon discharge, I'm going to assume you mean preventing players from outside the box from injuring the ones inside, in which case you can hook OnTakeDamage or TraceAttack and see if both players are within the box, and if not, nullify the damage.
Maths are the obvious best choice here.
__________________
Profile - Steam Group - Plugins - Blog - Donate
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
keyboard1333
Senior Member
Join Date: Aug 2013
Old 01-12-2014 , 21:03   Re: Create "Dueling Box"
Reply With Quote #7

Thanks for the replies guys!

I tried putting something together using your code (really dodgy) and it just crashes the server.

Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <tf2>
#include <tf2_stocks>
#include <sdkhooks>


#define BRUSH_CLASSNAME "func_nav_avoid"
#define M_COLLISION_GROUP 11
#define SOLID_FLAGS 668
new BoxingBrush;

stock bool:IsValidClient(client, bool:replaycheck = true) {
    if (client < 1 || client > MaxClients ) return false;
    if (!IsClientInGame(client)) return false;
    if (GetEntProp(client, Prop_Send, "m_bIsCoaching")) return false;
    if (replaycheck)
    {
        if (IsClientSourceTV(client) || IsClientReplay(client)) return false;
    }
    return true;
}  

public OnPluginStart() {
    RegAdminCmd("sm_createDuel", Command_CreateDuel, ADMFLAG_SLAY, "Create the dueling box");
}
public Action:Command_CreateDuel(client,args)
{
    if(!IsValidClient(client))
    {
        return Plugin_Continue;
    }
    new Float:minbounds[3] = {0.0, 0.0, 0.0};
    new Float:maxbounds[3] = {360.0, 360.0, 430.0};
    new Float:PlayerLocation[3];
    GetClientAbsOrigin(client, PlayerLocation);
    BoxingBrush = CreateEntityByName(BRUSH_CLASSNAME);

    DispatchSpawn(BoxingBrush);
    ActivateEntity(BoxingBrush);

    TeleportEntity(BoxingBrush, PlayerLocation, NULL_VECTOR, NULL_VECTOR);

    SetEntityModel(BoxingBrush, "models/props_gameplay/resupply_locker.mdl");

    SetEntPropVector(BoxingBrush, Prop_Send, "m_vecMins", minbounds);
    SetEntPropVector(BoxingBrush, Prop_Send, "m_vecMaxs", maxbounds);
    SetEntProp(BoxingBrush, Prop_Send, "m_CollisionGroup", M_COLLISION_GROUP);
    SetEntProp(BoxingBrush, Prop_Send, "m_usSolidFlags", SOLID_FLAGS);

    new enteffects = GetEntProp(BoxingBrush, Prop_Send, "m_fEffects");
    enteffects |= 32;
    SetEntProp(BoxingBrush, Prop_Send, "m_fEffects", enteffects); 

    SDKHook(BoxingBrush, SDKHook_StartTouch, OnStartTouchBoxing);
    SDKHook(BoxingBrush, SDKHook_Touch, OnTouchBoxing);
    SDKHook(BoxingBrush, SDKHook_EndTouch, OnStopTouchBoxing);
    return Plugin_Changed;
}

public Action:OnStartTouchBoxing(point, client) {
    PrintToChatAll("Test");
}

public Action:OnTouchBoxing(point, client) {
    
}


public Action:OnStopTouchBoxing(point, client) {
    
}
Any tips?
keyboard1333 is offline
zipcore
Veteran Member
Join Date: Mar 2010
Location: m_flZipcore
Old 01-13-2014 , 05:58   Re: Create "Dueling Box"
Reply With Quote #8

Look into timer-mapzones.sp: https://forums.alliedmods.net/showth...99#post2074699

There is a zonetype called ZtArena you could use this source to create your plugin.
__________________
zipcore is offline
Root_
Veteran Member
Join Date: Jan 2012
Location: ryssland
Old 01-13-2014 , 07:20   Re: Create "Dueling Box"
Reply With Quote #9

Or this
Set 'no shoot' punishment and edit it within OnTouch callback, set booleans for both players that 'InZone[activator] = true' and set InZone[activator] = false appropriately when players enters/leaves zone and check those booleans in TraceAttack/OnTakeDamage like this
Code:
public OnClientPutInServer(client) {     SDKHook(client, SDKHook_TraceAttack, TraceAttack);     SDKHook(client, SDKHook_OnTakeDamage, TakeDamage); } public Action:TraceAttack(victim, &attacker, &inflictor, &Float:damage, &damagetype, &ammotype, hitbox, hitgroup) {     return (InZone[attacker] && InZone[victim]) ? Plugin_Continue : Plugin_Handled; } public Action:TakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype) {     return (InZone[attacker] && InZone[victim]) ? Plugin_Continue : Plugin_Handled; }
__________________


dodsplugins.com - Plugins and Resources for Day of Defeat
http://twitch.tv/zadroot
Root_ is offline
keyboard1333
Senior Member
Join Date: Aug 2013
Old 01-14-2014 , 02:23   Re: Create "Dueling Box"
Reply With Quote #10

Thanks for all the responses!
In the end I went with root's plugin.

However I had a small problem
I tried to compile it (to see if I could add some changes) and I got a tonne of errors:

Mostly:sm_zones.sp(184) error 017: undefined symbol "Engine_CSS"

And so on.
All the undefined symbols
keyboard1333 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 04:20.


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