onPlayerKill is not working

Started by Mötley, Mar 18, 2016, 09:16 PM

Previous topic - Next topic

Decent_946

#15
Quote from: Xmair on Mar 19, 2016, 09:23 AM*again coughs*
DistanceFromPoint ( x1, y1, x2, y2 )
error: z missing.

MacTavish

Quote from: Decent_946 on Mar 19, 2016, 09:24 AM
Quote from: Xmair on Mar 19, 2016, 09:23 AM*again coughs*
DistanceFromPoint ( x1, y1, x2, y2 )
error: x3 missing.

DistanceFromPoint(killer.Pos.x, killer.Pos.y, player.Pos.x,player.Pos.y);

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

KAKAN

Quote from: Decent_946 on Mar 19, 2016, 09:24 AM
Quote from: Xmair on Mar 19, 2016, 09:23 AM*again coughs*
DistanceFromPoint ( x1, y1, x2, y2 )
error: x3 missing.
What's the use of x3 there?
I would say, z1, z2 are missing. Why would someone need the Z here?
oh no

Xmair


Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

Decent_946

Quote from: Xmair on Mar 19, 2016, 09:35 AM@Decent_946 , ever viewed the wiki?
ofc, btw, atm i am too depressed cuz of my test. so that's why..
i 1st wanted to post that function but thought to give z axis also. ;) .

Stormeus

Quote from: Kusanagi on Mar 19, 2016, 09:30 AM
Quote from: Decent_946 on Mar 19, 2016, 09:24 AM
Quote from: Xmair on Mar 19, 2016, 09:23 AM*again coughs*
DistanceFromPoint ( x1, y1, x2, y2 )
error: x3 missing.

DistanceFromPoint(killer.Pos.x, killer.Pos.y, player.Pos.x,player.Pos.y);

killer.Pos.Distance(player.Pos)

Mötley

#21
you guys are amazing!!! I noticed something I dont like, and that is bodypart names say head, right leg, left leg., right arm, left arm, and Dick, I guess i should create locals...?

Murdock

Quote from: Mr_Motley on Mar 19, 2016, 04:12 PMyou guys are amazing!!! I noticed something I dont like, and that is bodypart names say head, right leg, left leg., right arm, left arm, and Dick, I guess i should create locals...?

I assume your server does not have female skins then

Mötley

Quote from: Murdock on Mar 19, 2016, 04:36 PM
Quote from: Mr_Motley on Mar 19, 2016, 04:12 PMyou guys are amazing!!! I noticed something I dont like, and that is bodypart names say head, right leg, left leg., right arm, left arm, and Dick, I guess i should create locals...?

I assume your server does not have female skins then
lel never would of thought of that ;D


is it possible to turn the body part ids, From ids to words?

DizzasTeR


Mötley

#25
??? I Am confused as I am looking for body part names? I really do not understand that post

LOL fixed

if ( limb == 1 ) limb = "Dick";

Message( killer + " sent to hospital " + player + " (" + wep + ") (" + limb + ") (" + distance + "m)" );
Speacial thanks to PunkNoodle

MacTavish

this post may help you http://forum.vc-mp.org/?topic=400.msg2563#msg2563 you can edit returning instance as you want them like left shoulder instead left arm

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

Mötley

Yes I like that method better than

function onPlayerTeamKill( killer, player, reason, bodypart) onPlayerKill( killer, player, reason, bodypart)
function onPlayerKill( killer, player, reason, bodypart)
{
local pos = killer.Pos;
local rot = killer.Angle, rad = rot * PI / 180.0;
local x = pos.x, y = pos.y, z = pos.z;
local x2 = x + 0.01 * cos(rad) - 5.0 * sin(rad);
local y2 = y + 0.01 * sin(rad) + 5.0 * cos(rad);
local wep = GetWeaponName( reason ), limb = ( bodypart ), distance = DistanceFromPoint(killer.Pos.x, killer.Pos.y, player.Pos.x,player.Pos.y);
if ( limb == 0 ) limb = "Torso";
if ( limb == 1 ) limb = "Dick";
if ( limb == 6 ) limb = "Head";
if ( limb == 3 ) limb = "Right-Arm";
if ( limb == 4 ) limb = "Left-Leg";
if ( limb == 5 ) limb = "Right-Leg";
if ( limb == 2 ) limb = "Left-Arm";


Message( killer + " sent to hospital " + player + " (" + wep + ") (" + limb + ") (" + distance + "m)" );

return 1;
}
I will convert

MaTaDeToR

Quote from: Mr_Motley on Mar 19, 2016, 05:40 PMYes I like that method better than

function onPlayerTeamKill( killer, player, reason, bodypart) onPlayerKill( killer, player, reason, bodypart)
function onPlayerKill( killer, player, reason, bodypart)
{
local pos = killer.Pos;
local rot = killer.Angle, rad = rot * PI / 180.0;
local x = pos.x, y = pos.y, z = pos.z;
local x2 = x + 0.01 * cos(rad) - 5.0 * sin(rad);
local y2 = y + 0.01 * sin(rad) + 5.0 * cos(rad);
local wep = GetWeaponName( reason ), limb = ( bodypart ), distance = DistanceFromPoint(killer.Pos.x, killer.Pos.y, player.Pos.x,player.Pos.y);
if ( limb == 0 ) limb = "Torso";
if ( limb == 1 ) limb = "Dick";
if ( limb == 6 ) limb = "Head";
if ( limb == 3 ) limb = "Right-Arm";
if ( limb == 4 ) limb = "Left-Leg";
if ( limb == 5 ) limb = "Right-Leg";
if ( limb == 2 ) limb = "Left-Arm";


Message( killer + " sent to hospital " + player + " (" + wep + ") (" + limb + ") (" + distance + "m)" );

return 1;
}
I will convert
However, this could be a great use of Switch.

rww

Sorry for bump...

@MaTaDeToR

In ClientMessage/ClientMessageToAll function you can use RGB or RGBA ;) Before you can use only RGBA (year ago).
Join to Irrelevant Club Discord: https://discord.gg/MsPPZ5uV4X