Author Topic: Questions  (Read 4800 times)

I have some questions.

1. I am editing my fire mod and I want it to have a 1/4 chance to do something. How would I do a 1 in 4 chance?



2. Checking for explosion damage.
How do I check if something is damaged by an explosion?
« Last Edit: December 09, 2009, 08:22:00 PM by heedicalking »

have a random var? i actually know a little C++ :D

Code: [Select]
if(getRandom(1,4)==1);Am I right?

Code: [Select]
if(getRandom(1,4)==1);Am I right?
Code: [Select]
if(!getRandom(0,3));Same thing, but a whole two bytes shorter. (Hooray for negligible optimization!)

What about making certain vehicles admin only. Like if I want to spawn a tank, I have to be an admin

onMount, you can check whether the player is an admin.

onMount, you can check whether the player is an admin.
Spawning vehicles admin only.

Code: [Select]
function GrondramProjectile::radiusDamage(%this, %obj, %col, %distanceFactor, %pos, %damageAmt)
{

  if(isobject(%obj.client.minigame))
{
    if(%col.getclassname()$=fxDTSbrick)
{
    deletebrickRAM(%col);
    }
  }
else
{
    messageclient(%obj.client,'',"You are not in a minigame.");
  }


}
function deletebrickRAM(%obj)
{
%obj.killbrick();
}

Doesn't delete the brick. The minigame check works though

Code: [Select]
function GrondramProjectile::radiusDamage(%this, %obj, %col, %distanceFactor, %pos, %damageAmt)
{
if(%col.getclassname() $= fxDTSBrick)
{
if(minigameCanDamage(%obj,%col))
{
%col.killBrick();
  }
else
{
messageclient(%obj.client,'',"You are not in a minigame.");
  }
}
}

It doesn't kill the brick, nor does it do the minigame check.

Code: [Select]
function serverCmdClass(%client, %Class)
{
if(%Class == Elf)
{
%client.HeedRP["PlayerClass"] = %Class;
}
}
It isn't working. I decided to re start an old project of mine but I need this.


How would I do a team damage thing. I checked TDM but could not find anything. I want it so if you shoot your own class, your Rep1 gets taken away. I am only looking for team shooting, not enemy killing or anything else.
1Rep- Example below.
%client.Elves.rep
%client.Dwarves.rep

Your rep with a certain class will edit throughout the RP based on what you do. If you shoot your own class, you lose rep with that team. If you hunt the enemy class, you lose rep with them.

Also
Code: [Select]
function serverCmdgiveGold(%client, %Gold, %name)
{
%Gold = mFloor(%Gold);

if(%Gold > 0)
{
if((%client.Roleplay["Gold"] - %Gold) >= 0)
{
if(isObject(%client.player))
{
if(%name != "")
{
%target = findclientbyname(%name);
}
else
{
%target = containerRayCast(%client.player.getEyePoint(), vectorAdd(vectorScale(vectorNormalize(%client.player.getEyeVector()), 5), %client.player.getEyePoint()), $typeMasks::playerObjectType,%client.player).client;
}
if(isObject(%target))
{
messageClient(%client, '', "\c6You give \c3$" @ %money SPC "\c6to \c3" @ %target.name @ "\c6.");
messageClient(%target, '', "\c3" @ %client.name SPC "\c6has given you \c3$" @ %money @ "\c6.");

%client.Roleplay["Gold"] -= %Gold;
%target.Roleplay["Gold"] += %Gold;


}
else
messageClient(%client, '', "\c6You must be looking at and be in a reasonable distance of the player in order to give them money. \nYou can also type in the person's name after the amount.");
}
else
messageClient(%client, '', "\c6Spawn first before you use this command.");
}
else
messageClient(%client, '', "\c6You don't have that much gold to give.");
}
else
messageClient(%client, '', "\c6You must enter a valid amount of gold to give.");
}
String evaluates to 0 on the line with
Code: [Select]
if(%name != "")

Well, you're going to need some basic knowledge of dump(), and it's ability. Find the "Function" that you need, in this case you would need to find the function relating to OnProjectileHit, OnDamageTake or whatever the name is. Using the Dump function you can find out all of the information passable through the function Dump is used upon. Doing so will allow you to use the function do set the "Rep" of a player.