Jump to content

Prefix buttons (ON and OFF)


RCPOLSKI

Recommended Posts

Wasup everyone, RCPOLSKI here.

In this topic you guys are about to learn how to create prefixes like [ON] and [OFF]

Why to use this? Well, you can keep you script menu clean and still use it for others things like showing results got by prompt (numbers, words, etc...)

 

There are 2 ways of doing it:

  • Calling and refreshing the stuff right on the menu
  • Creating a function that will be called after the cheat function being read

 

So then, let's go!

 

1. First you need to store the ON and OFF info as string and then set the function "cstatus" as off

on = '[ON]'
off = '[OFF]'
cstatus = off

 

2. Here we create our menu and set some things up...

- Before every button, if you're going to put the prefix, you'll need to put the string var created up there (Here is cstatus) then 2 dots (..) and finally your text

function main()
  menu = gg.choice({
    cstatus .. ' Some random trick', -- cstatus + .. and 'the text'
    'Exit'},
    nil,
    'Cheat menu')
  if menu == 1 then
    if cstatus == on then -- Checks if cstatus is [ON]
	  cstatus = off -- If yes, then sets it to [OFF]
	else
	  cstatus = on -- If it's not, then sets it to [ON]
	end
    doCheat()  -- After doing the check things, regardless of outcome it call the doCheat function
  elseif menu == 2 then
    os.exit()
end

3. As you are using vars with data stored in, you can also call 1 function only to enable and disable the cheat

function doCheat()
  if cstatus == on then -- Check if the cstatus is [ON]
    print('Cheat enabled!') -- If yes, then add the activation code here
  else
    print('Cheat disabled!') -- If it's not, then add the desactivation code here
  end
end

 

There is a lua script to download with both first and second method

Feel free to use the code!

Sorry for my english, still learning tho ?

Prefix Tutorial.lua

Link to comment
Share on other sites

  • 7 months later...
  • 2 months later...
local on = '[ON]'
local off = '[OFF]'
cstatus1 = off
cstatus2 = off
cstatus3 = off

function showmenu()
local choices = gg.choice({cstatus1..'A',cstatus2..'B',cstatus3..'C','EXIT'})

if choices == nil then
gg.toast("CANCELLED")
elseif  choices == 1 then

if cstatus1 == on then
    cstatus1 = off
    else
    cstatus1 = on 
    end
    
    if cstatus1 == on then
    gg.alert("DO ON A?")
    
    else
   gg.alert("DO OFF A?")
   
   
   end
   
   elseif  choices == 2 then

if cstatus2 == on then
    cstatus2 = off
    else
    cstatus2  = on 
    end
    
    if cstatus2 == on then
    --PUT YOUR CODE HERE =ON
    
    gg.alert("DO ON B?")
    
    else
    
    --PUT YOUR CODE HERE =OFF
   gg.alert("DO OFF B?")
   
   
   end
   elseif  choices == 3 then

if cstatus3 == on then
    cstatus3 = off
    else
    cstatus3 = on 
    end
    
    if cstatus3 == on then
    
      --PUT YOUR CODE HERE =ON
    gg.alert("DO ON C?")
    
    
    else
   gg.alert("DO OFF C?")
   
     --PUT YOUR CODE HERE =OFF
   
   end
   elseif choices == 4 then
   os.exit()--EXIT FROM SCRIPT
   
   
   end
   end
   
   gg.isVisible(true)
   while true do
  if gg.isVisible() then
    gg.setVisible(false)
    showmenu()
  else
    gg.sleep(100) 
    end
    end
6 hours ago, KomPo said:

Hi,

Im stuck at second method.

Can you help me how to do it?

local on = '[ON]'
local off = '[OFF]'
cstatus1 = off
cstatus2 = off
cstatus3 = off

function showmenu()
local choices = gg.choice({cstatus1..'A',cstatus2..'B',cstatus3..'C','EXIT'})

if choices == nil then
elseif  choices == 1 then

