[Include] [ALPHA] Throwing-Knife - A new kind of weapon
#1

Throwing-Knife


Intoduction

[CLEAN] I saw a video on ******* about throwing knives in samp, and I was too eager to make it. This include let you to create some deadly throwing knives for each player, these knives can reduce target's health percentage whenever the target gets hit by these knives. The reduction in the health percentage of the target varies from a range of 0 to 100. This is more a script rather than an include.



Code:
NOTE:
Uses PlayerAttachedObject slot '0','1','2','3'.

Versions

[c1] This is a c1 version of throwing-knives, There are some new features added to it. Now aiming completely depends upon player's crosshair. Players can throw knives vertically upwards and downwards.
Enhances gameplay as well. [Source Code go through the documentary present in the source code ]




Functions

•EquipPlayerThrowingKnife(playerid,color=-1) //"color" of the crosshair is optional
•RemoveAttachedKnives(playerid)
•UnEquipPlayerThrowingKnife(playerid)
•RemovePlayerThrowingKnife(playerid)
•GivePlayerThrowingKnife(playerid,amount)
•LetPlayerThrowKnife(playerid, clienterror[], errorcolor)


• OnPlayerThrowKnife(playerid) - Callback
• OnPlayerGetKnifed(playerid, killerid) - Callback



Dependencies

• Streamer Plug-in (incognito)



Bugs

• None yet.



Credits

• Incognito



Download

******Drive
Reply
#2

VERY good! Repped C:
Reply
#3

UPDATE

• Video added.
Reply
#4

Remembers me of murderer mode in Garry's mod and throwing knifes in POSTAL 2. You might want to fix your indentation as it looks so weird. Other than, good work.
Reply
#5

@iZN: It is the github who makes the indentation look weird. Anyway, I'll fix it.
Reply
#6

Nice, +REP, I was searching for this from years, At last I got it.
I'm allowed to fix the bugs right?
Reply
#7

@Zombie_Nest: Yes you can, but at least inform me about the bugs so that I can fix them for my future updates.
Reply
#8

Vary nice +rep
Reply
#9

The knife's position should be more closer to the player while throwing because it just looks like a knife appeared and goes through a straight line with great speed. You could get the knife more closer and increase it's speed only after it starts moving a bit.

Also, instead of doing "IsValidDynamicObject" check under OnPlayerUpdate always, go through OPU only if a variable is set. A single variable could be faster than IsValidDynamicObject check.
Reply
#10

@Lordzy:

1. The position of the knife is very close to the player, it is a streaming/processing problem.

Quote:
Originally Posted by Lordzy
Посмотреть сообщение
You could get the knife more closer and increase it's speed only after it starts moving a bit.
2. ^^ It is very difficult to do that. (Everything is not much possible in 2004's game)

3. It's a very complicated script and editing a single core thingy, is like banging your head on the wall.
Reply
#11

Quote:
Originally Posted by codectile
Посмотреть сообщение
@Lordzy:
2. ^^ It is very difficult to do that. (Everything is not much possible in 2004's game)
I suggested you that because it's actually able to. At first you can move the object with a speed to lesser distance and then use OnObjectMoved callback to do the rest.
Reply
#12

nice !
Reply
#13

Quote:
Originally Posted by Lordzy
Посмотреть сообщение
I suggested you that because it's actually able to. At first you can move the object with a speed to lesser distance and then use OnObjectMoved callback to do the rest.
After performing the above, the knife will get a observable halt for few milliseconds in air, which will look too odd. Though the movement will not be smooth.
Reply
#14

Nice Work man
Reply
#15

Quote:
Originally Posted by codectile
Посмотреть сообщение
After performing the above, the knife will get a observable halt for few milliseconds in air, which will look too odd. Though the movement will not be smooth.
I'm not completely sure about that however I've used such a technique on one of my include named L_SAM and it seemed to work pretty fine. Though, I used to check the position on a timer and then call OnObjectMoved script sided. I'm not really FORCING you to do something like that, it's just a suggestion to improve the way it looks.
Reply
#16

+1 nice thing man
Reply
#17

This is very nice, here's my little test script i made http://pastebin.com/DAmMRydA
Reply
#18

@Wizdo: Glad to see that you used OnPlayerKeyStateChange.
Reply
#19

REMOVE: i didnt fully read the post
Reply
#20

UPDATE 1:

• Added crosshair for accuracy.
• Damage range now varies from 0-20.
• Improved functions.
• Added callback "OnPlayerThrowKnife(playerid)"

-------

A new video for the BETA release will be uploaded soon.

-------

Need beta testers. (approximately 4 testers)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)