Quantcast

Jump to content

» «
Photo

How do I make a disabling hotkey as well as enabli

3 replies to this topic
DanceNSmile
  • DanceNSmile

    Player Hater

  • Members
  • Joined: 15 Jun 2013

#1

Posted 16 June 2013 - 02:44 AM

Something like
they press #8 and it enables the script
then they press #8 again to disable script.
How do you do that?

ChopTheDog.
  • ChopTheDog.

    War. War never changes.

  • Members
  • Joined: 31 May 2010
  • None

#2

Posted 16 June 2013 - 02:56 AM Edited by The_Sorrow, 16 June 2013 - 03:04 AM.

QUOTE (DanceNSmile @ Sunday, Jun 16 2013, 03:44)
Something like
they press #8 and it enables the script
then they press #8 again to disable script.
How do you do that?

This is a basic template of the script you're wanting:

CODE
{$CLEO}
0000:

$scriptStatus = 0 // Not enabled

:1
wait 0
if and
0256:   player $PLAYER_CHAR defined // Player defined
0AB0:  key_pressed 0x38             // Key 8 pressed
jf @1

:2
wait 0
if
$scriptStatus == 1     // Is the script enabled?
jf @enable             // If not enabled then enable it
jump @disable          // If enabled then disable it

:enable
// Enable script here
$scriptStatus = 1 // Enabled
// Do code
jump @1


:disable
// Disable Script here
$scriptStatus = 0 // Disabled
// Do code
jump @1
  • abccba123 likes this

DanceNSmile
  • DanceNSmile

    Player Hater

  • Members
  • Joined: 15 Jun 2013

#3

Posted 16 June 2013 - 03:08 AM

QUOTE (The_Sorrow @ Sunday, Jun 16 2013, 02:56)
QUOTE (DanceNSmile @ Sunday, Jun 16 2013, 03:44)
Something like
they press #8 and it enables the script
then they press #8 again to disable script.
How do you do that?

This is a basic template of the script you're wanting:

CODE
{$CLEO}
0000:

$scriptStatus = 0 // Not enabled

:1
wait 0
if and
0256:   player $PLAYER_CHAR defined // Player defined
0AB0:  key_pressed 0x38             // Key 8 pressed
jf @1

:2
wait 0
if
$scriptStatus == 1     // Is the script enabled?
jf @enable             // If not enabled then enable it
jump @disable          // If enabled then disable it

:enable
// Enable script here
$scriptStatus = 1 // Enabled
// Do code
jump @1


:disable
// Disable Script here
$scriptStatus = 0 // Disabled
// Do code
jump @1

But then I want it so that if they press 8 again then the script disables - how would that work?

ChopTheDog.
  • ChopTheDog.

    War. War never changes.

  • Members
  • Joined: 31 May 2010
  • None

#4

Posted 16 June 2013 - 03:12 AM

When the script is first run it is set to disabled.

Pressing 8 for the first time enables it then it jumps back to checking if 8 is pressed.
Once 8 is pressed it checks if the script is enabled, if it is then it disables it, if it isn't it enables it.
  • abccba123 likes this




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users