Blockland Forums > Modification Help
[Solved] Keybind Question [Thanks Destiny/Zack0Wack0 and Amade!]
jes00:
What is the if statement in a keybind for?
--- Code: ---if(!$ClientKill::Binds) {
$remapDivision[$remapCount] = "Client Kill Mod";
$remapName[$remapCount] = "Self Delete";
$remapCmd[$remapCount] = "loool";
$remapCount++;
$ClientKill::Binds=1;
}
--- End code ---
Amade:
Its only purpose is to prevent the keybind from being registered twice if the script it's in were to be executed twice.
jes00:
So if a keybind is calling a function when it is pushed and again when the key is released how would I make it toggle something only on release?
Destiny/Zack0Wack0:
The function that gets called ("loool") gets passed a boolean, which will be true if the keybind was just pressed or false if it was just released.
--- Code: ---function loool(%down)
{
if(!%down)
echo("Released");
else
echo("Pressed");
}
--- End code ---
jes00:
--- Quote from: Destiny/Zack0Wack0 on November 11, 2011, 06:10:58 PM ---The function that gets called ("loool") gets passed a boolean, which will be true if the keybind was just pressed or false if it was just released.
--- Code: ---function loool(%down)
{
if(!%down)
echo("Released");
else
echo("Pressed");
}
--- End code ---
--- End quote ---
It says the bolded is a syntax error : /
--- Quote ---function NightVisionToggle(%client)
{
if(!%down)
if($NightVision::isOn == 1)
{
NightVision.setVisible(0);
$NightVision::isOn = 0;
}
else if($NightVision::isOn == 0)
{
NightVision.setVisible(1);
$NightVision::isOn = 1;
}
else
// echo("Pressed");
}
--- End quote ---