Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   Request: test function(funcName); (https://forums.graalonline.com/forums/showthread.php?t=73844)

Deadly_Killer 05-06-2007 07:50 AM

Request: test function(funcName);
 
Built-in Function:

Request: testfunction(funcName)
Usage: testfunction("onwall2");
Returns: true if function exists, false if it doesn't.

Why? Cheat Engine and other memory editors that can pass through the cheat windows check, and rename functions by searching for text.

Usage in script:
PHP Code:

function onActionServerSide(actionargs) {
  switch (
action) {
    case 
"hacker":
      
temp.report format("%s has renamed function %s!"player.accountargs[0]);
      
      echo(
"[ Hack-Control ]: " temp.report);
      
savelog2("functionlog.txt"temp.report);
    break;
  }
}
//#CLIENTSIDE
function onCreated() {
  
this.check = {"onactionprojectile""onactionprojectile2""onwall""onwall2"};
  
  
this.onTimeout();
}

function 
onTimeout() {
  for (
temp.var : this.check) {
    if (
this.tes[t]function(temp.var)) continue;
    
    
// Hacker Found!
    
triggerserver("gui"this.name"hacker", {temp.var});
    
    
player.serverwarp(this.getservername()); // warps player back to server, if cheat engine, it will normally report to the rc that a player was using cheat engine ( mostly used to avoid the windows check )
    
    
break;
  }
  
  
this.setTimer(300); // check every 5 minutes



Twinny 05-06-2007 07:59 AM

They could just as easily disable those checks...

killerogue 05-06-2007 08:10 AM

This seems quite useful Deadly_Killer, it should be implemented.

Crow 05-06-2007 08:17 AM

Quote:

Originally Posted by killerogue (Post 1305812)
This seems quite useful Deadly_Killer, it should be implemented.

If you ask me, it shouldnt. It wont stop hackers/cheaters. This is kind of a hardcoded issue, nothing to do with commands there.

Chandler 05-06-2007 08:41 AM

Stop the use of malicious applications whilst Graal is operating.

Deadly_Killer 05-06-2007 08:53 AM

Quote:

Originally Posted by Crow (Post 1305813)
If you ask me, it shouldnt. It wont stop hackers/cheaters. This is kind of a hardcoded issue, nothing to do with commands there.

Explain yourself?

Though, I think I just came into another problem.

I noticed that this wouldn't exactly solve it if people don't rename the onwall2 function, but rename the use of the function.

Quote:

Originally Posted by Twinny (Post 1305810)
They could just as easily disable those checks...

I don't think you can rename hardcoded functions.

xXziroXx 05-06-2007 09:21 AM

The clientsided part of scripts can be edit any way they want, so they would just disable the trigger. Duh.

Deadly_Killer 05-06-2007 09:45 AM

Quote:

Originally Posted by xXziroXx (Post 1305823)
The clientsided part of scripts can be edit any way they want, so they would just disable the trigger. Duh.

They would be required to know what the trigger is..?

xXziroXx 05-06-2007 09:52 AM

Quote:

Originally Posted by Deadly_Killer (Post 1305825)
They would be required to know what the trigger is..?

The clientsided part of scripts can be viewed and edited by some programs.

Deadly_Killer 05-06-2007 10:00 AM

Quote:

Originally Posted by xXziroXx (Post 1305827)
The clientsided part of scripts can be viewed and edited by some programs.

Maybe sometime I'll make a small 3 line script and you could find out what it is, yes?

Skyld 05-06-2007 12:05 PM

PHP Code:

function magicFunction()
{
  echo(
"Hello!");
}

function 
onCreated()
{
  if (
"magicFunction".lower() in this.getfunctions())
  {
    
this.magicFunction();
  }
    else
  {
    
// The function is not present
  
}



Admins 05-14-2007 12:50 AM

The next Graal version will have hasfunction() as well, until then use getfunctions() like Skyld said

Deadly_Killer 05-14-2007 03:39 AM

PHP Code:

obj.hasFunction(); 

yes?

sam_is_me 05-14-2007 05:47 PM

What the heck is magicFunction()?

Chompy 05-14-2007 06:00 PM

Quote:

Originally Posted by sam_is_me (Post 1307726)
What the heck is magicFunction()?

it was an example..

Crow 05-14-2007 06:32 PM

Quote:

Originally Posted by Stefan (Post 1307578)
The next Graal version will have hasfunction() as well, until then use getfunctions() like Skyld said

Yay! :D

Chandler 05-14-2007 06:45 PM

Oh, so we need to make our own system NPC to check if the functions exist? fun... o_o

Skyld 05-14-2007 07:08 PM

Quote:

Originally Posted by Chandler (Post 1307740)
Oh, so we need to make our own system NPC to check if the functions exist? fun... o_o

Why on Earth would you make a system NPC just to perform "magicFunction".lower() in this.getfunctions()?

Chandler 05-14-2007 07:32 PM

Because functions can be edited, isn't that why Stefan created this...?

Skyld 05-14-2007 07:36 PM

Quote:

Originally Posted by Chandler (Post 1307747)
Because functions can be edited, isn't that why Stefan created this...?

I'm confused, and I am not sure where you are going with that.

if ("magicFunction".lower() in this.getfunctions()) tells you if the function magicFunction() has been defined somewhere on the current object (normally the script/NPC). Change the this. to some other object to check if the function is defined in that object instead.

It's only one line, and it certainly does not need a system NPC creating to use it.

Chandler 05-14-2007 07:40 PM

However, we need to add this to each of our system npcs.

Skyld 05-14-2007 07:42 PM

Quote:

Originally Posted by Chandler (Post 1307753)
However, we need to add this to each of our system.

What, why?

Chandler 05-14-2007 07:46 PM

To check if the functions actually exist.
If people can edit function names via memory editing, we are checking to see if they exist.
Correct me if I have perceived this thread totally wrong...

Skyld 05-14-2007 07:48 PM

Quote:

Originally Posted by Chandler (Post 1307756)
To check if the functions actually exist.
If people can edit function names via memory editing, we are checking to see if they exist.
Correct me if I have perceived this thread totally wrong...

There is no real reason to add this to every function call, because the function won't get called anyway if someone has "edited" it by memory editing.

The main use for it I guess is checking if functions are present from joined classes or so.

xXziroXx 05-14-2007 07:48 PM

Quote:

Originally Posted by Chandler (Post 1307756)
To check if the functions actually exist.
If people can edit function names via memory editing, we are checking to see if they exist.
Correct me if I have perceived this thread totally wrong...

Please do correct me if I'm wrong, but I've always been told EVERYTHING clientsided can be edited with memory editing - not just function names.

Chandler 05-14-2007 07:50 PM

Skyld, I see. object.isinclass isn't good enough :p

xXZiroXx, kind of, not all.

Crow 05-14-2007 08:03 PM

Quote:

Originally Posted by Chandler (Post 1307759)
Skyld, I see. object.isinclass isn't good enough :p

xXZiroXx, kind of, not all.

Clientside = in memory = editable, some things are just harder.

Deadly_Killer 05-14-2007 09:14 PM

Quote:

Originally Posted by sam_is_me (Post 1307726)
What the heck is magicFunction()?

If you have something stupid to say.. don't say it.

--

Anyway:

Changing onwall/2 makes it so you can walk on walls because it will return false ( no longer exists )

Would be cool if non-existing functions returned like -1.

zokemon 05-26-2007 12:23 PM

Quote:

Originally Posted by sam_is_me (Post 1307726)
What the heck is magicFunction()?

Quote:

Originally Posted by Skyld (Post 1305844)
PHP Code:

function magicFunction()
{
  echo(
"Hello!");



In that example, it was that! :)

Inverness 06-18-2007 07:11 PM

TGraalVar.hasFunction(functionname);

Stefan has granted your wish, and screwed up getVarNames() in the process.

Twinny 06-19-2007 08:13 AM

Quote:

Originally Posted by Inverness (Post 1319392)
TGraalVar.hasFunction(functionname);

Stefan has granted your wish, and screwed up getVarNames() in the process.

Over the inclusion of function names? Annoying, yes, but functions/events are variables now... I normally sift them out straight up out of any search. I also noticed you coule wipe the vars and the NPC would still work :D

Novo 06-19-2007 01:28 PM

PHP Code:

function hasFunctionfuncName )
{
  return ( 
funcName.lower() in this.getFunctions() );


For those who didn't find it out by reading.

Inverness 06-19-2007 11:43 PM

Quote:

Originally Posted by Novo (Post 1319769)
PHP Code:

function hasFunctionfuncName )
{
  return ( 
funcName.lower() in this.getFunctions() );


For those who didn't find it out by reading.

The function names are returned in the same case they're declared, why have funcName.lower()? And about functions, could we at least get a different GraalVar type for them? I don't want them confused with objects.

And a second thought, why are you even showing this to us? hasfunction() already exists for all objects now.


All times are GMT +2. The time now is 08:26 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.