if cstatus1 == on then
    cstatus1 = off
    else
    cstatus1 = on 
    end
    
    if cstatus1 == on then
    gg.alert("DO ON A?")
    
    else
   gg.alert("DO OFF A?")
   
   
   end
   
   elseif  choices == 2 then

if cstatus2 == on then
    cstatus2 = off
    else
    cstatus2  = on 
    end
    
    if cstatus2 == on then
    --PUT YOUR CODE HERE =ON
    
    gg.alert("DO ON B?")
    
    else
    
    --PUT YOUR CODE HERE =OFF
   gg.alert("DO OFF B?")
   
   
   end
   elseif  choices == 3 then

if cstatus3 == on then
    cstatus3 = off
    else
    cstatus3 = on 
    end
    
    if cstatus3 == on then
    
      --PUT YOUR CODE HERE =ON
    gg.alert("DO ON C?")
    
    
    else
   gg.alert("DO OFF C?")
   
     --PUT YOUR CODE HERE =OFF
   
   end
   elseif choices == 4 then
   os.exit()--EXIT FROM SCRIPT
   
   
   end
   end
   
   while true do
  if gg.isVisible() then
    gg.setVisible(false)
    showmenu()
  else
    gg.sleep(100) 
    end
    end

 

Link to comment
Share on other sites

  • 11 months later...
On 8/4/2018 at 6:06 PM, RCPOLSKI said:

Wasup everyone, RCPOLSKI here.

In this topic you guys are about to learn how to create prefixes like [ON] and [OFF]

Why to use this? Well, you can keep you script menu clean and still use it for others things like showing results got by prompt (numbers, words, etc...)

 

There are 2 ways of doing it:

  • Calling and refreshing the stuff right on the menu
  • Creating a function that will be called after the cheat function being read

 

So then, let's go!

 

1. First you need to store the ON and OFF info as string and then set the function "cstatus" as off


on = '[ON]'
off = '[OFF]'
cstatus = off

 

2. Here we create our menu and set some things up...

- Before every button, if you're going to put the prefix, you'll need to put the string var created up there (Here is cstatus) then 2 dots (..) and finally your text


function main()
  menu = gg.choice({
    cstatus .. ' Some random trick', -- cstatus + .. and 'the text'
    'Exit'},
    nil,
    'Cheat menu')
  if menu == 1 then
    if cstatus == on then -- Checks if cstatus is [ON]
	  cstatus = off -- If yes, then sets it to [OFF]
	else
	  cstatus = on -- If it's not, then sets it to [ON]
	end
    doCheat()  -- After doing the check things, regardless of outcome it call the doCheat function
  elseif menu == 2 then
    os.exit()
end

3. As you are using vars with data stored in, you can also call 1 function only to enable and disable the cheat


function doCheat()
  if cstatus == on then -- Check if the cstatus is [ON]
    print('Cheat enabled!') -- If yes, then add the activation code here
  else
    print('Cheat disabled!') -- If it's not, then add the desactivation code here
  end
end

 

There is a lua script to download with both first and second method

Feel free to use the code!

Sorry for my english, still learning tho ?

Prefix Tutorial.lua 1.93 kB · 229 downloads

can you help me for this sir??

-- main code
gg.searchNumber("198D;1D;1D;0D;0F;0D::21", gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1)
gg.processResume()
gg.processResume()
gg.refineNumber("5", gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1)

revert = gg.getResults(100, nil, nil, nil, nil, nil, nil, nil, nil)
local t = gg.getResults(100, nil, nil, nil, nil, nil, nil, nil, nil)
for i, v in ipairs(t) do
    if v.flags == gg.TYPE_DWORD then
        v.value = "99999999"
        v.freeze = true
    end
end
gg.addListItems(t)
t = nil

gg.processResume()

revert = gg.getResults(100, nil, nil, nil, nil, nil, nil, nil, nil)
local t = gg.getResults(100, nil, nil, nil, nil, nil, nil, nil, nil)
for i, v in ipairs(t) do
    if v.flags == gg.TYPE_DWORD then
        v.value = "5"
        v.freeze = true
    end
end
gg.addListItems(t)
t = nil

gg.processResume()
 

 

ty in advance!!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.