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

[REQ - CSS] Throw Knife


Post New Thread Reply   
 
Thread Tools Display Modes
shustas
SourceMod Donor
Join Date: May 2007
Location: London
Old 01-04-2010 , 13:19   Re: [REQ - CSS] Throw Knife
Reply With Quote #11

yes great, but like always, its easier to make another copy of adminlist than do something new ;)
__________________
shustas is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 01-12-2010 , 23:05   Re: [REQ - CSS] Throw Knife
Reply With Quote #12

Funny thing, this is actually my script. Yes I used to be sumguy14 over on ES.


I started to port this over to SM and made a lot of progress, the knives were thrown and I even got the knives to collide with the players and deal real knife damage. Unfortunately I lost the source about a year and a half ago And I haven't done anything with it since. One day I'll try to finish it off.
__________________
Greyscale is offline
rautamiekka
Veteran Member
Join Date: Jan 2009
Location: Finland
Old 01-13-2010 , 03:37   Re: [REQ - CSS] Throw Knife
Reply With Quote #13

Quote:
Originally Posted by Greyscale View Post
Funny thing, this is actually my script. Yes I used to be sumguy14 over on ES.


I started to port this over to SM and made a lot of progress, the knives were thrown and I even got the knives to collide with the players and deal real knife damage. Unfortunately I lost the source about a year and a half ago And I haven't done anything with it since. One day I'll try to finish it off.
It's already great to know that someone actually took a try for the idea Finish it when you can cuz we can wait a while longer for now.
__________________
Links to posts I received Karma from:
Big thanks to all who gave Karma

Last edited by rautamiekka; 01-13-2010 at 03:38. Reason: Changed 'Plugin' to 'idea' cuz speaking of a Plugin, when it's not started production yet, is wrongly said.
rautamiekka is offline
Send a message via ICQ to rautamiekka Send a message via AIM to rautamiekka Send a message via MSN to rautamiekka Send a message via Yahoo to rautamiekka Send a message via Skype™ to rautamiekka
Xp3r7
SourceMod Donor
Join Date: Jul 2006
Old 01-13-2010 , 06:03   Re: [REQ - CSS] Throw Knife
Reply With Quote #14

Quote:
Originally Posted by Greyscale View Post
Funny thing, this is actually my script. Yes I used to be sumguy14 over on ES.


I started to port this over to SM and made a lot of progress, the knives were thrown and I even got the knives to collide with the players and deal real knife damage. Unfortunately I lost the source about a year and a half ago And I haven't done anything with it since. One day I'll try to finish it off.
Nice.

Sorry to hear you lost the source though!

As rautamiekka said, just take your time man but as you can see, a lot of people are interested in this being a plugin!
__________________
Xp3r7 is offline
Send a message via MSN to Xp3r7
meng
Veteran Member
Join Date: Oct 2005
Location: us
Old 01-13-2010 , 18:19   Re: [REQ - CSS] Throw Knife
Reply With Quote #15

@Greyscale

i have a script that works as far as throwing the knives and dealing knife damage. but i got stuck trying to "de-lethalize" the knife. the problem is detecting when the knife hits a wall. if you would like what i have as a reference your more than welcome to it. its pretty basic right now.
__________________
.
[ 1 Dumerils Boa | 1 Cali King ]...
.
I'm a lil' spirituous.
meng is offline
Send a message via Yahoo to meng
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 01-13-2010 , 18:30   Re: [REQ - CSS] Throw Knife
Reply With Quote #16

I have lots of other stuff on my agenda right now, I don't think I'd ever get around to re-doing this.

Instead I'll just help you if you have any problems.

First off, I had used some signature a while back to deal damage as if it was coming from the thrower, but I forgot what it was. I think it was "ExplosionCreate." It pushed the player back a little too when they got hit. But this could work just as well: http://forums.alliedmods.net/showthread.php?t=111684

This is how I de-lethalized knives. I used an adt array to store each knife that was thrown and is lethal. In OnGameFrame I looped through this array (which isn't expensive because how many knives could be thrown at once?) and recorded it's position. I compared the last position to the current one and got a velocity out of it. If the velocity fell below a certain number the knife was no longer lethal.

That's a rough sketch of what I did. To store the information about the knife you'll actually need nested adt arrays. A "master" one to store the handles of adt arrays created for each thrown knife. And of course you must delete the arrays once the knife is no longer lethal.

Goodluck, hope I was clear enough.

EDIT: Actually this might be a better structure for tracking knives.


Code:
enum KnifeInfo
{
    Knife_Thrower,
    Knife_EntIndex,
    Float:Knife_LastPosition
}

new Handle:g_hLiveKnives = INVALID_HANDLE;

public OnPluginStart()
{
    g_hLiveKnives = CreateArray();
    // don't forget to maintain this, clear it on map start, don't create it twice, etc.
}

OnKnifeThrown(thrower, entindex)  // this is just a rough definition, fit the code within it into your code
{
    new knifeinfo[KnifeInfo];
    knifeinfo[Knife_Thrower] = thrower;
    knifeinfo[Knife_EntIndex] = entindex;
    knifeinfo[Knife_LastPosition] = clientpos;  // put the client's current position
    PushArrayArray(g_hLiveKnives, knifeinfo); // push the array into the master list to iterate in OnGameFrame
}

public OnGameFrame()
{
    new size = GetArraySize(g_hLiveKnives);
    for (new x = 0; x < size; x++)
    {
         // do yo thang
    }
}
__________________

Last edited by Greyscale; 01-13-2010 at 18:38.
Greyscale is offline
gaissi
Senior Member
Join Date: Sep 2009
Old 02-11-2010 , 09:11   Re: [REQ - CSS] Throw Knife
Reply With Quote #17

Hey,

Some advance at this plugin?

It would be very nice^^
gaissi is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 02-28-2010 , 01:01   Re: [REQ - CSS] Throw Knife
Reply With Quote #18

I got bored so i did some work on this. http://www.youtube.com/watch?v=FbpCJsP0H3Q Just need to find a good way to find out if the knife hit someone. Anyone got any ideas? After i get that to work i can release it
Dr!fter is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 02-28-2010 , 01:07   Re: [REQ - CSS] Throw Knife
Reply With Quote #19

Just like my old lost plugin, nice start.

The way I did it was in OnGameFrame I tracked it's velocity, comparing its last position and its current one and seeing if it traveled far enough to be considered lethal. While its considered lethal, I would try SDKHooks Touch hook, and check if the knife is touching any players.

Take a look at this for dealing damage: http://forums.alliedmods.net/showthread.php?t=111684
__________________
Greyscale is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 02-28-2010 , 09:30   Re: [REQ - CSS] Throw Knife
Reply With Quote #20

Yea i was going to use that snippet to deal damage. Hadnt thought of using sdkhooks touch hook for seeing if it was touching a player. Also out of curiosity how exactly did you check if it was lethal? I have a way of checking if its lethal aswell like you i compare the last position and current but it seems sometimes its even lethal while its sliding on the ground. If i raise the value that it has to be greater then it sometimes becomes unlethal mid air. Maybe ill need to try a float instead of just an int

Last edited by Dr!fter; 02-28-2010 at 09:33.
Dr!fter 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 17:44.


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