Solved
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menuconst achan = "#blahstaf"; // Home channel
const pass = "";
if ( channel == chan )
{
// Find the text that was typed.
local
FindText = split( raw[ 0 ], ":" ),
text = FindText.len() > 1 ? FindText[ 1 ] : "",
prefix = text != "" ? text.slice( 0, 1 ) : "";
// Find the command that was typed.
local
Findcmd = text != "" ? split( text, " " ) : "",
cmd = Findcmd != "" ? Findcmd[ 0 ].slice( 1, Findcmd[ 0 ].len() ) : "";
// Find the text that was typed after the command.
local
NewText = text != "" ? strip( text.slice( cmd.len() + 1, text.len() ) ) : "";
// Find the person that typed the text.
local
FindNick = split( raw[ 0 ], "!" ),
Nick = FindNick[ 0 ].slice( 1, FindNick[ 0 ].len() );
// Ensure a command was typed with our prefix.
if ( prefix == PREFIX )
{
// Depending how many bot's we have connected, depends how many times we recieve the data.
// So we need to only forward the last recieved data to the command handler.
// We do this using the 'Modulus Operator', This checks that our 'data recieved counter' devides into
// the total number of bot's we have connected, ensuring that we only forward the recieved data once.
if ( count % BotNick.len() == 0 )
{
// Forward to our command handler.
ProcessCommands( Nick, cmd, NewText );
}
// Increase our 'recieved data' counter.
count++;
}
}
if ( channel == achan )
{
// Find the text that was typed.
local
FindText = split( raw[ 0 ], ":" ),
text = FindText.len() > 1 ? FindText[ 1 ] : "",
prefix = text != "" ? text.slice( 0, 1 ) : "";
// Find the command that was typed.
local
Findcmd = text != "" ? split( text, " " ) : "",
cmd = Findcmd != "" ? Findcmd[ 0 ].slice( 1, Findcmd[ 0 ].len() ) : "";
// Find the text that was typed after the command.
local
NewText = text != "" ? strip( text.slice( cmd.len() + 1, text.len() ) ) : "";
// Find the person that typed the text.
local
FindNick = split( raw[ 0 ], "!" ),
Nick = FindNick[ 0 ].slice( 1, FindNick[ 0 ].len() );
// Ensure a command was typed with our prefix.
if ( prefix == PREFIX )
{
// Depending how many bot's we have connected, depends how many times we recieve the data.
// So we need to only forward the last recieved data to the command handler.
// We do this using the 'Modulus Operator', This checks that our 'data recieved counter' devides into
// the total number of bot's we have connected, ensuring that we only forward the recieved data once.
if ( count % BotNick.len() == 0 )
{
// Forward to our command handler.
FBSStaffCommand( Nick, cmd, NewText );
}
// Increase our 'recieved data' counter.
count++;
}
}
}
Quote from: Murdock on Dec 07, 2017, 08:44 AMI think the problem is a division by zero, not sure thoughHi murdock Thanks for your help you're right it was division with zero.Any way to stop it ? mean if the kills are 0 then it don't gives ratio