This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Bullet Tracer Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
zeroibis
Veteran Member
Join Date: Jun 2007
Old 12-13-2009 , 19:16   Bullet Tracer Plugin
Reply With Quote #1

So I am working on a bullet tracer plugin but I have reached the limitation of my sm knowledge and need some help filling in the blanks. So far I can detect where a bullet hits and record that location along with the client who fired it. I also have some code that should determine where the location of the clients gun is but I do not know how to get the output from it. I set up an example code that generates sparks so that I knew that temp entities worked. I also know that the model that needs to be used for the effect is "effects/gunshiptracer.vmt"

Below is my code so far, can anyone help me trigger the BeamClient method correctly?

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


#define VERSION "0.1"

new String:Weapon[30];
new Handle:hGetWeapon_ShootPosition;
new Handle:hGameConf;


public Plugin:myinfo = 
{
    name = "Tracers",
    author = "ZERO <ibis>",
    description = "Makes tracers follow bullets",
    version = VERSION,
    url = "www.ibisgaming.com"
};

// create convars and hook event
public OnPluginStart()
{
    hGameConf = LoadGameConfigFile("plugin.sdkexamples");
 
    StartPrepSDKCall(SDKCall_Player);
    PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, "Weapon_ShootPosition");
    PrepSDKCall_SetReturnInfo(SDKType_Vector, SDKPass_ByValue);
    hGetWeapon_ShootPosition= EndPrepSDKCall();

    HookEvent("bullet_impact",Fire);
}

GetWeapon_ShootPosition(client, Float:pos[3])
{
    SDKCall(hGetWeapon_ShootPosition, client, pos);
}



//hook the player_hurt event and look for nade damge
public Fire(Handle:event,const String:name[],bool:dontBroadcast)
{
    GetEventString(event,"weapon",Weapon,30);
    
    // if plugin is on and nade was found then ignite client
    if(StrEqual(Weapon,"hegrenade")!= true)
    {
        new clientid = GetEventInt(event,"userid");
        new client = GetClientOfUserId(clientid);
        new x2 = GetEventInt(event,"x");
        new y2 = GetEventInt(event,"y");
        new z2 = GetEventInt(event,"z");
        new Float:end[3];
        end[0] = x2;
        end[1] = y2;
        end[2] = z2;
        
        SparkClient(client,end,end);
    

        
    }
}


SparkClient(client, const Float:pos[3], const Float:dir[3])
{
    TE_SetupMetalSparks(pos, dir);
    TE_SendToAll;
}

BeamClient(const Float:start[3], const Float:end[3], ModelIndex, HaloIndex, StartFrame, FrameRate, Float:Life, Float:Width, Float:EndWidth, FadeLength, Float:Amplitude, const Color[4], Speed)
{
    TE_SetupBeamPoints(start, end, ModelIndex, HaloIndex, StartFrame, FrameRate, Life, Width, EndWidth, FadeLength, Amplitude, Color, Speed);
    TE_SendToAll;
}
Thanks again, I am also attaching the code for those who want to just dl it. Hopefully with your help we can release a public bullet tracer plugin! (I will credit anyone who helps when I release it)
Attached Files
File Type: sp Get Plugin or Get Source (tracer.sp - 1568 views - 1.9 KB)
__________________
zeroibis is offline
meng
Veteran Member
Join Date: Oct 2005
Location: us
Old 12-13-2009 , 22:34   Re: Bullet Tracer Plugin
Reply With Quote #2

unclear what your asking for. is this what your trying to make?
__________________
.
[ 1 Dumerils Boa | 1 Cali King ]...
.
I'm a lil' spirituous.
meng is offline
Send a message via Yahoo to meng
andi67
Veteran Member
Join Date: Mar 2007
Location: Somewhere near you!!!
Old 12-13-2009 , 23:27   Re: Bullet Tracer Plugin
Reply With Quote #3

CSS or for what Game???
__________________
Waiting for HL3,Day of Defeat3 ,but will it ever come? So I'm gonna play COD WW2.>>>>SM_SKINCHOOSER<<<<
>>You need Models for DODS/CSS/CSGO , than click here!!!<<
andi67 is offline
zeroibis
Veteran Member
Join Date: Jun 2007
Old 12-13-2009 , 23:59   Re: Bullet Tracer Plugin
Reply With Quote #4

It is for css and yes it is going to be like the laser plugin except that this is trying to make realistic tracers like that es script mb_tracer.

Actually tomorrow I might read over some of the code in the laser plugin and see if there is anything that can help me.
__________________
zeroibis is offline
Peoples Army
SourceMod Donor
Join Date: Mar 2007
Old 12-14-2009 , 01:10   Re: Bullet Tracer Plugin
Reply With Quote #5

http://forums.alliedmods.net/showthread.php?p=519806

Look at some of my code there and it might help you out
__________________
Peoples Army is offline
zeroibis
Veteran Member
Join Date: Jun 2007
Old 12-14-2009 , 21:01   Re: Bullet Tracer Plugin
Reply With Quote #6

Cool I got it working thanks to reading the code in the laser plugin

I have attached the file to this post. Note that it requires the laser_tag.games.txt file to work
Attached Files
File Type: sp Get Plugin or Get Source (tracer.sp - 1368 views - 3.1 KB)
File Type: txt laser_tag.games.txt (136 Bytes, 679 views)
__________________
zeroibis is offline
Peoples Army
SourceMod Donor
Join Date: Mar 2007
Old 12-14-2009 , 22:30   Re: Bullet Tracer Plugin
Reply With Quote #7

np ;)
__________________
Peoples Army is offline
vertexshader
Senior Member
Join Date: Mar 2008
Old 12-23-2009 , 14:39   Re: Bullet Tracer Plugin
Reply With Quote #8

laser_tag.games.txt to translations folder, correct?
vertexshader is offline
zeroibis
Veteran Member
Join Date: Jun 2007
Old 12-23-2009 , 22:41   Re: Bullet Tracer Plugin
Reply With Quote #9

Install in your gamedata, also I plan to try to add the ability to turn it on and or off in the future but I am still waiting for a reply from the creator of the laser tag plugin for permission to add the plugin to the sourcemod plugin list.

*Oops sorry about that had a brain fart there lol
__________________

Last edited by zeroibis; 12-24-2009 at 00:06.
zeroibis is offline
meng
Veteran Member
Join Date: Oct 2005
Location: us
Old 12-23-2009 , 22:52   Re: Bullet Tracer Plugin
Reply With Quote #10

Quote:
Originally Posted by vertexshader View Post
laser_tag.games.txt to translations folder, correct?
no, install in your gamedata folder.
__________________
.
[ 1 Dumerils Boa | 1 Cali King ]...
.
I'm a lil' spirituous.
meng is offline
Send a message via Yahoo to meng
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 06:47.


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