onPlayerKill is not working

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

Previous topic - Next topic

Mötley

even tried the wiki version \/

function onPlayerKill( killer, player, reason, bodypart )
{
    Message( "** " + killer.Name + " killed " + player.Name + " (" + GetWeaponName( reason ) + ") (" + bodypart + ")" );   
}

any explanation to why or what could be interfering with this?

i even added print. Nothing ???

aXXo

I'm guessing that when you tested it, the killer and player were in the same team.
That would have resulted in calling onPlayerTeamKill and skipped onPlayerKill

Mötley

I did not think of this as i don't have teams, When I get off of work i will retest! problem more than likely solved! Thanks

rww

This isn't LU! You can use only ClientMessage and ClientMessageToAll for send message on chat ;)

function onPlayerKill( killer, player, reason, bodypart )
{
ClientMessageToAll( "** " + killer.Name + " killed " + player.Name + " (" + GetWeaponName( reason ) + ") (" + bodypart + ")",255,128,0,255);   
}
Join to Irrelevant Club Discord: https://discord.gg/MsPPZ5uV4X

Mötley

I had noticed this in the wiki. but MessagePlayer does exist and this Message is in the wiki. I will convert some time, Thanks for the tip! ;)

rww

#5
My mistake.. You can use MessagePlayer/Message on VC-MP, but i never use this functions, and I think that doesn't exist.
Join to Irrelevant Club Discord: https://discord.gg/MsPPZ5uV4X

KAKAN

Message and other shits work well here.
Motley, try this:
function onPlayerTeamKill( k, p, r, b ) onPlayerKill( k, p, r, b );
function onPlayerKill( k, p, r, b ){
Message("Something happened");
}
oh no

Mötley

Quote from: KAKAN on Mar 19, 2016, 02:42 AMMessage and other shits work well here.
Motley, try this:
function onPlayerTeamKill( k, p, r, b ) onPlayerKill( k, p, r, b );
function onPlayerKill( k, p, r, b ){
Message("Something happened");
}

LOL something happened !
I never thought of sharing functions together " You taught me something.

I would of done
|

k, p, r, bwhat does this stand for?

killer, player, r, b,???

MaTaDeToR

#8
Quote from: Mr_Motley on Mar 19, 2016, 04:03 AM
Quote from: KAKAN on Mar 19, 2016, 02:42 AMMessage and other shits work well here.
Motley, try this:
function onPlayerTeamKill( k, p, r, b ) onPlayerKill( k, p, r, b );
function onPlayerKill( k, p, r, b ){
Message("Something happened");
}

LOL something happened !
I never thought of sharing functions together " You taught me something.

I would of done
|

k, p, r, bwhat does this stand for?

killer, player, r, b,???

Well, you could name these events anything you know,
function onPlayerKill( killer, player, reason, bodypart )
{
ClientMessageToAll("" + player + " Has been killed by " + killer + "",255,255,0);
}
like function onPlayerKill( THE_KILLER, VICTIM, OV_Reason, WHICH_PART_IT_SHOOT )
{
ClientMessageToAll("" + VICTIM + " Has been killed by " + THE_KILLER + "",255,255,0);
}
will work the same ;)
AND
function onPlayerKill( killer, player, reason, bodypart )
{
 ClientMessageToAll( "** " + killer.Name + " killed " + player.Name + " (" + GetWeaponName( reason ) + ") (" + bodypart + ")"[code],255,128,0,255
);   
}
change this line to
ClientMessageToAll( "** " + killer.Name + " killed " + player.Name + " (" + GetWeaponName( reason ) + ") (" + bodypart + ")",255,128,255); Since in RGB Colors, only three colors are used not FOUR! 255,128,0,255 @rwwpl wpl ;)

Xmair

*cough cough*
You're wrong Mr.@KAKAN , It's RGBA. You can provide 4 parameters.

Credits to Boystang!

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

MaTaDeToR

Quote from: Xmair on Mar 19, 2016, 04:18 AM*cough cough*
You're wrong Mr.@KAKAN , It's RGBA. You can provide 4 parameters.
Okay, never thougt of that. :)

Mötley

#11
So what do I need to do to have only One kill function? I want to have a Independent server. looks like its going to take a lot of stress testing on the kill system as Teams are set default unfortunately instead of adding scripted support for teams?

any suggestions would be helpful. ^^^^ everything in this post has helped me a lot!!! Thanks Everyone

@KAKAN THANKS FOR THE CODE! I modified it

"I just wish there was a distance function in the wiki so i can write longest headshots to stats!

Honestly! "I am too much of a noob to know how to script that " ???

somethings I just don't know and majority of the time when i see a code like distance I think "why didn't I think of that!

KAKAN

Quote from: Xmair on Mar 19, 2016, 04:18 AM*cough cough*
You're wrong Mr.@KAKAN , It's RGBA. You can provide 4 parameters.
Well, what are you talking about? I don't need alpha in the WastedScreen function. So, why shall I use it? Don't worry, you won't be able to see the wasted screen since the fain and fadeout time is 0 ms :P

Quote from: MaTaDeToR on Mar 19, 2016, 04:07 AMWell, you could name these events anything you know,

Sorry, was at phone at that time.

Quote from: Mr_Motley on Mar 19, 2016, 04:03 AMk, p, r, bwhat does this stand for?

killer, player, r, b,???

Reason, bodypart :P Well, you can see the onPlayerKill's params, it's exactly same as of onPlayerTeamKill.
oh no

Decent_946

Quote from: Mr_Motley on Mar 19, 2016, 04:32 AM"I just wish there was a distance function in the wiki so i can write longest headshots to stats!
there you go. ( donno who made it )
function Distance(x1, y1, x2, y2)
{
local dist = sqrt(((x2 - x1)*(x2 - x1)) + ((y2 - y1)*(y2 - y1)));
return dist;
}

just an example of using the function.
function onPlayerKill( killer, player, bodypart, reason )
{
PrivMessage( player, "killed by "+killer.Name+" Distance: "+Distance( killer.Pos.x, killer.Pos.y, player.Pos.x, player.Pos.y )+"." );
}

Xmair

*again coughs*
DistanceFromPoint ( x1, y1, x2, y2 )

Credits to Boystang!

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