Author Topic: Help with binding  (Read 466 times)

This is the final part to my train vehicle

Code: (Torque) [Select]
//Ripped from speedgui which was ripped from greekbots

if(!$SubwayVehicle_Binded)
{
    $remapDivision[$remapCount] = "Trains";
    $remapName[$remapCount] = "Toggle Bell";
    $remapCmd[$remapCount] = "togglebellcommand";
    $remapCount++;
    $SubwayVehicle_Binded = 1;
}

function togglebellcommand()
{
    commandtoserver('togglebell');

}

function AddBind(%division, %name, %command)
{
for(%i=0;%i<$remapCount;%i++)
{
if($remapDivision[%i] $= %division)
{
%foundDiv = 1;
continue;
}
if(%foundDiv && $remapDivision[%i] !$= "")
{
%position = %i;
break;
}
}
if(!%foundDiv)
{
error("Division not found: " @ %division);
return;
}
if(!%position)
{
$remapName[$remapCount] = %name;
$remapCmd[$remapCount] = %command;
$remapCount++;
return;
}
for(%i=$remapCount;%i>%position;%i--)
{
$remapDivision[%i] = $remapDivision[%i - 1];
$remapName[%i] = $remapName[%i - 1];
$remapCmd[%i] = $remapCmd[%i - 1];
}
$remapDivision[%position] = "";
$remapName[%position] = %name;
$remapCmd[%position] = %command;
$remapCount++;
}
The problem is it keeps send the command to the server when I release it AND when I press it.

I only want it to be sent when I release w/e key.

keybinds automatically send a pressed/released argument to the function

Code: [Select]
function togglebellcommand(%val)
{
   //if released
   if(!%val)
      commandtoserver('togglebell');

}

keybinds automatically send a pressed/released argument to the function

Code: [Select]
function togglebellcommand(%val)
{
   //if released
   if(!%val)
      commandtoserver('togglebell');

}
Thanks, releasing soon. Thank god you're back on.