ItsMods

Full Version: cash or money or bounty code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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 plzBig GrinBig GrinBig Grin
you can modify _damage file ( callback_playerkilled() ), or waittil("killed_player");
also
Wrong section
moved to "Modding problems"
its very simple:
The variable you must define is
PHP Code:
self.money 
or another name (but self. on the beginning)

in _callbacksetup.gsc
PHP Code:
CodeCallback_PlayerKilled(eInflictoreAttackeriDamagesMeansOfDeathsWeaponvDirsHitLoctimeOffsetdeathAnimDuration)
{
    
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 Wink
(10-31-2011, 13:19)gumpo03 Wrote: [ -> ]its very simple:
The variable you must define is
PHP Code:
self.money 
or another name (but self. on the beginning)

in _callbacksetup.gsc
PHP Code:
CodeCallback_PlayerKilled(eInflictoreAttackeriDamagesMeansOfDeathsWeaponvDirsHitLoctimeOffsetdeathAnimDuration)
{
    
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 Wink

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;
}
but he didn't , because he followed the beginners tutorial Troll
fail itsmods is fail
(11-01-2011, 00:23)iAegle Wrote: [ -> ]
(10-31-2011, 13:19)gumpo03 Wrote: [ -> ]its very simple:
The variable you must define is
PHP Code:
self.money 
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 Wink

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);
}
PHP Code:
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 PleaseBig Grin

would this work
Code:
MonitorBounty()
{
    self endon("death");
    
    for(;;)
    {
        self waittill("human_kill");
        self.money += 50;
        wait .1;
    }
}
HuhHuhHuh

ok so i did
Code:
MonitorBounty()
{
     self endon("death");
    
     for(;;)
     {
         self waittill("human_kill");
         self.money += 50;
         wait .1;
     }
}
and
PHP Code:
self waittill("kill"); 
but those didnt work and i tried
PHP Code:
eAttack.money eAttack.money 
PHP Code:
eAttack.money +=50 
and didnt work either so what can i do to make them ADD $50 dollars to my money when i kill someone
self waittill("player_killed");
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);
Pages: 1 2