Author Topic: Cash onKill?  (Read 3540 times)

I've got no idea why its not working, and I've asked numerous people to help. The main aim of it is to give you $10 for every person you kill. I ripped it out of the gungame script, and tried to edit it for my own use, but tis not working.

Any help would be much appreciated.

Quote
package BGDeath {
function GameConnection::OnDeath(%this, %sourceObject, %sourceClient, %damageType, %damLoc)
{
%client = %sourceObject.client;
%humiltype = $DamageType["::" @ $HumiliatingDamageType];
%client.kills++;
%this.deaths++;
%client.cash = %client.cash + 10;
parent::OnDeath(%this, %sourceObject, %sourceClient, %damageType, %damLoc);
}
};
activatepackage(BGDeath);

Code: [Select]
package BGDeath
{
function GameConnection::OnDeath(%this, %sourceObject, %sourceClient, %damageType, %damLoc)
{
%humiltype = $DamageType["::" @ $HumiliatingDamageType];
%sourceClient.kills++;
%this.client.deaths++;
%sourceClient.cash += 10;
parent::OnDeath(%this, %sourceObject, %sourceClient, %damageType, %damLoc);
}
};

What're you using the %humiltype for? Is it needed?

Is this really Torque script?


There are a lot of issues with Cash mod.

I would suggest making your own. With a if(%amounttogive<0){messageclient(%client,'',"stop trying to rip people off!");return;} in the givecash function.

There are a lot of issues with Cash mod.

I would suggest making your own. With a if(%amounttogive<0){messageclient(%client,'',"stop trying to rip people off!");return;} in the givecash function.
Yeh, I fixed those bugs.

The script still didn't work, it runs fine, but doesn't give the player any cash on a kill. If theres another way to do this that I don't know about, speak up :-)
« Last Edit: August 02, 2008, 06:05:00 PM by TheBoltster »

There are a lot of issues with Cash mod.

I would suggest making your own. With a if(%amounttogive<0){messageclient(%client,'',"stop trying to rip people off!");return;} in the givecash function.
Yeh, I fixed those bugs.

The script still didn't work, it runs fine, but doesn't give the player any cash on a kill. If theres another way to do this that I don't know about, speak up :-)
When I get back to my scripting computer I will send you a version of my Give cash on death script.
Note: The code you have does look like what I have or similar.

Yeh, k

I managed to get it working though, by looking at http://www.blockland.us/smf/index.php?topic=22116.0

Quote
package bgdeath{
function GameConnection::onDeath(%this, %sourceObject, %sourceClient, %damageType, %damLoc){

%sourceClient.cash += 10;


Parent::onDeath(%this, %sourceObject, %sourceClient, %damageType, %damLoc);
}
};
activatepackage(bgdeath);

Lol, that's what I based my Bounty system off but I recently recreated it

Next;
I was going to use the lvling script out of Kunits woodcutting, but I thought I could do it in less lines. I don't exactly know why its not working.

Quote
function dmlvl()
{
   for(%c = 0; %c < ClientGroup.getcount(); %c++)
   if(%client.exp >= %lvlexp)
   {
   %client.lvl += 1;
   %lvlexp = %lvlexp *= 1.5;
   }
}

Next;
I was going to use the lvling script out of Kunits woodcutting, but I thought I could do it in less lines. I don't exactly know why its not working.

Your for() loop should brackets. Like an if().
Also, what are you doing with %lvlxp? Shouldn't it just be '%lvlxp *= 1.5;'?

Edit: Added a comment about the '%lvlxp = %lvlxp *= 1.5;' syntax.
« Last Edit: August 02, 2008, 10:45:36 PM by Dyed Brownie »

Lol, I made a way better Exp and Lvl script for it and I will be releasing in the next update along with the rest of the Edit's.

Tom

I This reminds me that i need to finish my cashmod.

Lol, I made a way better Exp and Lvl script for it and I will be releasing in the next update along with the rest of the Edit's.

I've seen it a version of it and I don't think looping through clients and going through 30 if functions every second is a good idea.