Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-24-2011, 02:47 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Check if a player is on a wall.

I have searched the wiki about 5 times now and I still can't find the answer to my question. How do I check if a player is on a wall, in other words on a blocked tile like a wall tile or a roof tile? It may sound a little bit weird asking a simple question like this, but I can't find the answer!
__________________
Reply With Quote
  #2  
Old 07-24-2011, 03:08 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
PHP Code:
onwall(float x, float y)
onwall2(float x, float y, float width, float height) 
Keep in mind onwall2() uses the same algorithms as the polygons, making it a bit faulty.
Reply With Quote
  #3  
Old 07-24-2011, 03:10 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Quote:
Originally Posted by Crow View Post
PHP Code:
onwall(float x, float y)
onwall2(float x, float y, float width, float height) 
Keep in mind onwall2 uses the same algorithms as the polygons, making it a bit faulty.
player.onwall player.x, player.y?
__________________
Reply With Quote
  #4  
Old 07-24-2011, 03:13 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Emera View Post
player.onwall player.x, player.y?
onwall() is not part of the player object. Also, it will only check for a single pixel. Things like onwall(player.x + 1.5, player.y + 2) are common, since that'd be approximately the center of the player's bounding box.
Reply With Quote
  #5  
Old 07-24-2011, 11:04 PM
Tricxta Tricxta is offline
The Muffin Man
Tricxta's Avatar
Join Date: Oct 2010
Location: Australia
Posts: 563
Tricxta is just really niceTricxta is just really nice
Dusty made a killer thread on this kinda stuff
http://forums.graalonline.com/forums...hp?t=134258376

Read up and become a wiz =P
__________________
Quote:
Originally Posted by Crono View Post
No look at it, Stefan is totally trolling Thor. Calling Classic a "playerworld" (something it's not supposed to be) is the ultimate subtle insult to a true fan.

It's genius.
Reply With Quote
  #6  
Old 07-28-2011, 01:48 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
I kept playing around, and this is what I got.
PHP Code:
function onActionServerSide() {
    if (
params[0] == "hacker") {
        
setlevel2("levelname", x, y); //Action after detection
        
echo("[Hack Prevention]: "@player.account@" was caught on a wall."); 
    }
}

//#CLIENTSIDE

function onCreated() {
    
this.admins = 
    {
"wont be affected by onwall"}; //Won't be affected
    
setTimer(0.05); //Starts timer
}

function 
onTimeout() {
    if (
onwall(player.x + 1.5, player.y + 2)) { //Detects if onwall
        
triggerserver("gui", this.name, "hacker");
    } else if (
player.account in this.admins) return;
    
setTimer(1); //Stop RC spam
} 
__________________
Reply With Quote
  #7  
Old 07-28-2011, 02:41 PM
0PiX0 0PiX0 is offline
Coder
0PiX0's Avatar
Join Date: Jan 2011
Posts: 130
0PiX0 is a jewel in the rough0PiX0 is a jewel in the rough
You will want to check
Quote:
Originally Posted by Emera View Post
PHP Code:
this.admins = 
    {
"wont be affected by onwall"}; //Won't be affected 
on the server side.

However, it might be better to set a var on staff such as clientr.staff = 1
That way you won't have to list your admins in each system, you can just check player.clientr.staff
Reply With Quote
  #8  
Old 07-28-2011, 02:47 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
True, it would be easier to make it recognize staff members, but it is more customize able if I can enter staff into a field and have it recognize them there. The idea is a good one though, but unfortunately I am no longer working on this. Thank you 0pix0 anyway.
__________________
Reply With Quote
  #9  
Old 07-28-2011, 04:55 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Not a good way to check for wall hackers, and there are quite a few flaws in your code.
Reply With Quote
  #10  
Old 07-28-2011, 10:50 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Emera View Post
True, it would be easier to make it recognize staff members, but it is more customize able if I can enter staff into a field and have it recognize them there. The idea is a good one though, but unfortunately I am no longer working on this. Thank you 0pix0 anyway.
It should be done on serverside even if you use an array. As a general rule for writing secure code, assume that anything you write on clientside can be edited by any player.
__________________
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 07:07 AM.


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