OnPlayerWeaponShot vs. Melee Weapons
#1

I've before created a mining script, it used IsPlayerInRangeOfPoint to check how near a player was when they swung a shovel... I figured I could create a new version of this script using OnPlayerWeaponShot, but the shovel/melee weapon(s) aren't detected... Maybe an OnPlayerMeleeWeaponSwung {All melee weapons are swung} function would resolve this! So, who all agrees?

(I also had a lumber jack script! But instead of shovel, obviously I used the chainsaw!)
Reply
#2

OnPlayerWeaponShot
Can you even shoot with knife/shovel?
Reply
#3

Quote:
Originally Posted by newbienoob
Посмотреть сообщение
OnPlayerWeaponShot
Can you even shoot with knife/shovel?
NO CRAP! Did you read any of this? I was suggesting a new function, OnPlayerMeleeWeaponSwung or something similiar!

Try reading before consulting, but thanks for replying!
Reply
#4

Delete.
Reply
#5

Quote:
Originally Posted by Crayder
Посмотреть сообщение
NO CRAP! Did you read any of this? I was suggesting a new function, OnPlayerMeleeWeaponSwung or something similiar!
Sorry, I just read only half of it. Anyways, it's not necessary since you can detect if player swings a melee weapons. Check if they had knife/shovel/melee weapon and check if they pressed KEY_FIRE.
Reply
#6

Quote:
Originally Posted by newbienoob
Посмотреть сообщение
Sorry, I just read only half of it. Anyways, it's not necessary since you can detect if player swings a melee weapons. Check if they had knife/shovel/melee weapon and check if they pressed KEY_FIRE.
That doesnt detect when a player hits an object or player, and again I would need to check the range...

Quote:
Originally Posted by [vTc]Patroool
Посмотреть сообщение
Under scripting help section you are suggesting?
This is kind'of a topic about 0.3z period, so yea, read the title?
Reply
#7

Use OnPlayer(Take/Give)Damage in combination with weaponid in order to detect melee weapon hits.
Reply
#8

Quote:
Originally Posted by FufLa
Посмотреть сообщение
Use OnPlayer(Take/Give)Damage in combination with weaponid in order to detect melee weapon hits.
That would work only if I was hitting a player, if you may you could read the topic... I need to detect when the shovel hits the rock...
Reply
#9

The thing about melee weapons is that they don't actually have one way to "swing" or "hit" something. When punching someone, occasionally the ped will change HOW they punch. Same with swinging a shovel or a club, they change the angle at which they hit something. I'm not sure if this is synced with with other players on the server, either. If I hit someone, are they going to see it exactly how I saw it, or are they going to see me hitting someone with the other angle or something.

That could be why they didn't include melee weapons...
Reply
#10

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
The thing about melee weapons is that they don't actually have one way to "swing" or "hit" something. When punching someone, occasionally the ped will change HOW they punch. Same with swinging a shovel or a club, they change the angle at which they hit something. I'm not sure if this is synced with with other players on the server, either. If I hit someone, are they going to see it exactly how I saw it, or are they going to see me hitting someone with the other angle or something.

That could be why they didn't include melee weapons...
Actually I believe these are synced because the client counts the swings and time intervals between swings, then plays the anim if it agrees on which anim it should play next... Im not sure of this but most games are easily scripting this way...
Reply
#11

I'd fiddle around a bit with camera functions check when the player swings his melee weapon (through OnPlayerKeyStateChange) to check whether the player is hitting a rock or something.
Reply
#12

Quote:
Originally Posted by Hiddos
View Post
I'd fiddle around a bit with camera functions check when the player swings his melee weapon (through OnPlayerKeyStateChange) to check whether the player is hitting a rock or something.
I'm not an extreme skilled scripter or anything, how would you go about the situation? (( Also, you mean the new camera function? That may be a really bright bulb above your head... Ill try myself, I think they check distance am I right? ))
Reply
#13

This function should be implemented, would be an extremely nice feature for mining/woodcutting scripts.
Reply
#14

Quote:
Originally Posted by Strawhats
View Post
This function should be implemented, would be an extremely nice feature for mining/woodcutting scripts.
If they implemented shot detection, hit coordinates and even object shot... Im sure they know how to do this... ("They" referring to samp team!)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)