PDA

View Full Version : OnPlayerWeaponShot vs. Melee Weapons


Crayder
23/02/2014, 09:20 AM
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!)

newbienoob
23/02/2014, 09:26 AM
OnPlayerWeaponShot
Can you even shoot with knife/shovel?

Crayder
23/02/2014, 09:30 AM
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!

Bingo
23/02/2014, 09:33 AM
Delete.

newbienoob
23/02/2014, 09:38 AM
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.

Crayder
23/02/2014, 09:41 AM
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...

Patroool;2926099']Under scripting help section you are suggesting?

This is kind'of a topic about 0.3z period, so yea, read the title?

FufLa
23/02/2014, 07:31 PM
Use OnPlayer(Take/Give)Damage in combination with weaponid in order to detect melee weapon hits.

Crayder
23/02/2014, 09:23 PM
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...

Scenario
23/02/2014, 09:26 PM
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...

Crayder
23/02/2014, 09:55 PM
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...

Hiddos
24/02/2014, 01:32 AM
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.

Crayder
24/02/2014, 06:24 AM
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? ))

Baboon
24/02/2014, 08:02 AM
This function should be implemented, would be an extremely nice feature for mining/woodcutting scripts.

Crayder
25/02/2014, 06:13 AM
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!)