View Single Post
keyboard1333
Senior Member
Join Date: Aug 2013
Old 01-12-2014 , 20: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