Posts: 106
Threads: 35
Joined: Jun 2011
Reputation:
1
Hey i need somebodys help on a ode for me zombie mod. i need a code where when you kill somebody you get money like 50 dollars and then you can buy something in the menu.
can somebody help me out plz
Posts: 3,704
Threads: 147
Joined: Jan 2011
Reputation:
119
you can modify _damage file ( callback_playerkilled() ), or waittil("killed_player");
also
Wrong section
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Posts: 6,052
Threads: 429
Joined: Oct 2010
moved to "Modding problems"
Posts: 61
Threads: 18
Joined: Jul 2011
Reputation:
1
its very simple:
The variable you must define is
or another name (but self. on the beginning)
in _callbacksetup.gsc
PHP Code: CodeCallback_PlayerKilled(eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration) { self endon("disconnect");
you can put code like
PHP Code: eAttacker.money = eAttacker.money + 50;
This is to give the killer of the player 50 "Money".
Hope its all right
Sorry for bad English -> *GERMAN*
Posts: 1,830
Threads: 104
Joined: Jan 2011
Reputation:
46
(10-31-2011, 13:19)gumpo03 Wrote: its very simple:
The variable you must define is
or another name (but self. on the beginning)
in _callbacksetup.gsc
PHP Code: CodeCallback_PlayerKilled(eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration) { self endon("disconnect");
you can put code like
PHP Code: eAttacker.money = eAttacker.money + 50;
This is to give the killer of the player 50 "Money".
Hope its all right
actually if you followed the right tutorial: "Modding, The right way" you can do this without modifying any of the existing files just by defining "level.onPlayerKilled" and making a function for it
Code: init()
{
level.onPlayerKilled = ::onPlayerKilled;
}
onPlayerKilled( eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration )
{
if( isDefined( eAttacker ) && isPlayer( eAttacker ) && eAttacker != self )
eAttacker.money += 50;
}
Posts: 5,320
Threads: 300
Joined: Feb 2011
Reputation:
149
11-01-2011, 00:34
(This post was last modified: 11-01-2011, 00:34 by JariZ.)
but he didn't , because he followed the beginners tutorial
fail itsmods is fail
Posts: 106
Threads: 35
Joined: Jun 2011
Reputation:
1
11-02-2011, 01:30
(This post was last modified: 11-02-2011, 02:11 by Gamemaster20.)
(11-01-2011, 00:23)iAegle Wrote: (10-31-2011, 13:19)gumpo03 Wrote: its very simple:
The variable you must define is
or another name (but self. on the beginning)
in _callbacksetup.gsc
CodeCallback_PlayerKilled(eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration)
{
self endon("disconnect");[/php]
you can put code like
PHP Code: eAttacker.money = eAttacker.money + 50;
This is to give the killer of the player 50 "Money".
Hope its all right
actually if you followed the right tutorial: "Modding, The right way" you can do this without modifying any of the existing files just by defining "level.onPlayerKilled" and making a function for it
Code: init()
{
level.onPlayerKilled = ::onPlayerKilled;
}
onPlayerKilled( eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration )
{
if( isDefined( eAttacker ) && isPlayer( eAttacker ) && eAttacker != self )
eAttacker.money += 50;
}
ok so like in init i would put PHP Code: level.onPlayerKilled = ::onPlayerKilled;
and i can make a new thread called Cash or something and put something like Code: OnPlayerKilled()
{
if( isDefined( player ) && isPlayer() && player != self )
eAttacker.money += 50;
}
[/quote]
like something like that??
ok so i got a code and it works for the texts and stuff
heres code this was in point system thread:
Code: Cash()
{
self.money_text destroy();
self.money_num destroy();
//Money text
self.money_text = newClientHudElem(self);
self.money_text.alignX = "left";
self.money_text.alignY = "bottom";
self.money_text.horzAlign = "left";
self.money_text.vertAlign = "bottom";
self.money_text.alpha = 1;
self.money_text.x = 5;
self.money_text.y = -100;
self.money_text.fontscale = 1.4;
self.money_text.color = (0,0.6,0);
self.money_text setText("$ ");
//Money number
self.money_num = newClientHudElem(self);
self.money_num.alignX = "left";
self.money_num.alignY = "bottom";
self.money_num.horzAlign = "left";
self.money_num.vertAlign = "bottom";
self.money_num.x = 52;
self.money_num.y = -100;
self.money_num.alpha = 1;
self.money_num.fontscale = 1.4;
self.money_num.color = (0,0.6,0);
self.money_num setValue(self.bounty);
}
This works but i need a code where when you kill someone you will get money without adding _callback(something).gsc i just need the cach thing to be in the _rank not anything else Please
would this work
Code: MonitorBounty()
{
self endon("death");
for(;;)
{
self waittill("human_kill");
self.money += 50;
wait .1;
}
}
Posts: 106
Threads: 35
Joined: Jun 2011
Reputation:
1
ok so i did
Code: MonitorBounty()
{
self endon("death");
for(;;)
{
self waittill("human_kill");
self.money += 50;
wait .1;
}
}
and but those didnt work and i tried
PHP Code: eAttack.money = eAttack.money +
and didnt work either so what can i do to make them ADD $50 dollars to my money when i kill someone
Posts: 2,992
Threads: 55
Joined: Feb 2011
Reputation:
114
self waittill("player_killed");
Posts: 1,830
Threads: 104
Joined: Jan 2011
Reputation:
46
You don't have to make 2 hud elements just to show "$" and "value" .. you can just do
self.money_num = newClientHudElem(self);
self.money_num.alignX = "left";
self.money_num.alignY = "bottom";
self.money_num.horzAlign = "left";
self.money_num.vertAlign = "bottom";
self.money_num.x = 52;
self.money_num.y = -100;
self.money_num.alpha = 1;
self.money_num.fontscale = 1.4;
self.money_num.color = (0,0.6,0);
self.money_num.label = "$";
self.money_num setValue(self.bounty);
|