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

Would like help with a small plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
psyfl
New Member
Join Date: May 2019
Old 05-01-2019 , 17:16   Would like help with a small plugin
Reply With Quote #1

Hi. I have programming knowledge but I'm pretty much totally new to SourcePawn, so I need pointing in the right direction for a small plugin that I would like to make.

I'm hosting a map on my server called mg_bob2. At one area in the map, there is a ball entity, which you can see at 49 seconds in this video: https://www.youtube.com/watch?v=Vhm9R6TqoNM

I would like to add a command that simply teleports the ball to a predetermined location. I believe I should be able to do this with the TeleportEntity function in the SourceMod API (https://sm.alliedmods.net/new-api/sd...TeleportEntity), but I don't know how to find the right entity number for the ball. I don't have access to any of the map files beyond the .bsp and .nav. If anyone could help me out with this then that would be much appreciated.
psyfl is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 05-01-2019 , 17:26   Re: Would like help with a small plugin
Reply With Quote #2

A plugin for one map entity is a bit overkil.

You could decompile the map, wrap a trigger or func around it and recompile with a new filename.
__________________
Neuro Toxin is offline
backwards
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Old 05-01-2019 , 18:22   Re: Would like help with a small plugin
Reply With Quote #3

PHP Code:
#include <sourcemod>
#include <sdktools>

public OnPluginStart()
{
    
HookEvent("round_start"Event_RoundStart);
}

new 
BallEntity = -1;

public 
void Event_RoundStart(Event event, const char[] namebool dontBroadcast)
{
    
BallEntity = -1;
    
FindBallObject();
}

public 
FindBallObject()
{
    
decl Float:ObjectPos[3] = {2511.4138182569.4562991845.27783};

    for(new 
MaxClients;GetMaxEntities();i++)
    {
        if(
IsValidEntity(i) && IsValidEdict(i))
        {
            
decl Float:TestObjectPos[3];
            
GetEntPropVector(iProp_Data"m_vecAbsOrigin"TestObjectPos);
            
            if(
GetVectorDistance(ObjectPosTestObjectPos) <= 128.0)
            {
                
decl String:EdictClassName[128];
                
GetEdictClassname(iEdictClassNamesizeof(EdictClassName));
                
                if(
StrEqual(EdictClassName"func_physbox"))
                {
                    
PrintToChatAll("Found The Ball (%i)!"i);
                    
BallEntity i;
                    return;
                }
            }
        }
    }

__________________
I highly recommend joining the SourceMod Discord Server for real time support.
backwards is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 05-01-2019 , 20:54   Re: Would like help with a small plugin
Reply With Quote #4

Quote:
Originally Posted by Neuro Toxin View Post
A plugin for one map entity is a bit overkil.

You could decompile the map, wrap a trigger or func around it and recompile with a new filename.
Given how decompiling a map almost always ends up with bugs somewhere in the map, I disagree.
__________________
Not currently working on SourceMod plugin development.
Powerlord 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 13:41.


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