Author Topic: Bypassing damage (Solved)  (Read 1627 times)

I am having issues damaging a player. I have packaged minigameCanDamage, and I have a minigame on. It seems I can only damage myself. Here is the code:

function minigameCanDamage(%objA, %objB)
   {
      //if(!Parent::minigameCanDamage(%objA, %objB))
      if(%objB.client.friendlyfire || %objB.friendlyfire)
         return true;
      return parent::minigameCanDamage(%objA, %objB);
   }

Not sure how it is doing it, I have done trace, and cannot find anything. Yes, the person that is attacking has the friendlyfire set to 1.
The person that is damaging is outside of the mini, and the other person is in the minigame.
« Last Edit: June 26, 2014, 01:59:42 AM by Advanced Bot »

MinigameCanDamage  takes client objects as arguments, not player objects. Ephi stated so in the projectile damage thread.
      if(%objB.client.friendlyfire || %objB.friendlyfire)
I do believe ClientObject.Client would cause some sort of trouble.

MinigameCanDamage  takes client objects as arguments, not player objects. Ephi stated so in the projectile damage thread. I do believe ClientObject.Client would cause some sort of trouble.

It takes basically anything. Attacker is usually a projectile, player or client. Target is whatever it hits. A brick, a vehicle, a player, etc.

MinigameCanDamage  takes client objects as arguments, not player objects.
Have you ever tried clients?

I tried using clients a long time ago, and it crashed my server a few times, I'm not sure how. (Probably a fault in one of my add-ons) Only SimObjects such as players, aiplayers, etc. Either way, it still would have worked since it is checking if it has that variable (most of the time the client has it)
« Last Edit: June 25, 2014, 06:19:32 AM by Advanced Bot »

MinigameCanDamage  takes client objects as arguments, not player objects. Ephi stated so in the projectile damage thread. I do believe ClientObject.Client would cause some sort of trouble.
I believe it's actually made to be compatible with tons of various object types, including bricks, vehicles, and bots. Checking the object and the object's client should cover most bases.

The problem is that objB is usually the target, not the source. You're doing this backwards.  I say usually, but I know of at least one case where the variables are put into the function the other way around, and I also can't speak for what other modders may do with it.


Quote from: Ephialtes
For checking if damage can be done through minigames, use this fruity number:

Code:
miniGameCanDamage(%client, %col);


That was just one way to use it. You can plug in a projectile and a player, a vehicle and a bot, a player and a brick. It's pretty versatile. I'd like to see the source for it, and have considered PMing Badspot about it, but it's definitely not restricted to one set of inputs.

-snip-, hold on.
« Last Edit: June 25, 2014, 03:25:19 PM by portify »

Here is the source of minigameCanDamage.
It's a little rough, but I tested it in singleplayer with bots so it should be accurate.

Submit the function source to the Coding recourses please.

Here is the source of minigameCanDamage.
It's a little rough, but I tested it in singleplayer with bots so it should be accurate.
TorqueScript isn't C# FYI.

holy stuff we all know. good loving god why did you even say that. The highlighting, I know. but it should be obvious Im not implying that ts is c# for forgets sake

holy stuff we all know. good loving god why did you even say that. The highlighting, I know. but it should be obvious Im not implying that ts is c# for forgets sake
: /

Sorry.

Fixed it.

function minigameCanDamage(%objA, %objB)
   {
      if(%objA.client.friendlyfire || %objA.friendlyfire)
         return true;
      return parent::minigameCanDamage(%objA, %objB);
   }

Looks like Jetz was right when he PM'd me, I just didn't know how I didn't listen to what he said. Seems it has to be the client. It works now for everything against them, either if there is a minigame or not, still works no matter what.

Then after looking at this
Here is the source of minigameCanDamage.
It's a little rough, but I tested it in singleplayer with bots so it should be accurate.
I understand more of how it works.
« Last Edit: June 25, 2014, 11:07:49 PM by Advanced Bot »