Override GetFlags()

Posts 1–15 of 21 · Page 1 of 2
Override GetFlags()
How would i override it so i can send fake values back. IE. Bypass:
Code:
 if( GetConVar( "sv_allowcslua" ):GetFlags() != 8452 || GetConVar( "sv_allowcslua" ):GetFlags() == 0 ) then
I know you can do this with cvars but how would i overwrite the GetFlags() function so it would return the flags its checking for ?
-snip-----
Quote Originally Posted by niller303 View Post
One word, detour.
I know this is probably an extremely simple concept, but how do detours work? Are there any simple examples I could look at? Once again, sorry for the ignorance.
Quote Originally Posted by Azrius View Post
I know this is probably an extremely simple concept, but how do detours work? Are there any simple examples I could look at? Once again, sorry for the ignorance.

In lua detouring is pretty easy.

Code:
//The original function, it prints whatever argument is given to it
function PrintSomething(what)
	MsgN(what)
end

//Detouring the function
local PS = PrintSomething //Save a copy of the original (not always necessary)
function PrintSomething(what) //Because it has the same name this overwrites the other function (its also smart the use the same arguments)
	PS("I was suppose to print "..what.." but im detoured!") //Calling the original function but with an altered message
end
It gets a bit more complicated when you want to detour a meta table function, like ConVar:GetFlags(). But I'm not going to show you exactly how to do it, instead I'm going to show how to altar a player function.

Code:
//The original function Player:Deaths() returns how many deaths a player has

local Player = FindMetaTable("Player") //Getting a copy of the player meta table
local deaths = Player.Deaths //Saving a copy of the original function (Same as Player["Deaths"])
function Player:Deaths() //Re-creating the function, this is the detour
	local num = deaths(self) //Calling the original function to find what it would normally return
	MsgN("Players deaths: "..num) //Printing it
	return num //Returning what the original function would've returned, 
end
I hope you learned something for that. Anyone can feel free to improve on what i just posted.
Well yea.... I tried fucking with it but i couldn't get it so i came here.
Just detour GetConVar to return a fake convar that has the real allowcslua flags if it got "sv_allowcslua".
Quote Originally Posted by niller303 View Post
Just detour GetConVar to return a fake convar that has the real allowcslua flags if it got "sv_allowcslua".
or modify the convar metatable to return a fake value when getflags is called on sv_cheats or sv_allowcslua
or stop using convars and just directly load lua
Quote Originally Posted by notanimedad View Post
or stop using convars and just directly load lua
or be cooler and don't use lua (unlike me)
ty guys! ill work with this stuff.
Get a load of these dumbfucks trying to detour while loading after the anti-cheat.
Quote Originally Posted by JohnOfDicks View Post
Get a load of these dumbfucks trying to detour while loading after the anti-cheat.
Considering most anti cheats are horrible, this will work with some.

And who said they were loading after the anticheat?
Quote Originally Posted by LordOfGears2 View Post
Considering most anti cheats are horrible, this will work with some.

And who said they were loading after the anticheat?
Most anti-cheats are horrible? Please, you all wouldn't be able to bypass the most simple anti-cheats if it weren't for people like Blue Kirby, whom is also a retard, but at least he can code somewhat. For fuck's sake, you are struggling to bypass an anti-cheat that just checks for sv_allowcslua.

You skids can't even print something to the console without looking it up on the wiki, and you expect me to believe you are loading before anti-cheats? rifk, whatever you say my dear Downie. Not like it matters, you wouldn't be able to bypass it even if you loaded before, because you're all stupid fucks.
Quote Originally Posted by JohnOfDicks View Post
Most anti-cheats are horrible? Please, you all wouldn't be able to bypass the most simple anti-cheats if it weren't for people like Blue Kirby, whom is also a retard, but at least he can code somewhat. For fuck's sake, you are struggling to bypass an anti-cheat that just checks for sv_allowcslua.

You skids can't even print something to the console without looking it up on the wiki, and you expect me to believe you are loading before anti-cheats? rifk, whatever you say my dear Downie. Not like it matters, you wouldn't be able to bypass it even if you loaded before, because you're all stupid fucks.
says ignorance
Posts 1–15 of 21 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?