Hey, I just recently started modding (actually yesterday), and I've been searching around for a while to find a method that lets me for instance give the player full ammo on his weapon whenever he/she kills someone. I read something about "onPlayerKilled()", tried searching in _rank.gsc and couldn't find it, so I wrote it myself as a seperate method inside _rank.gsc:
This didn't help at all, so I was wondering if any of you hardcore modders out there could help me with it. (And yes, I had already given the player the weapon indicated) I'd also appreciate if you'd help me nail the basic classes that I need to know about other than _rank.gsc
Thank you in advance!
What exactly is self.bounty? And why do we add 75 to it? And do I have to call this method within _rank.gsc or how does it come together?
My programming knowledge is limited to basic java, and I'm trying to understand how this language connects.
I had the same problem, you have to call the CallbackOnPlayerDeath.
This is the original Callback
Code:
/*================
Called when a player has been killed.
self is the player that was killed.
================*/
CodeCallback_PlayerKilled(eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration)
{
self endon("disconnect");
[[level.callbackPlayerKilled]](eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration);
}
But i had to rewrite it because it was giving me loads of problems, first of all you need to write this new fuction on _rank.gsc
Code:
onserverstart()
{
wait 1; //to ensure the callbacks are already written
//store the old callbacks
level.oldcallbackplayerkilled=level.callbackplayerkilled;
//now, create new callbacks
level.callbackplayerkilled=::killed;
}
You just have to play around with eAttacker(the attacker) in the code up here, you get a message when you killed someone, but if you change it around it will show a message when they kill you.
Im also adding the original file where i found the function, i have to upload it lika a .txt, but is a gsc file.