Lua: Why the function didnt call? - user-interface

Okay I am coding in lua a cheat for Roblox (just for fun).
But I created a function and the function got called!
I used the Library Kavo UI for the window.
But...
There is everything looks like in my code just that I change function() to combat()!
If I run this it doesn't show the UI!
But if I delete the function and the section it shows!
How do I fix it?
local Library = loadstring(game:HttpGet("https://raw.githubusercontent.com/xHeptc/Kavo-UI-Library/main/source.lua"))()
local Window = Library.CreateLib("Ghoster", "Synapse")
local Combat = Window:NewTab("Combat")
local Movement = Window:NewTab("Movement")
local Exploit = Window:NewTab("Exploits")
local CombatSection = Combat:NewSection("Combat Options")
local MovementSection = Movement:NewSection("Movement Options")
local ExploitSection = Exploit:NewSection("Exploit Options")
function aimbot()
loadstring(game:HttpGet(('https://gitlab.com/marsscripts/marsscripts/-/raw/master/CCAimbotV2'),true))()
end
CombatSection:NewButton("Aimbot", "Aims your enemies", aimbot()
print("Loaded Aimbot")
end

The problem lies in misunderstanding the following syntax:
CombatSection:NewButton("Aimbot", "Aims your enemies", function()
print("Loaded Aimbot")
end
CombatSection:NewButton receives 3 arguments, "Aimbot", "Aims your enemies" and an anonymous function.
Just to ilustrate what you did, let's put that anonymous function into a variable instead:
local yourFunction = function()
print("Loaded Aimbot")
end
And you changed that to (the invalid code)
local yourFunction = aimbot()
print("Loaded Aimbot")
end
What you actually wanted is to pass aimbot as a function:
CombatSection:NewButton("Aimbot", "Aims your enemies", aimbot)
Or call aimbot from within that anomynous function:
CombatSection:NewButton("Aimbot", "Aims your enemies", function()
aimbot()
print("Loaded Aimbot")
end

Related

How to grant a user to perform only a certain function in Tarantool

Now the challenge is: there are 2 functions. And there is a user who can only execute one of them. The question is how to do it?
If you just write: box.schema.user.grant ('user', 'execute', 'function', 'dima', nil, {if_not_exists = true}) then the user 'user' cannot connect at all. An error message is displayed: Execute access to universe '' is denied for user 'user'. How to provide access correctly?
box.once("schema", function()
box.schema.user.create('superuser', {password = '11111111'})
box.schema.user.create('user', {password = '11111111'})
box.schema.user.grant('superuser', 'read,write,execute','universe', nil, {if_not_exists = true})
box.schema.user.grant('user','execute','function','dima',nil, {if_not_exists = true})
end)
function reload(proc)
package.loaded[proc]=nil return require(proc)
end
ws = reload('project/init')
Function dima:
local obj={}
function obj.open()
return 'dima'
end
return obj
Function dima2:
local obj={}
function obj.open()
return 'dima2'
end
return obj
Init.lua:
obj = {}
collectgarbage('collect')
net = require('net.box')
fiber = require('fiber')
uuid = require('uuid')
-- modules
obj.dima = reload('project/dima')
obj.dima2 = reload('project/dima2')
return obj
In order to give access to only one function, you can do the following:
box.cfg({listen=3301})
foo = function() print("bar") end
box.schema.user.create('myuser', {if_not_exists=true, password = 'secret'})
-- setuid is required here so that the function, when called by user with
-- restricted rights, will have access to everything
box.schema.func.create('foo', {if_not_exists=true, setuid=true})
box.schema.user.grant('myuser', 'execute', 'function',
'foo', {if_not_exists=true})
Then open a separate tarantool prompt (not tarantoolctl! explanation below) and type this:
net_box = require('net.box')
c = net_box.connect('myuser:secret#localhost:3301')
c:call('foo')
Then you'll see "bar" printed in the first console.
The reason you see "Execute access to universe '' is denied for user 'user'" is because you try to connect with tarantoolctl, which requires read access to the whole database. It will be fine when called via connectors or net.box.

My Roblox Studio script is sometimes having errors.. idk why

So.. I've been coding to make a GUI show the quantity of currency of a player, the datastore API works perfectly but the local script doesn't (it's local because else it would just update it each time a player's currency gets updated and would be a mess being the opposite of what I want to)
and well... sometimes it loads the currency into the GUI but other times it just stays on the original text: "Label" instead of my current currency (4600)
here's the proof
What normally happens and should always happen
What sometimes happens and shouldn't happen:
here's the script, I've tried putting waits on the start but the original code is inside the while true do..
wait(game.Players.LocalPlayer:WaitForChild("Data")
wait(game.Players.LocalPlayer.Data:WaitForChild("Bells"))
while true do
script.Parent.TextLabel.Text = game.Players.LocalPlayer:WaitForChild("Data"):WaitForChild("Bells").Value
wait() --wait is for not making the loop break and stop the whole script
end
well.. if you want to see if data is really in the player, here's the script, it requires a API (DataStore2)
--[Animal Crossing Roblox Edition Data Store]--
--Bryan99354--
--Module not mine--
--Made with a AlvinBlox tutorial--
--·.·.*[Get Data Store, do not erase]*.·.·--
local DataStore2 = require(1936396537)
--[Default Values]--
local DefaultValue_Bells = 300
local DefaultValue_CustomClothes = 0
--[Data Store Functions]--
game.Players.PlayerAdded:Connect(function(player)
--[Data stores]--
local BellsDataStore = DataStore2("Bells",player)
local Data = Instance.new("Folder",player)
Data.Name = "Data"
Bells = Instance.new("IntValue",Data)
Bells.Name = "Bells"
local CustomClothesDataStore = DataStore2("CustomClothes",player)
local CustomClothes = Instance.new("IntValue",Data)
CustomClothes.Name = "CustomClothes"
local function CustomClothesUpdate(UpdatedValue)
CustomClothes.Value = CustomClothesDataStore:Get(UpdatedValue)
end
local function BellsUpdate(UpdatedValue)
Bells.Value = BellsDataStore:Get(UpdatedValue)
end
BellsUpdate(DefaultValue_Bells)
CustomClothesUpdate(DefaultValue_CustomClothes)
BellsDataStore:OnUpdate(BellsUpdate)
CustomClothesDataStore:OnUpdate(CustomClothesUpdate)
end)
--[test and reference functions]--
workspace.TestDevPointGiver.ClickDetector.MouseClick:Connect(function(player)
local BellsDataStore = DataStore2("Bells",player)
BellsDataStore:Increment(50,DefaultValue_Bells)
end)
workspace.TestDevCustomClothesGiver.ClickDetector.MouseClick:Connect(function(player)
local CustomClothesDataStore = DataStore2("CustomClothes",player)
CustomClothesDataStore:Increment(50,DefaultValue_CustomClothes)
end)
the code that creates "Data" and "Bells" is located in the comment: Data Stores
the only script that gets the issue is the short one with no reason :<
I hope that you can help me :3
#Night94 I tryed your script but it also failed sometimes
The syntax in your LocalScript is a little off with the waits. With that fixed, it works every time. Also, I would use an event handler instead of updating the value with a loop:
game.Players.LocalPlayer:WaitForChild("Data"):WaitForChild("Bells").Changed:Connect(function(value)
script.Parent.TextLabel.Text = value
end)

Garry's Mod Custom Cvar not changing

I'm making a script for Garry's Mod and it's almost complete but for some reason when ever I type in the new Cvar i made it won't change host_framerate. if anyone know what the problem is your a life saver.
local speedCvar = CreateClientConVar( "speedhack_enabled", 0, true, false )
local speedHackCvar = CreateClientConVar( "speedhack_enabled", "0", true, false )
local speedHack = SpeedHackCvar:GetString()
local speed = function()
if (speedCvar:GetInt() == 1) then
speedHack = SpeedHackCvar:GetString()
RunConsoleCommand("host_framerate", speedHack)
else
speedHack = SpeedHackCvar:GetString()
RunConsoleCommand("host_framerate " , speedHack)
end
end
Remove the local from first of each line (creation of your objects) to make your objects go globally across the lua. Your problem is that your functions are localized, which means they can only be accessed from the file/code block or chunk they're created in.
Oh and also you had a mistake on your code, which Is fixed (From reading comments on your post).

How to pass variable values to sendKeys in casperjs

I have the following issue with sendKeys in casperjs.
I am trying to pass the port as an option into casperjs and this is working, but when i try to use the port value with casper.cli.get it doesn't work in sendKeys!!!
var casper = require('casper').create();
casper.echo("Casper CLI passed args:");
require("utils").dump(casper.cli.args);
casper.echo("Casper CLI passed options:");
require("utils").dump(casper.cli.options);
if (casper.cli.has("ip") === false) {
casper.echo("Usage: casper.js test modify_port.js --ip=<x.x.x.x> --port=<xxxxx>").exit();
}
if (casper.cli.has("port") === false) {
casper.echo("Usage: casper.js test modify_port.js --ip=<x.x.x.x> --port=<xxxxx>").exit();
}
...
casper.then(function() {
test.assertTextExists("Change", "Data Base - Change - port");
this.sendKeys('input[name="Params.port"]', casper.cli.get("port"));
this.click('input[name="Apply"]');
});
The above way seems not to work and it doesn't give me also no error msg.
But when i hard code the port in the sendKeys line then i see that the port is changed, like:
this.sendKeys('input[name="Params.port"]', '29999');
This is also working fine (hard coded):
var myPort = '29999'
this.sendKeys('input[name="Params.port"]', myPort);
But this again is not working:
var myPort = casper.cli.get("port")
this.sendKeys('input[name="Params.port"]', myPort);
Thanks in adv. for your time
After some more readings I stepped over the part where casperjs documentation is saying about Raw parameter values.
So, I figured out to use my parameter in this way:
this.sendKeys('input[name="Params.port"]', casper.cli.raw.get('port'));
When passing variables into sendKeys they will not appear in the form unless they are preceded with an empty string "".
this.sendKeys("selector", "" + variable);
I guess this may be because sendKeys can only handle variables of type string.
Source

CasperJS test doesn't return after execution

I'm having a problem getting casperjs test to exit after execution, I have to hit CTL-C to exit execution. I'm on OSX 10.7 with casperjs 1.1 devel.
To test this wasn't my code I simply copied this sample from the docs:
var casper = require("casper").create();
function Cow() {
this.mowed = false;
this.moo = function moo() {
this.mowed = true; // mootable state: don't do that at home
return 'moo!';
};
}
casper.test.begin('Cow can moo', 2, function suite(test) {
var cow = new Cow();
test.assertEquals(cow.moo(), 'moo!');
test.assert(cow.mowed);
test.done();
});
And I get the following output
casperjs test cow-test.js
Test file: cow-test.js
# Cow can moo
PASS Subject equals the expected value
PASS Subject is strictly true
I then have to hit CTL-C to stop execution. Am I missing something to stop execution?
Per https://github.com/n1k0/casperjs/issues/593#issuecomment-23062361, the problem was that I had created a casper instance at the top of the file, which the documentation warns you not to do.
The solution was to remove the var casper = require("casper").create(); line.

Resources