Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-11-2006, 08:55 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
Protecting from hackers

Alright..
To reduce some stress on the server, I'm calculating damage on the clientside. If you're going to reply 'Do it serverside,' just don't.

Anyway, I have a GetDamage(arg) function. arg is a list of 'modifiers' to include in the attack (i.e. 'range' will return the possible damage range, 'noweapon' will return the player's damage with no weapon equipped)

Once damage has been calculated, I did this:
PHP Code:
temp.dmcheck temp.dmg-1;
temp.dmg--;
if (
temp.dmcheck != temp.dmg) return "HACKER";
temp.dmg++; 
However, it's randomly returning 'HACKER' even though the person isn't hacking. Any ideas?
Reply With Quote
  #2  
Old 05-11-2006, 11:15 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
what is the variable for damage?
plus you subtract 2 from temp.dmg and so it will never == temp.dmcheck
Reply With Quote
  #3  
Old 05-11-2006, 11:47 PM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
Quote:
Originally Posted by Yen
Alright..
To reduce some stress on the server, I'm calculating damage on the clientside. If you're going to reply 'Do it serverside,' just don't.

Anyway, I have a GetDamage(arg) function. arg is a list of 'modifiers' to include in the attack (i.e. 'range' will return the possible damage range, 'noweapon' will return the player's damage with no weapon equipped)

Once damage has been calculated, I did this:
PHP Code:
temp.dmcheck temp.dmg-1;
temp.dmg--;
if (
temp.dmcheck != temp.dmg) return "HACKER";
temp.dmg++; 
However, it's randomly returning 'HACKER' even though the person isn't hacking. Any ideas?

Good job Excaliber, you don't know how to code!

the temp.dmcheck = temp.dmg-1 never modifies temp.dmg
temp.dmg than has a post decrement of one which causes the temp.dmcheck to = temp.dmg
Reply With Quote
  #4  
Old 05-12-2006, 02:39 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Quote:
Originally Posted by Mark Sir Link
Good job Excaliber, you don't know how to code!

the temp.dmcheck = temp.dmg-1 never modifies temp.dmg
temp.dmg than has a post decrement of one which causes the temp.dmcheck to = temp.dmg
Hmmm i thought it set it to the value on the other side of the equals sign
However, you're definatly right,
Quote:
the temp.dmcheck = temp.dmg-1 never modifies temp.dmg
Brain fart, sorry
Anyway, I can't see why it would return hacker, it doesn't make sense.
I'm not sure, but can hackers modify temp variables?
If so, this check yould be useless anyway. It may be better to calculate the damage, twice, and compare values at the end, although this would take double the script time.
Reply With Quote
  #5  
Old 05-12-2006, 02:20 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Have you tried doing a pre-decrement of the temp.dam variable? I don't really think that it would matter, but it's worth a shot I guess. (pre-decrement is: --temp.dmg

Also, try echoing temp.dmg and temp.dmcheck, and see if they really are not the same.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #6  
Old 05-12-2006, 04:04 PM
MegaMasterX90875 MegaMasterX90875 is offline
Retired Graalian (2009)
MegaMasterX90875's Avatar
Join Date: Feb 2006
Location: North Carolina
Posts: 132
MegaMasterX90875 is on a distinguished road
Send a message via AIM to MegaMasterX90875
Hm, Measuring damage only? It should be measuring HP too (For those God Modders who are just asking for a ban) to double up on security.
__________________
Mess with the best, Die like the rest.



Reply With Quote
  #7  
Old 05-12-2006, 06:53 PM
Sage_Shadowbane Sage_Shadowbane is offline
Graal Developer
Sage_Shadowbane's Avatar
Join Date: Mar 2004
Posts: 585
Sage_Shadowbane will become famous soon enough
Excalibur...Dont try posting in the scripting section please.. Variables can only be accessed by the NPC itself, not by a client. Also MegaMaster...you have a good idea, except it doesnt have anything to do with Yen's question.

Yen, what check are you doing prior to the setting of temp.dmcheck?
Reply With Quote
  #8  
Old 05-12-2006, 07:12 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Quote:
Originally Posted by Sage_Shadowbane
Excalibur...Dont try posting in the scripting section please.. Variables can only be accessed by the NPC itself, not by a client.
Ah, yes, learning is so bad.
Reply With Quote
  #9  
Old 05-12-2006, 07:18 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
I've already got it testing stats; that works fine.

I'm doing a lot above the check.. But it shouldn't effect anything. :/
Reply With Quote
  #10  
Old 05-12-2006, 07:29 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
I'm no expert, but it sems to be scripted perfectly
Reply With Quote
  #11  
Old 05-12-2006, 09:26 PM
Andy0687 Andy0687 is offline
Enigma
Join Date: Feb 2002
Posts: 1,072
Andy0687 is on a distinguished road
This might seem like the most simple silly suggestion ever, but put the conditional statement into brackets. Odd as it is sometimes this will fix random conditions from checking out wrong (interpreter problem?). Had it happen to me before.
Reply With Quote
  #12  
Old 05-13-2006, 05:16 AM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
Simple, just disable 2.x from your server and you don't have to worry about crap like that.
Reply With Quote
  #13  
Old 05-13-2006, 06:55 AM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
Quote:
Originally Posted by Rick
Simple, just disable 2.x from your server and you don't have to worry about crap like that.
They're on v4.
They simply modify freeze the values; it took barely 5 seconds for them to do.
Reply With Quote
  #14  
Old 05-27-2006, 02:31 PM
Tyrial Tyrial is offline
The Shiznic
Join Date: Dec 2001
Location: Sweden > Stockholm
Posts: 2,411
Tyrial is an unknown quantity at this point
Hmm..

Lets say temp.dmcheck = 10
and temp.dmg = 10.

temp.dmcheck = temp.dmg-1; //This part will make temp.dmcheck into temp.dmg(10)-1. dmcheck is now 9 and dmg is still 10.

temp.dmg--; makes it 9.

So what you do is to remove 1 from temp.dmg and temp.dmcheck.
So what you did is the same as doing:

temp.dmg--;
temp.dmcheck = temp.dmg;


right?

Correct me if I'm wrong.
__________________
-Mher Avetian
Reply With Quote
  #15  
Old 05-27-2006, 03:38 PM
Bl0nkt Bl0nkt is offline
Era Developer
Bl0nkt's Avatar
Join Date: Mar 2005
Location: Pennsylvania
Posts: 1,589
Bl0nkt will become famous soon enough
Send a message via AIM to Bl0nkt
Are you sure they are both equal? Why don't you have it list those two values somewhere?
Reply With Quote
  #16  
Old 05-27-2006, 08:06 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Just print them (with echo()) to know if they are really the same, if the script only has those 3 lines then it should never display the hacker thing.
Reply With Quote
  #17  
Old 05-28-2006, 05:42 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Sage_Shadowbane
Excalibur...Dont try posting in the scripting section please.. Variables can only be accessed by the NPC itself, not by a client.
Clientside variables can be accessed by anything that can read the memory.

Quote:
Originally Posted by Tyrial
Hmm..

Lets say temp.dmcheck = 10
and temp.dmg = 10.

temp.dmcheck = temp.dmg-1; //This part will make temp.dmcheck into temp.dmg(10)-1. dmcheck is now 9 and dmg is still 10.

temp.dmg--; makes it 9.

So what you do is to remove 1 from temp.dmg and temp.dmcheck.
So what you did is the same as doing:

temp.dmg--;
temp.dmcheck = temp.dmg;


right?

Correct me if I'm wrong.
It's the point that he's doing both of them separately. Makes it more elusive for hackers to catch.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #18  
Old 05-28-2006, 06:25 AM
Bl0nkt Bl0nkt is offline
Era Developer
Bl0nkt's Avatar
Join Date: Mar 2005
Location: Pennsylvania
Posts: 1,589
Bl0nkt will become famous soon enough
Send a message via AIM to Bl0nkt
Quote:
Originally Posted by Stefan
Just print them (with echo()) to know if they are really the same, if the script only has those 3 lines then it should never display the hacker thing.
Stop copying me. >:[
Reply With Quote
  #19  
Old 05-29-2006, 01:06 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Bl0nkt
Stop copying me. >:[
Exquooze me?

Quote:
Originally Posted by ApothiX
Have you tried doing a pre-decrement of the temp.dam variable? I don't really think that it would matter, but it's worth a shot I guess. (pre-decrement is: --temp.dmg

Also, try echoing temp.dmg and temp.dmcheck, and see if they really are not the same.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #20  
Old 05-30-2006, 09:40 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
The script wasn't fully updating on players (wtf?) when I updated it in RC. It was returning the check as 0.
Once they restarted Graal, it worked fine.
Reply With Quote
  #21  
Old 05-31-2006, 02:42 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Yen
The script wasn't fully updating on players (wtf?) when I updated it in RC. It was returning the check as 0.
Once they restarted Graal, it worked fine.
Hm I had something like that happen to me before aswell, except it was a serverside script not updating, and I had to restart the NPC Server to get it to update :x

The script was updated on RC, like you could read the changes, but none of the changes made a difference. It's like it was storing the script on the hard drive, but no reloading it into memory.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:36 AM.


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