Author Topic: Brick collison  (Read 680 times)

I'm making a decollisoner weapon and i was wondering, how do you change if the brick has a colliosn or not. Ithought it was .setcollidable = 0; or .collison = 0;


Ty

EDIT: New problem i keep getting Syntax errors can someone help
This is where the errors are coming in
Code: [Select]
function DecollisionerProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
if(%col.getClassName() $= "fxDTSBrick")
{
if(getTrustLevel(%client,%col) == 2 || %Client.isSuperAdmin)
{
if(!%col.Colliding(0)
{
%col.setColliding(0);
commandToClient(%client,'CenterPrint',"This brick does not have collison.",3);
}
else
{
%col.setColliding(1);
commandToClient(%client,'CenterPrint',"<color:33ff33>This Brick has collison.",3);
}
}
else
{
commandToClient(%client,'centerprint',%Col.getGroup().name SPC "does not trust you enough to do that.",3);
}
}
else
{
commandToClient(%client,'centerprint',"For this to work you must use it on a brick.",3);
}
}
« Last Edit: May 29, 2009, 08:09:57 PM by Plornt »


Code: [Select]
function DecollisionerProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
if(%col.getClassName() $= "fxDTSBrick")
{
if(getTrustLevel(%client,%col) == 2 || %Client.isSuperAdmin)
{
if(%col.colliding)
{
%col.setColliding(0);
commandToClient(%client,'CenterPrint',"This brick does not have collison.",3);
}
else
{
%col.setColliding(1);
commandToClient(%client,'CenterPrint',"<color:33ff33>This Brick has collison.",3);
}
}
else
{
commandToClient(%client,'centerprint',%Col.getGroup().name SPC "does not trust you enough to do that.",3);
}
}
else
{
commandToClient(%client,'centerprint',"For this to work you must use it on a brick.",3);
}
}
!%col.colliding(0 makes no sense. You'd have to use another parenthesees and it wouldn't make much sense if it was false.

You have no idea about the structure of programming who ever made that, if you state else like 8 1/2 times, it won't be able to distinguish what it should do if its else. Here let me fix your code:
Code: [Select]
function DecollisionerProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
if(%col.getClassName() $= "fxDTSBrick")
{
if(getTrustLevel(%client,%col) == 2 || %Client.isSuperAdmin)
{
         if($IsColliding[%col] == 1)
         {
%col.setColliding(0);
                        $IsColliding[%col] = 0;
commandToClient(%client,'CenterPrint',"This brick does not have collision anymore.",3);
}
else
{
%col.setColliding(1);
                        $IsColliding[%col] = 1;
commandToClient(%client,'CenterPrint',"<color:33ff33>This Brick has collision now.",3);
}
}
else if(getTrustLevel(%client,%col) < 2)
{
commandToClient(%client,'centerprint',%Col.getGroup().name SPC "does not trust you enough to do that.",3);
}
}
else if(%col.getClassName() !$= "fxDTSBrick")
{
commandToClient(%client,'centerprint',"For this to work you must use it on a brick.",3);
}
}
And if that doesn't work, tell us where it syntaxes so we can actually help you, it might be wrong, I don't feel like re-reading that.
« Last Edit: May 29, 2009, 10:45:13 PM by AGlass0fMilk »

Code: [Select]
function DecollisionerProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
if(%col.getClassName() $= "fxDTSBrick")
{
if(getTrustLevel(%client,%col) == 2 || %Client.isSuperAdmin)
{
if(%col.colliding)
{
%col.setColliding(0);
commandToClient(%client,'CenterPrint',"This brick does not have collison.",3);
}
else
{
%col.setColliding(1);
commandToClient(%client,'CenterPrint',"<color:33ff33>This Brick has collison.",3);
}
}
else
{
commandToClient(%client,'centerprint',%Col.getGroup().name SPC "does not trust you enough to do that.",3);
}
}
else
{
commandToClient(%client,'centerprint',"For this to work you must use it on a brick.",3);
}
}
!%col.colliding(0 makes no sense. You'd have to use another parenthesees and it wouldn't make much sense if it was false.
Woops my copy and paste screwd that up.
And milk ill try that.

EDIT: I got it to work by rewriting the thing.
« Last Edit: May 29, 2009, 10:53:39 PM by Plornt »